Validating Swagger schemas
- Schema A must not change the type of a parameter defined in schema B.
- Schema A must not introduce new, required parameters to operations defined in schema B.
- Schema A can remove or loosen validation constraints on input parameters defined in schema B, but schema A must not add or tighten validation constraints
However, even with these restrictions on changes to schema A, it is possible that custom code written against schema B does not work against schema A. The reason is that requests that are valid with respect to B are not necessarily valid against A. However, in general, most validation errors that occur during schema combination are warnings rather than hard errors, as there may be no way to avoid the error.
Schema verification errors
- Which fields are required
- Which fields can or cannot be used in combination
- Which parameter, response, or schema references are valid
As schema validation takes place after schema combination, it can sometimes make tracking
down the root source of a problem more complicated. For example, if a parameter specifies an
invalid combination of type, format, and
x-gw-type properties, the error can be the result of the combination of
schema A with schema B. In this case, the validation error messages report the line numbers
of the parameter from all files that contained that parameter object.
