-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
About using allOf for single types #2062
Comments
As the docs say, this behavior was introduced with
The trick is that there's no inheritance. Schemas are only composed, therefore they do not override each other's definitions. For this reason, we can stop putting empty |
For consistence, I think we should upgrade the extension schemas to |
Despite trying to figure out a definite answer to this, I'm still not sure whether the new way of using
and I think that it should be valid to replace that with
But omitting the |
I think I stumbled over a possible answer to the last question in APIDevTools/json-schema-ref-parser#145 :
(The person who wrote this may be an active maintainer of the JSON schema spec, but at least is a very active contributor) It is now debatable whether this implies that it is OK to leave out the type, and whether
but iff omitting the (In the meta-schema, the |
The schema currently uses
allOf
consistently to refer to single types. For example, inaccessor.bufferView
:From what I read in the documentation about
allOf
and$ref
, to my current understanding, it should be possible to replace this use ofallOf
with a plain$ref
, as inThe difficulties of modeling inheritance in general (c.f. #1144 ), the notes about "Subschema Independence" in the documentation, and (as usual:) possible changes between the Schema drafts that I may not yet have fully understood make me hesitate a bit here.
But I wondered whether there would be any semantical difference between the two options, and whether the plain
$ref
should be preferred for cases whereallOf
otherwise contains only a single type.The text was updated successfully, but these errors were encountered: