Several API description formats like Swagger, RAML, WSDL, WADL, etc. support various kinds of validation keywords to restrict and validate instance values based on their type. Support for these validation keywords has now been added to Transformer. You can now convert between any of these formats without losing information for these keywords.
Details
JSON Schema specifies several validation keywords that helps in structural validation of JSON. Similarly, XML Schema (XSD) also offers restriction/data type facets to validate XML data. In general, these keywords helps restrict instance data based on their types e.g. you can restrict a string
type parameter to have a value with minimum length of 10.
Several of the API description formats like Swagger/Open API (v1.2, v2.0, v3.0), RAML (0.8, 1.0), WSDL, WADL, etc. have been supporting these keywords for a long time. We have added support for these in our parsers now and any conversions made using Transformer should contain all this information without any loss.
Supported Keywords
Support for the following keywords has been added:
String Validation Keywords
- maxLength
- minLength
- pattern
Arrays Validation Keywords
- maxItems
- minItems
- uniqueItems
Objects Validation Keywords
- maxProperties
- minProperties
Number Validation Keywords
- multipleOf
- maximum
- exclusiveMaximum
- minimum
- exclusiveMinimum
- totalDigits
- fractionDigits
- pattern