From bd53feb410df3fe80384b71558b471d54563af41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Fern=C3=A1ndez?= Date: Sat, 5 Apr 2025 11:03:58 +0200 Subject: [PATCH 1/2] feat: replace jason by built-in json encoder/decoder --- .../codegen/languages/ElixirClientCodegen.java | 5 ++--- .../src/main/resources/elixir/connection.ex.mustache | 2 +- .../src/main/resources/elixir/deserializer.ex.mustache | 10 ++++------ .../src/main/resources/elixir/model.mustache | 2 +- .../main/resources/elixir/request_builder.ex.mustache | 6 +++--- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java index 2f73cfd6f33d..99be37036d74 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java @@ -57,11 +57,10 @@ public class ElixirClientCodegen extends DefaultCodegen { // This is the name of elixir project name; protected static final String defaultPackageName = "openapi_client"; - String supportedElixirVersion = "1.10"; + String supportedElixirVersion = "1.18"; List extraApplications = Arrays.asList(":logger"); List deps = Arrays.asList( "{:tesla, \"~> 1.7\"}", - "{:jason, \"~> 1.4\"}", "{:ex_doc, \"~> 0.30\", only: :dev, runtime: false}", "{:dialyxir, \"~> 1.3\", only: [:dev, :test], runtime: false}"); @@ -694,7 +693,7 @@ public String codeMappingKey() { } public String decodedStruct() { - // Let Jason decode the entire response into a generic blob + // Decode the entire response into a generic blob if (isMap) { return "%{}"; } diff --git a/modules/openapi-generator/src/main/resources/elixir/connection.ex.mustache b/modules/openapi-generator/src/main/resources/elixir/connection.ex.mustache index 6683a7a456be..18c795e23906 100644 --- a/modules/openapi-generator/src/main/resources/elixir/connection.ex.mustache +++ b/modules/openapi-generator/src/main/resources/elixir/connection.ex.mustache @@ -216,7 +216,7 @@ defmodule {{moduleName}}.Connection do tesla_options = Application.get_env(:tesla, __MODULE__, []) middleware = Keyword.get(tesla_options, :middleware, []) - json_engine = Keyword.get(tesla_options, :json, Jason) + json_engine = Keyword.get(tesla_options, :json, JSON) user_agent = Keyword.get( diff --git a/modules/openapi-generator/src/main/resources/elixir/deserializer.ex.mustache b/modules/openapi-generator/src/main/resources/elixir/deserializer.ex.mustache index 6c3ece2818a1..b0b0ad169119 100644 --- a/modules/openapi-generator/src/main/resources/elixir/deserializer.ex.mustache +++ b/modules/openapi-generator/src/main/resources/elixir/deserializer.ex.mustache @@ -4,15 +4,13 @@ defmodule {{moduleName}}.Deserializer do Helper functions for deserializing responses into models """ - @jason_decode_opts [keys: :strings] - - def jason_decode(json) do - Jason.decode(json, @jason_decode_opts) + def json_decode(json) do + JSON.decode(json) end - def jason_decode(json, module) do + def json_decode(json, module) do json - |> jason_decode() + |> json_decode() |> case do {:ok, decoded} -> {:ok, to_struct(decoded, module)} {:error, _} = error -> error diff --git a/modules/openapi-generator/src/main/resources/elixir/model.mustache b/modules/openapi-generator/src/main/resources/elixir/model.mustache index e2dc0facf911..e7afe8407d01 100644 --- a/modules/openapi-generator/src/main/resources/elixir/model.mustache +++ b/modules/openapi-generator/src/main/resources/elixir/model.mustache @@ -4,7 +4,7 @@ {{&description}} """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ {{#vars}}{{#atom}}{{&baseName}}{{/atom}}{{^-last}}, {{/-last}}{{/vars}} diff --git a/modules/openapi-generator/src/main/resources/elixir/request_builder.ex.mustache b/modules/openapi-generator/src/main/resources/elixir/request_builder.ex.mustache index bda2ce4efa73..05a8527bdca7 100644 --- a/modules/openapi-generator/src/main/resources/elixir/request_builder.ex.mustache +++ b/modules/openapi-generator/src/main/resources/elixir/request_builder.ex.mustache @@ -94,7 +94,7 @@ defmodule {{moduleName}}.RequestBuilder do Tesla.Multipart.add_field( multipart, key, - Jason.encode!(value), + JSON.encode!(value), headers: [{:"Content-Type", "application/json"}] ) end) @@ -187,10 +187,10 @@ defmodule {{moduleName}}.RequestBuilder do defp decode(%Tesla.Env{} = env, false), do: {:ok, env} defp decode(%Tesla.Env{body: body}, %{}) do - {{moduleName}}.Deserializer.jason_decode(body) + {{moduleName}}.Deserializer.json_decode(body) end defp decode(%Tesla.Env{body: body}, module) do - {{moduleName}}.Deserializer.jason_decode(body, module) + {{moduleName}}.Deserializer.json_decode(body, module) end end From 4c3c2cf3cdb8e612966a31a9f343649c6691c620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Fern=C3=A1ndez?= Date: Sat, 5 Apr 2025 11:28:29 +0200 Subject: [PATCH 2/2] chore: update samples --- .../petstore/elixir/lib/openapi_petstore/connection.ex | 2 +- .../elixir/lib/openapi_petstore/deserializer.ex | 10 ++++------ .../model/_foo_get_default_response.ex | 2 +- .../lib/openapi_petstore/model/_special_model_name_.ex | 2 +- .../model/additional_properties_class.ex | 2 +- .../openapi_petstore/model/all_of_with_single_ref.ex | 2 +- .../elixir/lib/openapi_petstore/model/animal.ex | 2 +- .../petstore/elixir/lib/openapi_petstore/model/any.ex | 2 +- .../elixir/lib/openapi_petstore/model/api_response.ex | 2 +- .../model/array_of_array_of_number_only.ex | 2 +- .../lib/openapi_petstore/model/array_of_number_only.ex | 2 +- .../elixir/lib/openapi_petstore/model/array_test.ex | 2 +- .../lib/openapi_petstore/model/capitalization.ex | 2 +- .../petstore/elixir/lib/openapi_petstore/model/cat.ex | 2 +- .../elixir/lib/openapi_petstore/model/category.ex | 2 +- .../lib/openapi_petstore/model/child_with_nullable.ex | 2 +- .../elixir/lib/openapi_petstore/model/class_model.ex | 2 +- .../elixir/lib/openapi_petstore/model/client.ex | 2 +- .../lib/openapi_petstore/model/deprecated_model.ex | 2 +- .../petstore/elixir/lib/openapi_petstore/model/dog.ex | 2 +- .../elixir/lib/openapi_petstore/model/enum_arrays.ex | 2 +- .../elixir/lib/openapi_petstore/model/enum_class.ex | 2 +- .../elixir/lib/openapi_petstore/model/enum_test.ex | 2 +- .../model/fake_big_decimal_map_200_response.ex | 2 +- .../petstore/elixir/lib/openapi_petstore/model/file.ex | 2 +- .../openapi_petstore/model/file_schema_test_class.ex | 2 +- .../petstore/elixir/lib/openapi_petstore/model/foo.ex | 2 +- .../elixir/lib/openapi_petstore/model/format_test.ex | 2 +- .../lib/openapi_petstore/model/has_only_read_only.ex | 2 +- .../lib/openapi_petstore/model/health_check_result.ex | 2 +- .../petstore/elixir/lib/openapi_petstore/model/list.ex | 2 +- .../elixir/lib/openapi_petstore/model/map_test.ex | 2 +- ...mixed_properties_and_additional_properties_class.ex | 2 +- .../lib/openapi_petstore/model/model_200_response.ex | 2 +- .../petstore/elixir/lib/openapi_petstore/model/name.ex | 2 +- .../lib/openapi_petstore/model/nullable_class.ex | 2 +- .../elixir/lib/openapi_petstore/model/number_only.ex | 2 +- .../model/object_with_deprecated_fields.ex | 2 +- .../elixir/lib/openapi_petstore/model/order.ex | 2 +- .../lib/openapi_petstore/model/outer_composite.ex | 2 +- .../elixir/lib/openapi_petstore/model/outer_enum.ex | 2 +- .../openapi_petstore/model/outer_enum_default_value.ex | 2 +- .../lib/openapi_petstore/model/outer_enum_integer.ex | 2 +- .../model/outer_enum_integer_default_value.ex | 2 +- .../model/outer_object_with_enum_property.ex | 2 +- .../lib/openapi_petstore/model/parent_with_nullable.ex | 2 +- .../petstore/elixir/lib/openapi_petstore/model/pet.ex | 2 +- .../lib/openapi_petstore/model/read_only_first.ex | 2 +- .../elixir/lib/openapi_petstore/model/return.ex | 2 +- .../lib/openapi_petstore/model/single_ref_type.ex | 2 +- .../petstore/elixir/lib/openapi_petstore/model/tag.ex | 2 +- ...st_inline_freeform_additional_properties_request.ex | 2 +- .../petstore/elixir/lib/openapi_petstore/model/user.ex | 2 +- .../elixir/lib/openapi_petstore/request_builder.ex | 6 +++--- samples/client/petstore/elixir/mix.exs | 3 +-- 55 files changed, 60 insertions(+), 63 deletions(-) diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/connection.ex b/samples/client/petstore/elixir/lib/openapi_petstore/connection.ex index d3782e7f3a1d..ec43955eaf29 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/connection.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/connection.ex @@ -153,7 +153,7 @@ defmodule OpenapiPetstore.Connection do tesla_options = Application.get_env(:tesla, __MODULE__, []) middleware = Keyword.get(tesla_options, :middleware, []) - json_engine = Keyword.get(tesla_options, :json, Jason) + json_engine = Keyword.get(tesla_options, :json, JSON) user_agent = Keyword.get( diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/deserializer.ex b/samples/client/petstore/elixir/lib/openapi_petstore/deserializer.ex index a1b42393e42e..dcad80581fe9 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/deserializer.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/deserializer.ex @@ -6,15 +6,13 @@ defmodule OpenapiPetstore.Deserializer do Helper functions for deserializing responses into models """ - @jason_decode_opts [keys: :strings] - - def jason_decode(json) do - Jason.decode(json, @jason_decode_opts) + def json_decode(json) do + JSON.decode(json) end - def jason_decode(json, module) do + def json_decode(json, module) do json - |> jason_decode() + |> json_decode() |> case do {:ok, decoded} -> {:ok, to_struct(decoded, module)} {:error, _} = error -> error diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/_foo_get_default_response.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/_foo_get_default_response.ex index 4dafa97e4298..55e0d1757be3 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/_foo_get_default_response.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/_foo_get_default_response.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.FooGetDefaultResponse do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :string ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/_special_model_name_.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/_special_model_name_.ex index f1f419c32c24..99dec84fe15b 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/_special_model_name_.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/_special_model_name_.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.SpecialModelName do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :"$special[property.name]" ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/additional_properties_class.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/additional_properties_class.ex index 2bd3c84277e7..47baf29d08c6 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/additional_properties_class.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/additional_properties_class.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.AdditionalPropertiesClass do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :map_property, :map_of_map_property diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/all_of_with_single_ref.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/all_of_with_single_ref.ex index a3c5f3a0fb96..9b3ae8496007 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/all_of_with_single_ref.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/all_of_with_single_ref.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.AllOfWithSingleRef do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :username, :SingleRefType diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/animal.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/animal.ex index f6eb8ce85f86..e60dd0d8f6a8 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/animal.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/animal.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Animal do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :className, :color diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/any.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/any.ex index 7dee7481b544..8e87eb483980 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/any.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/any.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Any do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :"@type" ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/api_response.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/api_response.ex index 103922790d5b..77097cdb272a 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/api_response.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/api_response.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.ApiResponse do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :code, :type, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/array_of_array_of_number_only.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/array_of_array_of_number_only.ex index 31dce8c2e194..2c677885ca2e 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/array_of_array_of_number_only.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/array_of_array_of_number_only.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.ArrayOfArrayOfNumberOnly do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :ArrayArrayNumber ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/array_of_number_only.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/array_of_number_only.ex index b6bc4ffd9f2c..095cf30a5961 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/array_of_number_only.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/array_of_number_only.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.ArrayOfNumberOnly do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :ArrayNumber ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/array_test.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/array_test.ex index eb347789d971..83f38674af27 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/array_test.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/array_test.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.ArrayTest do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :array_of_string, :array_array_of_integer, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/capitalization.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/capitalization.ex index c26b747c45bc..0465dafe7440 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/capitalization.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/capitalization.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Capitalization do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :smallCamel, :CapitalCamel, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/cat.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/cat.ex index 8690c017a0e2..8ca68ee7037c 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/cat.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/cat.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Cat do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :className, :color, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/category.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/category.ex index 83f77f681124..a82c4d039667 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/category.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/category.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Category do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :id, :name diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/child_with_nullable.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/child_with_nullable.ex index cb7313d7efd3..a8d8bb2aa742 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/child_with_nullable.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/child_with_nullable.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.ChildWithNullable do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :type, :nullableProperty, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/class_model.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/class_model.ex index b0fd030518d4..eec88ec44d79 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/class_model.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/class_model.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.ClassModel do Model for testing model with \"_class\" property """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :_class ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/client.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/client.ex index 311d4608ad39..db2d5e170363 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/client.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/client.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Client do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :client ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/deprecated_model.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/deprecated_model.ex index fe3ac2e6f3f0..1352dc9c365d 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/deprecated_model.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/deprecated_model.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.DeprecatedModel do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :name ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/dog.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/dog.ex index 557c0403dca9..bfad3b402ae2 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/dog.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/dog.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Dog do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :className, :color, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_arrays.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_arrays.ex index 950a2362f615..cf92835e5996 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_arrays.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_arrays.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.EnumArrays do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :just_symbol, :array_enum diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_class.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_class.ex index 58fdbdef4f1e..48ab6e68319c 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_class.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_class.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.EnumClass do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_test.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_test.ex index f3cc024d955b..f0890be51e74 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_test.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_test.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.EnumTest do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :enum_string, :enum_string_required, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/fake_big_decimal_map_200_response.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/fake_big_decimal_map_200_response.ex index d5d8169fc07f..f9e5ef7517c9 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/fake_big_decimal_map_200_response.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/fake_big_decimal_map_200_response.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.FakeBigDecimalMap200Response do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :someId, :someMap diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/file.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/file.ex index 8ae26a408d16..ebdbbef0cfcf 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/file.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/file.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.File do Must be named `File` for test. """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :sourceURI ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/file_schema_test_class.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/file_schema_test_class.ex index 0f83a3885e82..244686df6555 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/file_schema_test_class.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/file_schema_test_class.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.FileSchemaTestClass do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :file, :files diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/foo.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/foo.ex index 8e753c0b6d20..58449af14db9 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/foo.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/foo.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Foo do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :bar ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/format_test.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/format_test.ex index 94550b80dfc6..ef67673e3771 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/format_test.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/format_test.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.FormatTest do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :integer, :int32, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/has_only_read_only.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/has_only_read_only.ex index 29416e81d4d3..01b3b2fb91ba 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/has_only_read_only.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/has_only_read_only.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.HasOnlyReadOnly do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :bar, :foo diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/health_check_result.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/health_check_result.ex index c6e063700b27..b1bfd45fa62e 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/health_check_result.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/health_check_result.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.HealthCheckResult do Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :NullableMessage ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/list.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/list.ex index cc989874bdb4..5c724750c95f 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/list.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/list.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.List do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :"123-list" ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/map_test.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/map_test.ex index 2a263cd1398e..1b1147538ded 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/map_test.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/map_test.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.MapTest do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :map_map_of_string, :map_of_enum_string, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/mixed_properties_and_additional_properties_class.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/mixed_properties_and_additional_properties_class.ex index a633727c3e55..89955b8e66e5 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/mixed_properties_and_additional_properties_class.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/mixed_properties_and_additional_properties_class.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.MixedPropertiesAndAdditionalPropertiesClass do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :uuid, :dateTime, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/model_200_response.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/model_200_response.ex index 57456a09c0e1..003f26a91592 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/model_200_response.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/model_200_response.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Model200Response do Model for testing model name starting with number """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :name, :class diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/name.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/name.ex index ad8cec7ac01c..d220a783b201 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/name.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/name.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Name do Model for testing model name same as property name """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :name, :snake_case, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/nullable_class.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/nullable_class.ex index 36595f37c08a..8fab347fad94 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/nullable_class.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/nullable_class.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.NullableClass do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :integer_prop, :number_prop, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/number_only.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/number_only.ex index bd0726a29b5a..755a4174bb06 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/number_only.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/number_only.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.NumberOnly do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :JustNumber ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/object_with_deprecated_fields.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/object_with_deprecated_fields.ex index 1ec741f76088..17362be72e16 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/object_with_deprecated_fields.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/object_with_deprecated_fields.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.ObjectWithDeprecatedFields do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :uuid, :id, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/order.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/order.ex index ab79f9440056..5bf534749edd 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/order.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/order.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Order do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :id, :petId, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_composite.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_composite.ex index 78035fdf5cb7..af0b16a5ab46 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_composite.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_composite.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.OuterComposite do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :my_number, :my_string, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum.ex index 1f4ad97da8c8..d3ba48395d13 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.OuterEnum do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_default_value.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_default_value.ex index f03b45c5eda8..9d5450176764 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_default_value.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_default_value.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.OuterEnumDefaultValue do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer.ex index 406547bfa699..8829e9bc0217 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.OuterEnumInteger do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer_default_value.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer_default_value.ex index f3478f5e62a2..45890241e7c2 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer_default_value.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer_default_value.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.OuterEnumIntegerDefaultValue do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_object_with_enum_property.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_object_with_enum_property.ex index ec192994544d..4bf28207c93f 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_object_with_enum_property.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_object_with_enum_property.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.OuterObjectWithEnumProperty do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :value ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/parent_with_nullable.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/parent_with_nullable.ex index 3924d7658de1..62a258b37a78 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/parent_with_nullable.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/parent_with_nullable.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.ParentWithNullable do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :type, :nullableProperty diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/pet.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/pet.ex index a872b739c809..7870bfc46671 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/pet.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/pet.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Pet do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :id, :category, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/read_only_first.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/read_only_first.ex index e1d20c1e866f..c5e3baa77a30 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/read_only_first.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/read_only_first.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.ReadOnlyFirst do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :bar, :baz diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/return.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/return.ex index 4719bd1fc9f7..26591d8025c2 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/return.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/return.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Return do Model for testing reserved words """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :return ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/single_ref_type.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/single_ref_type.ex index 6b74942f72cf..cc9601ffad66 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/single_ref_type.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/single_ref_type.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.SingleRefType do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/tag.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/tag.ex index 3f3d77538882..bc2bf64027ea 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/tag.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/tag.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.Tag do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :id, :name diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/test_inline_freeform_additional_properties_request.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/test_inline_freeform_additional_properties_request.ex index 4baad054575b..ce0b4ca8dc3c 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/test_inline_freeform_additional_properties_request.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/test_inline_freeform_additional_properties_request.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.TestInlineFreeformAdditionalPropertiesRequest do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :someProperty ] diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/user.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/user.ex index b01c72878df6..c522fc4822b0 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/user.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/user.ex @@ -6,7 +6,7 @@ defmodule OpenapiPetstore.Model.User do """ - @derive Jason.Encoder + @derive JSON.Encoder defstruct [ :id, :username, diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/request_builder.ex b/samples/client/petstore/elixir/lib/openapi_petstore/request_builder.ex index 270aba091a78..afa7da3e0082 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/request_builder.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/request_builder.ex @@ -96,7 +96,7 @@ defmodule OpenapiPetstore.RequestBuilder do Tesla.Multipart.add_field( multipart, key, - Jason.encode!(value), + JSON.encode!(value), headers: [{:"Content-Type", "application/json"}] ) end) @@ -189,10 +189,10 @@ defmodule OpenapiPetstore.RequestBuilder do defp decode(%Tesla.Env{} = env, false), do: {:ok, env} defp decode(%Tesla.Env{body: body}, %{}) do - OpenapiPetstore.Deserializer.jason_decode(body) + OpenapiPetstore.Deserializer.json_decode(body) end defp decode(%Tesla.Env{body: body}, module) do - OpenapiPetstore.Deserializer.jason_decode(body, module) + OpenapiPetstore.Deserializer.json_decode(body, module) end end diff --git a/samples/client/petstore/elixir/mix.exs b/samples/client/petstore/elixir/mix.exs index 7ccbcd9ffb3c..167ea9f44783 100644 --- a/samples/client/petstore/elixir/mix.exs +++ b/samples/client/petstore/elixir/mix.exs @@ -5,7 +5,7 @@ defmodule OpenapiPetstore.Mixfile do [ app: :openapi_petstore, version: "1.0.0", - elixir: "~> 1.10", + elixir: "~> 1.18", build_embedded: Mix.env() == :prod, start_permanent: Mix.env() == :prod, package: package(), @@ -36,7 +36,6 @@ defmodule OpenapiPetstore.Mixfile do defp deps do [ {:tesla, "~> 1.7"}, - {:jason, "~> 1.4"}, {:ex_doc, "~> 0.30", only: :dev, runtime: false}, {:dialyxir, "~> 1.3", only: [:dev, :test], runtime: false} ]