Extra JSON Reference properties ignored - reduces reusability of references
See original GitHub issueHi everyone.
I feel that the ignoring of extra properties when using JSON References goes against the goal of reusability.
Take this example from a fictional Swagger contract:
{
addresses: [
"homeAddress": {
"description": "The premises at which electricity is provided.",
"$ref": "#/definitions/Address"
},
"invoiceAddress": {
"description": "The billing address - must be where the customer's credit card is registered.",
"$ref": "#/definitions/Address"
}
]
}
The “description” properties help to distinguish between the two uses of the “Address” Reference. Of course you could argue that better naming of the “homeAddress” and “invoiceAddress” properties could achieve this, but we are not always in control of property names in our data models and sometimes you need a more verbose description.
The Swagger editor (http://editor.swagger.io/#/) is an example of an application that could be improved by removing this limitation.
Is this something that has been raised previously? Please see here for a discussion on the Swagger Google Group: https://groups.google.com/forum/#!topic/swagger-swaggersocket/ewgimdO2cOI
Issue Analytics
- State:
- Created 8 years ago
- Reactions:73
- Comments:87 (55 by maintainers)
Top GitHub Comments
Actually it supported both in Swagger and Draft-4, you just need to use
allOf
keyword. So instead of:You should write:
It standard usage of
allOf
nothing fancy here, and I think it fully solve this problem.I think this is a very good Proposal. In my example I want to set: