Open fivegrant opened 9 months ago
By introducing the exposed intertypes, those would be the ones that have specifications we could correctly validate, or those are the ones to permissively allow anything?
It would be the former. An "exposed" InterType is something we'd want to validate against.
Additionally, references are broken in the JSON Schema. Perhaps specifying a prefix like https://raw.githubusercontent.com/user/repo/some/path
would add the path in front of all $ref
s
For JSON Schema to be usable, I think it has to support:
generate_module(mod, JSONTarget; exposed_intertypes=[:SomeType, :AnotherType], prefix="https://raw.githubusercontent.com/user/repo/some/path" )
If I validate an object against a JSON Schema, it will check all
$def
s. This behavior ends up being too permissive since some types will be objects with arbitrary fields due to theObject
InterType. This means nearly any JSON will validate against it which defeats the purpose of a JSON Schema.A solution to this may be just selecting the InterTypes you want for the JSON Schema using its specific
generate_module
method's kwargs:Note that this isn't a problem with Pydantic since the constructor is called explicitly.
(Encountered this problem when reviewing this PR)