-
-
Notifications
You must be signed in to change notification settings - Fork 539
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
Inheritance Wiki #832
Comments
Im pretty sure thats the spec, no? Have you tried codegen it back to see what would it generate to? |
This is as expected: Swagger uses all of with the first element the base schema and the second the schema itself |
Hello, Ok, thanks for your answers.
|
BTW: This only works for swagger/openapi. For json schema validation you’d indeed need oneof inheritance - there’s an open issue for that: #13 |
Ok, I'm in a json schema case. Thx! |
Hello,
I'm trying to generate a schema with inheritance.
I try the sample code in the wiki (Animal, Dog) but the schema generated is different from the wiki (9.12.7).
I get the result below. Nno oneOf but mappings instead. Why?
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Container",
"type": "object",
"additionalProperties": false,
"properties": {
"Animal": {
"$ref": "#/definitions/Animal"
}
},
"definitions": {
"Animal": {
"type": "object",
"discriminator": {
"propertyName": "discriminator",
"mapping": {
"Dog": "#/definitions/Dog"
}
},
"additionalProperties": false,
"required": [
"discriminator"
],
"properties": {
"discriminator": {
"type": "string"
},
"Foo": {
"type": "string"
}
}
},
"Dog": {
"allOf": [
{
"$ref": "#/definitions/Animal"
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"Bar": {
"type": "string"
}
}
}
]
}
Thanks in advance for your help.
Regards
alb3ric
The text was updated successfully, but these errors were encountered: