Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #112

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/schema/generator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ defmodule Schema.Generator do
end

defp generate_data(_name, "timestamp_t", _field),
do: DateTime.utc_now() |> DateTime.to_unix(:microsecond)
do: DateTime.utc_now() |> DateTime.to_unix(:millisecond)

defp generate_data(_name, "datetime_t", _field),
do: DateTime.utc_now() |> DateTime.to_iso8601()
Expand Down
8 changes: 5 additions & 3 deletions lib/schema/json_schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ defmodule Schema.JsonSchema do
else
class_schema(make_class_ref(name, ext))
end
|> empty_object(properties)
|> Map.put("title", type[:caption])
|> Map.put("type", "object")
|> Map.put("properties", properties)
|> Map.put("additionalProperties", false)
|> put_required(required)
|> encode_objects(type[:objects])
|> empty_object(properties)
end

defp add_java_class(obj, name) do
Expand Down Expand Up @@ -78,7 +79,8 @@ defmodule Schema.JsonSchema do
defp class_schema(id) do
%{
"$schema" => @schema_version,
"$id" => id
"$id" => id,
"additionalProperties" => false
}
end

Expand Down Expand Up @@ -185,7 +187,7 @@ defmodule Schema.JsonSchema do
true -> type
end
end

defp encode_object(schema, _name, attr) do
type = attr[:object_type]
Map.put(schema, "$ref", make_object_ref(type))
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
defmodule Schema.MixProject do
use Mix.Project

@version "2.73.1"
@version "2.74.0"

def project do
build = System.get_env("GITHUB_RUN_NUMBER") || "SNAPSHOT"
Expand Down
Loading