kurtosys
6 years agoNew Contributor
OpenAPI spec - unique keys, how to model a star schema
I'm trying to spec a requestBody which conforms this:
{
"caseT": {... spec T...} "exts": {"caseU": {... spec U...}, "caseX": {... spec X...} } }
There are a number of known cases, the names are known - this means, all possible keys are known (case T, case U, case X, case ..., this is limited). For each case, the spec is known as well (there's no problem with modelling the specs).
Where I'm struggling a bit with is: how can I make sure that
- there is exactly 1 of the cases in the 'root' of the request (in this example, this is case T),
- in 'exts', there are any number of other specs, but max 1 of each and if possible at all any case except the one that's in the root (which I don't think is possible).
Is this possible, of how can this be modelled as closely as possible in openapi 3.0?