Skip to content

Conversation

@tomhalley
Copy link
Contributor

@tomhalley tomhalley commented Jan 7, 2026

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:

  • Added organisationJSONSchemaOverrides in organisation-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.
  • Updated generate-json-schemas/organisation.update.js to use organisationJSONSchemaOverrides instead of the original schema, ensuring the generated JSON Schema reflects the new compatibility fixes.

Testing enhancements:

  • Added comprehensive tests in validation.test.js for organisationJSONSchemaOverrides, verifying correct validation of required/optional fields, conditional requirements, and nullability for registrations and accreditations.
  • Updated imports in validation.test.js to include the new schema and relevant constants/builders.

Copy link
Contributor

Copilot AI left a 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.

…-overrides.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@tomhalley tomhalley marked this pull request as ready for review January 8, 2026 14:36
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 9, 2026

@tomhalley tomhalley merged commit a71cb8a into main Jan 9, 2026
6 checks passed
@tomhalley tomhalley deleted the PAE-769-new-organisation-schema-overrides branch January 9, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants