Closed maybeec closed 6 years ago
@maybeec , this is actually a restriction that comes directly from the JSON Reference specification:
Syntax
A JSON Reference is a JSON object, which contains a member named "$ref", which has a JSON string value. Example:
{ "$ref": "http://example.com/example.json#/foo/bar" }
If a JSON value does not have these characteristics, then it SHOULD NOT be interpreted as a JSON Reference.
The "$ref" string value contains a URI [RFC3986], which identifies the location of the JSON value being referenced. It is an error condition if the string value does not conform to URI syntax rules. Any members other than "$ref" in a JSON Reference object SHALL be ignored.
Thanks to make this clear. Did not know about it. It is a little strange in this specific part here, but obviously the parser is than behaving correctly.
@maybeec It definitely is strange in my opinion, and creates a restriction with no value that I can deduce. Yet there it is.
It's interesting to note that Swagger and OAS3 actually violate this in their definition of how a "Path Item" works. Unlike anywhere else in the specification, they list $ref
as a property of a path item, and the description implies that the intention is to "mix" the external path item's properties in with the local object - much as you want to do with your schema reference.
The KaiZen parser does not currently implement this, and I don't view it as a high priority.
@andylowry totally agree and I appreciate that you keep your code clean and compliant to the specification!
The following snippet declares a property to be an object of a specified reference. However, the description of the property is not read such that the parser always returns
null
on thepropertySchema.getDescription()
This is different to the case, where you declare an array type of references like
In this case, the description is correctly gathered by the parser.