Skip to content

Cannot generate schema from reference hyperschema #290

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

Closed
jasminemoore-verses opened this issue May 10, 2023 · 3 comments
Closed

Cannot generate schema from reference hyperschema #290

jasminemoore-verses opened this issue May 10, 2023 · 3 comments

Comments

@jasminemoore-verses
Copy link

Running cargo-typify 0.0.12.

Input at: https://gist.github.com/jasminemoore-verses/efc6db1f73d23adbb3a8d94a0bcd4cf2 (input.json)
Errors at: https://gist.github.com/jasminemoore-verses/efc6db1f73d23adbb3a8d94a0bcd4cf2 (output.txt)

The input document is a modified version of "draft-07-schema.json", the JSON Schema Metaschema from 2017. Self-references cannot be handled (see #289). The problems here are less clear.

@ahl
Copy link
Collaborator

ahl commented May 10, 2023

The initial error is that we don't currently handle the general case of type arrays:

  "type": ["object", "boolean"],

I see other looming problems such as "if": {"$ref": "#"}, i.e. a ref to nothing? and "$ref": "#/definitions/schemaArray" which doesn't appear to be defined in this schema.

@jasminemoore-verses
Copy link
Author

According to https://json-schema.org/understanding-json-schema/structuring.html#recursion , "#" as a "$ref" target should refer to the schema currently being parsed. ("#/definitions/schemaArray" was removed as it refers to "#", which could not be resolved (see #289 ), but is absolutely an error in this schema as presented.)

@ahl
Copy link
Collaborator

ahl commented May 27, 2023

See the resolution of #289

@ahl ahl closed this as completed May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants