Skip to content

Schema ref validation changes

Abhishek Kumar (SLB) requested to merge schema-ref-validation into master

This MR introduces validation rule for $ref fragments. Basically, if there are minor level changes in the schema then all the $ref components of that schema are allowed to have incremental changes in their $ref versioning (incremental change in minor and patch level versioning). In other words, the schemas pointed by $ref can also have all permissible changes that are allowed at the Minor level (for more details please refer here [https://community.opengroup.org/osdu/platform/system/schema-service/-/blob/master/docs/SchemaService-OSDU.md#schema-validation].

Likewise, at the Patch level, $ref values are permitted to have incremented patch version. For more example, refere to the issue #61 (closed)

Code refactor

image

image

Along with the above state changes, there is code refactoring done to make components manageable and reusable. For example, earlier there were below classes:

  • schema-core/src/main/java/org/opengroup/osdu/schema/validation/SchemaMinorVersionValidator.java
  • schema-core/src/main/java/org/opengroup/osdu/schema/validation/SchemaPatchVersionValidator.java

which now, has evolved into different Handlers depending upon the kind of tags or operations they validate:

  • AdditionalPropertiesHandler
  • RemoveOperationHandler
  • RequiredAttributeHandler
  • TypeOperationHandler
  • CompositionPropertiesHandler
  • ReferenceAttributeHandler

Testing

There are comprehensive set of Unit and IT test cases added/updated. To have a good test coverage, we have included several JSON files at below locations:

Edited by Abhishek Kumar (SLB)

Merge request reports