swagger-js: A $ref needs to be wrapped inside a schema which is not according to spec.
This is a followup to https://github.com/swagger-api/swagger-ui/issues/1228
I have
"Person" : {
"type" : "object",
"title" : "Information about a person",
"properties" : {
"externalId1" : {
"title" : "first",
"type" : "object",
"$ref" : "#/definitions/map1"
}
which does not work. The answer was to wrap it inside a “schema” and then it works:
"externalId1" : {
"title" : "first",
"type" : "object",
"schema": { // < -------------- This will make it work like you expect
"$ref" : "#/definitions/map1"
} // ------------------- :)
},
However, after looking into the spec of both swagger and JSON schema, there is no reference anywhere the “schema” wrapper is required.
As far as I can tell, my version without the “schema” wrapper is correct.
The example here https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#simple-model does not use the “schema” wrapper.
Am I missing something?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 21 (11 by maintainers)
Ok, I thought the
descriptionis used to describe the field (externalId1andexternalId2in this case). If thedescriptionmust be on the referenced object, then you can not have a different description if you have multple references to the same object?So something like:
is not correct and not otherwise possible?
Okay, just wanted to make sure.
This how
"Person"should be defined:You add anything when there’s
$ref. This is a restriction of JSON Reference.