Open tomgi opened 1 year ago
Make sure to not override an existing type: ["null", "array"] with type: "array" if it's already filled by visit_predicate before visit_set.
type: ["null", "array"]
type: "array"
visit_predicate
visit_set
For example for the test schema https://github.com/dry-rb/dry-schema/blob/3065a8b97d89befce9379e6f5655783957123744/spec/extensions/json_schema/schema_spec.rb#L142-L146
the result of the fix is:
{ "$schema": "http://json-schema.org/draft-06/schema#", "type": "object", "properties": { "list": { - "type": "array", + "type": [ + "null", + "array" + ], "items": { "type": "object", "properties": { "name": { "type": "string" } }, "required": [ "name" ] } } }, "required": [ "list" ] }
Make sure to not override an existing
type: ["null", "array"]
withtype: "array"
if it's already filled byvisit_predicate
beforevisit_set
.For example for the test schema https://github.com/dry-rb/dry-schema/blob/3065a8b97d89befce9379e6f5655783957123744/spec/extensions/json_schema/schema_spec.rb#L142-L146
the result of the fix is: