F1 (Java) Story 9: Implement ProjectSchemaValidator
Description
As a developer, I need to implement the ProjectSchemaValidator
class that validates
the provided collaboration project record JSON object against the "master-data--CollaborationProject" schema.
The source of the jsonschema definition for this validation is out of the scope of the current task and can be provided as a result of an API call to the OSDU Schema service or packed as a file in the Java application resources.
Acceptance Criteria
- Successful implementation of
ProjectSchemaValidator
which retrieves the applicable OSDU schema and validates the provided JSON payload against this. - If validation fails, a flag should be set or an exception should be thrown.
Technical Notes
For schema validation, Java has several well-known libraries. The developer could choose the most appropriate from the following list, or investigate if the existing OSDU Java services or common libraries have the necessary capabilities:
- json-schema-validator: A powerful tool that covers draft-04, draft-06, and draft-07 of JSON Schema specifications.
- Everit - Org.JSON Schema: A simple, lightweight library that fully validates JSON against draft-07, and also supports older drafts.
- NetworkNT JSON Schema: A fast JSON Schema validator that aligns with draft-04, draft-06, and draft-07.
Edited by Rostislav Dublin (EPAM)