-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Description
At present the templates mostly ignore anyOf, allOf and oneOf 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 or oneOf 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:
- if parsing or validation fails then the next sub-type is attempted
- if parsing and validation succeeds and the enumeration is "unparsed" then the enumeration is set to the representation for the sub-type and the sub-type value is set. Parsing and validation continues with the next sub-type.
- if parsing and validation succeeds and the enumeration is not "unparsed" then this is a validation error.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status