Add anyOf
, allOf
and oneOf
handling to the OpenAPI code templates.
#129
Labels
enhancement
New feature or request
Description
At present the templates mostly ignore
anyOf
,allOf
andoneOf
data types. The only exception being where these have been used on a single sub-type to modify validation parameters for the type, e.g. adding a number range to a numeric type defined elsewhere and referenced with$ref
.Design
If the data type is an
anyOf
,allOf
oroneOf
that only has one data type defined then the type is just treated as through it was that simple type.If the data type has more than one sub-type contained in an
allOf
, then a structure is created to hold each sub-type under a name derived from the data type. It is a validation error if any of these sub-types fails to parse.If the data type has more than one sub-type contained in an
anyOf
, then a structures is created which has a boolean flag for each sub-type and a field for the sub-type with names derived from the sub-type data type. When parsing the boolean flag is set to true is the data type can be parsed as a particular sub-type and the sub-type value set. It is a validation error if none of the boolean flags were set to true.If the data type has more than one sub-type contained in an
oneOf
, then an enumeration type indicating the type of field parsed (with an "unparsed" option included) and a union of the sub-types is included. An attempt is made to parse and validate each sub-type:The text was updated successfully, but these errors were encountered: