-
Notifications
You must be signed in to change notification settings - Fork 937
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
extending definitions #254
Comments
You could try the {
...
"definitions": {
"Thing": {
...
},
"ThingWithTimestamp": {
"description": "Extended thing",
"allOf": [
{
"$ref": "#/definitions/Thing"
}, {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int32",
"description": "The ID",
}
},
"required": [
"id"
]
}
]
}
} More on the subject can be found at: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#composition-and-inheritance-polymorphism |
Cool, thanks. In fact I did notice the allOf late last week and figured that might be worth looking at! |
Ok, tried it and it is almost good :) The data looks good and swagger-ui does do the right thing. However, with the current master I get this exception:
Test definitions:
Generated definitions:
|
Should be fixed, thanks! |
Not sure if this is the right place or the swagger specs, but I'd like to extend a definition.
Basically I have 2 versions of a model:
a) without ids or timestamps (that is what is used to persist new instances)
b) a full version with timestamps/id coming back from the persistence layer
I figured I can leave the id/timestamps as optional, but that doesn't look really nice in the UI and is not quite the truth.
And finally, thanks for the good work :)
The text was updated successfully, but these errors were encountered: