Skip to content

Commit

Permalink
replace Poison with Jason
Browse files Browse the repository at this point in the history
  • Loading branch information
ignaciogoldchluk-yolo committed Feb 17, 2025
1 parent b82d362 commit 3644cb9
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions lib/gremlex/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ defmodule Gremlex.Client do
payload =
query
|> Request.new()
|> Poison.encode!()
|> Jason.encode!()

:poolboy.transaction(
:gremlex,
Expand Down Expand Up @@ -127,7 +127,7 @@ defmodule Gremlex.Client do
defp recv(socket, acc \\ []) do
case Socket.Web.recv!(socket) do
{:text, data} ->
response = Poison.decode!(data)
response = Jason.decode!(data)
result = Deserializer.deserialize(response)
status = response["status"]["code"]
error_message = response["status"]["message"]
Expand Down
2 changes: 1 addition & 1 deletion lib/gremlex/edge.ex
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
defmodule Gremlex.Edge do
alias Gremlex.Deserializer
@enforce_keys [:label, :id, :in_vertex, :out_vertex, :properties]
@derive [Poison.Encoder]
@type t :: %Gremlex.Edge{
label: String.t(),
id: number(),
properties: map(),
in_vertex: Gremlex.Vertex.t(),
out_vertex: Gremlex.Vertex.t()
}
@derive Jason.Encoder
defstruct [:label, :id, :in_vertex, :out_vertex, :properties]

def new(
Expand Down
2 changes: 1 addition & 1 deletion lib/gremlex/path.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Gremlex.Path do

@type t :: %Path{labels: List.t(), objects: List.t()}
@enforce_keys [:labels, :objects]
@derive [Poison.Encoder]
@derive Jason.Encoder
defstruct [:labels, :objects]

def from_response(%{"labels" => labels, "objects" => objects}) do
Expand Down
2 changes: 1 addition & 1 deletion lib/gremlex/request.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Gremlex.Request do
alias Gremlex.Graph
alias Gremlex.Request.Id
@derive [Poison.Encoder]
@derive Jason.Encoder
@op "eval"
@processor ""
@enforce_keys [:op, :processor, :requestId, :args]
Expand Down
2 changes: 1 addition & 1 deletion lib/gremlex/vertex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Gremlex.Vertex do

@type t :: %Gremlex.Vertex{label: String.t(), id: number(), properties: map()}
@enforce_keys [:label, :id]
@derive [Poison.Encoder]
@derive Jason.Encoder
defstruct [:label, :id, :properties]

def add_properties(%Vertex{properties: nil} = vertex, properties) do
Expand Down
2 changes: 1 addition & 1 deletion lib/gremlex/vertex_property.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Gremlex.VertexProperty do
vertex: number()
}
@enforce_keys [:label, :id, :value]
@derive [Poison.Encoder]
@derive Jason.Encoder
defstruct [:label, :id, :value, :vertex]

def from_response(%{"id" => json_id, "value" => value, "vertex" => vertex, "label" => label}) do
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ defmodule Gremlex.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:poison, "~> 3.1"},
{:jason, "~> 1.4"},
{:confex, "~> 3.2.3"},
{:poolboy, "~> 1.5.1"},
{:socket, "~> 0.3"},
Expand Down
7 changes: 1 addition & 6 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
"confex": {:hex, :confex, "3.2.3", "f3e29188448c790dd75b416daeedddddcce0a9bb657721cd9ed3d857a2de0434", [:mix], [], "hexpm", "ee04f41e9780be59713dfdb0d5132486db361bc79255318a8d6afdf165736107"},
"earmark": {:hex, :earmark, "1.3.1", "73812f447f7a42358d3ba79283cfa3075a7580a3a2ed457616d6517ac3738cb9", [:mix], [], "hexpm", "000aaeff08919e95e7aea13e4af7b2b9734577b3e6a7c50ee31ee88cab6ec4fb"},
"ex_doc": {:hex, :ex_doc, "0.19.3", "3c7b0f02851f5fc13b040e8e925051452e41248f685e40250d7e40b07b9f8c10", [:mix], [{:earmark, "~> 1.2", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.10", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "0e11d67e662142fc3945b0ee410c73c8c956717fbeae4ad954b418747c734973"},
"file_system": {:hex, :file_system, "0.2.6", "fd4dc3af89b9ab1dc8ccbcc214a0e60c41f34be251d9307920748a14bf41f1d3", [:mix], [], "hexpm", "0d50da6b04c58e101a3793b1600f9a03b86e3a8057b192ac1766013d35706fa6"},
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
"makeup": {:hex, :makeup, "0.8.0", "9cf32aea71c7fe0a4b2e9246c2c4978f9070257e5c9ce6d4a28ec450a839b55f", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5fbc8e549aa9afeea2847c0769e3970537ed302f93a23ac612602e805d9d1e7f"},
"makeup_elixir": {:hex, :makeup_elixir, "0.13.0", "be7a477997dcac2e48a9d695ec730b2d22418292675c75aa2d34ba0909dcdeda", [:mix], [{:makeup, "~> 0.8", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "adf0218695e22caeda2820eaba703fa46c91820d53813a2223413da3ef4ba515"},
"meck": {:hex, :meck, "0.8.13", "ffedb39f99b0b99703b8601c6f17c7f76313ee12de6b646e671e3188401f7866", [:rebar3], [], "hexpm", "d34f013c156db51ad57cc556891b9720e6a1c1df5fe2e15af999c84d6cebeb1a"},
"mix_test_watch": {:hex, :mix_test_watch, "0.9.0", "c72132a6071261893518fa08e121e911c9358713f62794a90c95db59042af375", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "817dec4a7f6edf260258002f99ac8ffaf7a8f395b27bf2d13ec24018beecec8a"},
"mock": {:hex, :mock, "0.2.1", "bfdba786903e77f9c18772dee472d020ceb8ef000783e737725a4c8f54ad28ec", [:mix], [{:meck, "~> 0.8.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "d440b817e4e3505fe2d17963b7e783ae72875011dc6ac757c21904a8cc3578ac"},
"nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm", "5c040b8469c1ff1b10093d3186e2e10dbe483cd73d79ec017993fb3985b8a9b3"},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm", "fec8660eb7733ee4117b85f55799fd3833eb769a6df71ccf8903e8dc5447cfce"},
"poolboy": {:hex, :poolboy, "1.5.2", "392b007a1693a64540cead79830443abf5762f5d30cf50bc95cb2c1aaafa006b", [:rebar3], [], "hexpm", "dad79704ce5440f3d5a3681c8590b9dc25d1a561e8f5a9c995281012860901e3"},
"socket": {:hex, :socket, "0.3.13", "98a2ab20ce17f95fb512c5cadddba32b57273e0d2dba2d2e5f976c5969d0c632", [:mix], [], "hexpm", "f82ea9833ef49dde272e6568ab8aac657a636acb4cf44a7de8a935acb8957c2e"},
"stream_data": {:hex, :stream_data, "1.1.3", "15fdb14c64e84437901258bb56fc7d80aaf6ceaf85b9324f359e219241353bfb", [:mix], [], "hexpm", "859eb2be72d74be26c1c4f272905667672a52e44f743839c57c7ee73a1a66420"},
"uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], [], "hexpm", "c790593b4c3b601f5dc2378baae7efaf5b3d73c4c6456ba85759905be792f2ac"},
}

0 comments on commit 3644cb9

Please sign in to comment.