-
Notifications
You must be signed in to change notification settings - Fork 1
Update for json-schema-org#167 #2
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor questions/objections but otherwise looks good.
In addition to a boolean value or an object using schema kewyords defined | ||
in the meta-schema, a schema may be represnted by an object containing a "$ref" property. | ||
The value of the $ref is a URI Reference. | ||
The "$ref" keyword is used to reference an externally defined schema, and provides the ability to validate recursive structures through self-reference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"externally" suggests "external to the JSON Schema document" to me, but I primarily use "$ref" within the same document. What meaning were you going for here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention was to indicate schemas don't necessarily have to be inside the current one; it wasn't intended to mean exclusively. I'll take this out.
Resolved against the current URI base, it identifies the URI of a schema to use. | ||
The referenced schema MUST NOT itself contain a "$ref" property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with this. While a double (or worse) reference is somewhere between silly and a bad idea, it could easily come up when different people maintain different parts of an ecosystem.
This is the kind of thing that would be caught by a linter rather than spec enforcement. I could support a SHOULD NOT here, though. Would that work for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue the $ref behavior is only guaranteed for subschemas, this is one way of enforcing that.
The behavior can be done by placing it inside an "allOf" if desired.
But I suppose this is an issue for a... new issue anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow here- when we spoke on IRC the idea was that both booleans and references would be valid schemas anywhere. It's a bit weird to have a schema that's just a reference but there could be a reason for it. I still think SHOULD NOT is more correct, but I think I might be missing part of your point.
@awwright not sure how email notifications work when I comment on an "outdated" diff, so putting it here too: I'm not sure I follow the "only subschemas" line of thought here- when we spoke on IRC the idea was that both booleans and references would be valid schemas anywhere. It's a bit weird to have a schema that's just a reference but there could be a reason for it. I still think SHOULD NOT is more correct, but perhaps I'm just missing part of your point? |
@awwright Since I have filed json-schema-org#174 for the question of a reference being a valid root schema, I will go ahead and merge this in. We can modify it if we resolve json-schema-org#174 in favor of allow references as root schemas. If it goes the other way, this is a good clarification so might as well get it in now. |
Some edits for json-schema-org#167
subschema is either an object or a boolean
line informative instead of normative (it's a fact that's already true of all schemas), and