JSON schema validation functionality has been added to CORE to support USDM schema-based rules. The CORE functionality relies version-specific schemas that are derived from the v3 and v4 API specifications.
The following additional constraints have been added to the schemas used for CORE validation, and it would probably make sense to add these into the API specification itself:
additionalProperties = false for all model classes. As we now have the extension mechanism, there should be no need to add extra properties into classes. Adding this constraint also has the benefit that unintentional misspellings of attribute names are reported during schema validation.
minItems = 1 for required list/array properties. From a JSON Schema perspective, required simply means that the attribute must be present - there's no requirement for the attribute to have a value. In the same way that we use minLength = 1 for required string values (so that empty strings are reported as errors), specifying minItems = 1 for list/arrary properties ensures that the model-based cardinalities are enforced during schema validataion.
JSON schema validation functionality has been added to CORE to support USDM schema-based rules. The CORE functionality relies version-specific schemas that are derived from the v3 and v4 API specifications.
The following additional constraints have been added to the schemas used for CORE validation, and it would probably make sense to add these into the API specification itself:
additionalProperties = falsefor all model classes. As we now have the extension mechanism, there should be no need to add extra properties into classes. Adding this constraint also has the benefit that unintentional misspellings of attribute names are reported during schema validation.minItems = 1for required list/array properties. From a JSON Schema perspective,requiredsimply means that the attribute must be present - there's no requirement for the attribute to have a value. In the same way that we useminLength = 1for required string values (so that empty strings are reported as errors), specifyingminItems = 1for list/arrary properties ensures that the model-based cardinalities are enforced during schema validataion.