Skip to main content

Support for Validation Keywords Added In Transformer

· 2 min read

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

  1. maxLength
  2. minLength
  3. pattern

Arrays Validation Keywords

  1. maxItems
  2. minItems
  3. uniqueItems

Objects Validation Keywords

  1. maxProperties
  2. minProperties

Number Validation Keywords

  1. multipleOf
  2. maximum
  3. exclusiveMaximum
  4. minimum
  5. exclusiveMinimum
  6. totalDigits
  7. fractionDigits
  8. pattern