Skip to content

[Typescript] fix(schemaregistry): add support for format to validation#443

Open
Jonathan Arnold (mixnblend) wants to merge 2 commits intoconfluentinc:masterfrom
mixnblend:schema_registry_validation_fixes
Open

[Typescript] fix(schemaregistry): add support for format to validation#443
Jonathan Arnold (mixnblend) wants to merge 2 commits intoconfluentinc:masterfrom
mixnblend:schema_registry_validation_fixes

Conversation

@mixnblend

Please prefix all TypeScript pull-requests with [Typescript]

What

Add support for format validation to json schema registry serde. without this, any schema containing format annotations seems to error.

Checklist

  • Contains customer facing changes? Including API/behavior changes
  • Did you add sufficient unit test and/or integration test coverage for this PR?
    • If not, please explain why it is not required

References

JIRA: No JIRA Ticket

Test & Review

Has been tested by adding unit tests with format annotations defined. Also have a patched version of this package in use in a local utility package in use at my company.

Open questions / Follow-ups

@mixnblend Jonathan Arnold (mixnblend) requested a review from a team as a code owner February 13, 2026 13:35
Copilot AI review requested due to automatic review settings February 13, 2026 13:35
@mixnblend Jonathan Arnold (mixnblend) requested a review from a team as a code owner February 13, 2026 13:35
Copy link

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

Adds JSON Schema format validation support in the Schema Registry JSON serde so schemas with format annotations can be compiled/validated successfully.

Changes:

  • Add ajv-formats dependency to the schemaregistry workspace.
  • Register standard format validators on both Ajv2019 and Ajv2020 instances used for message validation.
  • Add Jest coverage for validating common formats (email, uri, date-time, ipv4, uuid).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
schemaregistry/serde/json.ts Hooks ajv-formats into the Ajv validators created for JSON schema validation.
schemaregistry/test/serde/json.spec.ts Adds a new test that validates serialization behavior for schemas using format.
schemaregistry/package.json Declares ajv-formats runtime dependency.
package-lock.json Updates lockfile to include ajv-formats (and additional lockfile metadata changes).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +278 to +284
const schemaWithFormats = `
{
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email"
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

schemaWithFormats does not include a $schema declaration, so this test only exercises the non-2020-12 validation path in toValidateFunction. Since this PR adds addFormats in both Ajv2019 and Ajv2020 branches, add an additional test case (or extend this schema) that sets $schema to the 2020-12 URI to cover the Ajv2020 path as well.

Copilot uses AI. Check for mistakes.
@mixnblend Jonathan Arnold (mixnblend) force-pushed the schema_registry_validation_fixes branch from 74107ca to cc62e3a Compare February 13, 2026 14:41
@rayokota
Copy link
Member

/sem-approve

2 similar comments
@rayokota
Copy link
Member

/sem-approve

@rayokota
Copy link
Member

/sem-approve

@rayokota
Copy link
Member

/sem-approve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants