Modelina uses specific patterns to handle combinations of schema keywords:
oneOf with allOf
If both oneOf and allOf are present, each model defined in allOf is merged into every model within the oneOf array.
oneOf with properties
If both oneOf and properties are present at the same level, the behavior is identical to the oneOf with allOf pattern. All properties defined on the root object are merged into each of the models defined within the oneOf array.
Example of oneOf with allOf pattern:
{
"allOf":[
{
"title":"Animal",
"type":"object",
"properties":{
"animalType":{
"title":"Animal Type",
"type":"string"
},
"age":{
"type":"integer",
"min":0
}
}
}
],
"oneOf":[
{
"title":"Cat",
"type":"object",
"properties":{
"animalType":{
"const":"Cat"
},
"huntingSkill":{
"title":"Hunting Skill",
"type":"string",
"enum":[
"clueless",
"lazy"
]
}
}
},
{
"title":"Dog",
"type":"object",
"additionalProperties":false,
"properties":{
"animalType":{
"const":"Dog"
},
"breed":{
"title":"Dog Breed",
"type":"string",
"enum":[
"bulldog",
"bichons frise"
]
}
}
}
]
}