Schema ref validation changes
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
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:
- https://community.opengroup.org/osdu/platform/system/schema-service/-/tree/schema-ref-validation/schema-core/src/test/resources/schema_compare [61 files]
- https://community.opengroup.org/osdu/platform/system/schema-service/-/tree/master/testing/schema-test-core/src/test/resources/input_payloads [88 Files]