There was an error while loading. Please reload this page.
1 parent f1c7577 commit 59995c2Copy full SHA for 59995c2
3 files changed
README.md
@@ -102,6 +102,7 @@ Ecto type | JSON type
102
:---------------------- | :--------------------
103
`:integer` | `integer`
104
`:float` | `number`
105
+`:decimal` | `number`
106
`:boolean` | `boolean`
107
`:string` | `string`
108
`:map` | `object`
lib/schemecto.ex
@@ -280,6 +280,7 @@ defmodule Schemecto do
280
defp do_type_to_json_schema(:string), do: %{"type" => "string"}
281
defp do_type_to_json_schema(:integer), do: %{"type" => "integer"}
282
defp do_type_to_json_schema(:float), do: %{"type" => "number"}
283
+ defp do_type_to_json_schema(:decimal), do: %{"type" => "number"}
284
defp do_type_to_json_schema(:boolean), do: %{"type" => "boolean"}
285
defp do_type_to_json_schema(:map), do: %{"type" => "object"}
286
test/schemecto_test.exs
@@ -426,6 +426,7 @@ defmodule SchemectoTest do
426
%{name: :name, type: :string},
427
%{name: :age, type: :integer},
428
%{name: :score, type: :float},
429
+ %{name: :price, type: :decimal},
430
%{name: :active, type: :boolean},
431
%{name: :metadata, type: :map},
432
%{name: :tags, type: {:array, :string}},
@@ -442,6 +443,7 @@ defmodule SchemectoTest do
442
443
"name" => %{"type" => "string"},
444
"age" => %{"type" => "integer"},
445
"score" => %{"type" => "number"},
446
+ "price" => %{"type" => "number"},
447
"active" => %{"type" => "boolean"},
448
"metadata" => %{"type" => "object"},
449
"tags" => %{"type" => "array", "items" => %{"type" => "string"}},
0 commit comments