-
Notifications
You must be signed in to change notification settings - Fork 2
PAE-769: New organisation schema overrides #601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…organisation-schema-overrides
…organisation-schema-overrides
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request introduces new Joi schema overrides for organisation, registration, and accreditation schemas to improve JSON Schema compatibility. The overrides handle issues with ID fields, date fields, nullable values, and conditional logic that don't translate well during conversion to JSON Schema.
Key changes:
- Added new schema override file that forks existing schemas with JSON Schema-friendly modifications
- Updated the schema generation script to use the new overrides instead of the original schema
- Added comprehensive test coverage for the new override schemas
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/repositories/organisations/schema/organisation-json-schema-overrides.js | New file implementing schema overrides with helper functions to handle ID fields, nullable values, date fields, and conditional logic for registrations and accreditations |
| src/repositories/organisations/schema/validation.test.js | Added new test suite for organisationJSONSchemaOverrides with tests covering ID fields, registration conditions, and accreditation conditions |
| scripts/generate-json-schemas/organisation.update.js | Updated to import and use organisationJSONSchemaOverrides instead of organisationReplaceSchema |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/repositories/organisations/schema/organisation-json-schema-overrides.js
Outdated
Show resolved
Hide resolved
src/repositories/organisations/schema/organisation-json-schema-overrides.js
Show resolved
Hide resolved
…-overrides.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
src/repositories/organisations/schema/organisation-json-schema-overrides.js
Outdated
Show resolved
Hide resolved
src/repositories/organisations/schema/organisation-json-schema-overrides.js
Outdated
Show resolved
Hide resolved
src/repositories/organisations/schema/organisation-json-schema-overrides.js
Outdated
Show resolved
Hide resolved
src/repositories/organisations/schema/organisation-json-schema-overrides.js
Outdated
Show resolved
Hide resolved
src/repositories/organisations/schema/organisation-json-schema-overrides.js
Show resolved
Hide resolved
…organisation-schema-overrides
…m:DEFRA/epr-backend into PAE-769-new-organisation-schema-overrides
|



Ticket: PAE-769
This pull request introduces a new Joi schema,
organisationJSONSchemaOverrides, to improve compatibility when converting organisation-related schemas to JSON Schema. It addresses issues with incompatible types and conditional logic, and includes comprehensive tests to ensure the new schema correctly validates various organisation data structures.Schema compatibility improvements:
organisationJSONSchemaOverridesinorganisation-json-schema-overrides.js, providing custom forks and conditional logic to handle fields (like IDs, dates, and nested objects) for JSON Schema compatibility, and applied these overrides to registrations and accreditations.generate-json-schemas/organisation.update.jsto useorganisationJSONSchemaOverridesinstead of the original schema, ensuring the generated JSON Schema reflects the new compatibility fixes.Testing enhancements:
validation.test.jsfororganisationJSONSchemaOverrides, verifying correct validation of required/optional fields, conditional requirements, and nullability for registrations and accreditations.validation.test.jsto include the new schema and relevant constants/builders.