From 71d2fdfda61f03018ab17c0d4c229a7afad7b3e8 Mon Sep 17 00:00:00 2001 From: Maarten van Vliet Date: Thu, 27 Dec 2018 19:15:22 +0100 Subject: [PATCH 1/2] Use Jason as recommended decoder --- guides/plug-phoenix.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/guides/plug-phoenix.md b/guides/plug-phoenix.md index 7ef86a9b79..77b26b2765 100644 --- a/guides/plug-phoenix.md +++ b/guides/plug-phoenix.md @@ -1,14 +1,14 @@ # Plug and Phoenix Setup First, install Absinthe.Plug and a JSON codec of your choice, -eg, [Poison](https://hex.pm/packages/poison): +eg, [Jason](https://hex.pm/packages/jason): ```elixir # filename: mix.exs def deps do [ {:absinthe_plug, "~> 1.4"}, - {:poison, "~> 2.1.0"}, + {:jason, "~> 1.1.0"}, ] end ``` @@ -28,7 +28,7 @@ you should plug Absinthe.Plug after Plug.Parsers. ```elixir plug Plug.Parsers, parsers: [:urlencoded, :multipart, :json, Absinthe.Plug.Parser], - json_decoder: Poison + json_decoder: Jason plug Absinthe.Plug, schema: MyAppWeb.Schema @@ -51,7 +51,7 @@ defmodule MyApp.Endpoint do plug Plug.Parsers, parsers: [:urlencoded, :multipart, :json], pass: ["*/*"], - json_decoder: Poison + json_decoder: Jason plug Absinthe.Plug, schema: MyAppWeb.Schema @@ -173,7 +173,7 @@ configure `Plug.Parsers` (or equivalent) to parse the request body before `Absin plug Plug.Parsers, parsers: [:urlencoded, :multipart, :json], pass: ["*/*"], - json_decoder: Poison + json_decoder: Jason ``` For `application/graphql`, the POST body will be parsed as GraphQL query string, @@ -191,7 +191,7 @@ As a plug, `Absinthe.Plug` requires very little configuration. If you want to su plug Plug.Parsers, parsers: [:urlencoded, :multipart, :json], pass: ["*/*"], - json_decoder: Poison + json_decoder: Jason plug Absinthe.Plug, schema: MyApp.Linen.Schema From 445d41d9e8c70e23dccf6cf659ec5e64531c6920 Mon Sep 17 00:00:00 2001 From: Maarten van Vliet Date: Thu, 27 Dec 2018 19:16:16 +0100 Subject: [PATCH 2/2] Set Jason as default codec in cli --- lib/mix/tasks/absinthe.schema.json.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mix/tasks/absinthe.schema.json.ex b/lib/mix/tasks/absinthe.schema.json.ex index 67e6df7e2f..981e8b2d68 100644 --- a/lib/mix/tasks/absinthe.schema.json.ex +++ b/lib/mix/tasks/absinthe.schema.json.ex @@ -6,7 +6,7 @@ defmodule Mix.Tasks.Absinthe.Schema.Json do @shortdoc "Generate a schema.json file for an Absinthe schema" @default_filename "./schema.json" - @default_codec_name "Poison" + @default_codec_name "Jason" @moduledoc """ Generate a schema.json file