Skip to content

Add configuration schema validator and CI checks#1667

Merged
josephjclark merged 1 commit into
OpenFn:schema-validationfrom
aloundoye:1661
May 20, 2026
Merged

Add configuration schema validator and CI checks#1667
josephjclark merged 1 commit into
OpenFn:schema-validationfrom
aloundoye:1661

Conversation

@aloundoye
Copy link
Copy Markdown
Contributor

Summary

Add a new schema validation script (scripts/validate-configuration-schemas.mjs) that finds packages/*/*configuration-schema.json and validates them against JSON Schema draft-07 using Ajv. The script prints human-friendly errors (or a markdown table with --markdown) and exits non-zero on failures. Wire this check into CI: run pnpm validate:schemas in .github workflows (ci, docs, publish). Update package.json to add the validate:schemas script and Ajv dependency, and update README, templates, and the wiki to document JSON Schema draft-07 and instruct maintainers to run pnpm validate:schemas after editing configuration-schema.json.

Fixes #1661

Details

Added a repo-level validate:schemas command that validates every packages/*/*configuration-schema.json file against the JSON Schema draft-07 meta-schema using Ajv. This includes standard adaptor configuration-schema.json files and Salesforce’s oauth-configuration-schema.json.

The validator prints CI-friendly failures with adaptor name, file path, JSON pointer, and reason, and supports --markdown for the one-shot audit table requested in issue #1661. It runs with strict: false so existing UI annotation keywords are allowed while still enforcing the JSON Schema spec.

Wired pnpm validate:schemas into PR CI, publish, and docs workflows so malformed configuration schemas are caught before release. Also updated contributor docs and generator README templates to tell adaptor authors to validate schema changes and reference JSON Schema draft-07.

This prevents invalid credential/configuration schemas from shipping and surfacing later as Lightning credential form runtime issues.

AI Usage

Please disclose how you've used AI in this work (it's cool, we just want to
know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Review Checklist

Before merging, the reviewer should check the following items:

  • Does the PR do what it claims to do?
  • If this is a new adaptor, added the adaptor on marketing website ?
  • If this PR includes breaking changes, do we need to update any jobs in
    production? Is it safe to release?
  • Are there any unit tests?
  • Is there a changeset associated with this PR? Should there be? Note that
    dev only changes don't need a changeset.
  • Have you ticked a box under AI Usage?

Add a new schema validation script (scripts/validate-configuration-schemas.mjs) that finds packages/*/*configuration-schema.json and validates them against JSON Schema draft-07 using Ajv. The script prints human-friendly errors (or a markdown table with --markdown) and exits non-zero on failures. Wire this check into CI: run pnpm validate:schemas in .github workflows (ci, docs, publish). Update package.json to add the validate:schemas script and Ajv dependency, and update README, templates, and the wiki to document JSON Schema draft-07 and instruct maintainers to run pnpm validate:schemas after editing configuration-schema.json.
@aloundoye
Copy link
Copy Markdown
Contributor Author

@elias-ba @josephjclark when you have a moment, could you review this PR?

@josephjclark
Copy link
Copy Markdown
Collaborator

Hi @aloundoye , thanks for raising this!

What's the goal of this? Just to ensure that schemas are structurally valid?

@aloundoye
Copy link
Copy Markdown
Contributor Author

aloundoye commented May 15, 2026

Hi @josephjclark. Yes, the immediate goal is to ensure the schemas are structurally valid JSON Schema before they ship.
It just catches malformed schema definitions, like invalid type values...

@hunterachieng
Copy link
Copy Markdown
Contributor

@aloundoye Thank you for taking the time to raise this PR. I tested it locally and its working great. Approving this cc @josephjclark

@josephjclark josephjclark changed the base branch from main to schema-validation May 20, 2026 10:48
@josephjclark
Copy link
Copy Markdown
Collaborator

Thank you @aloundoye!

@josephjclark josephjclark merged commit 613e917 into OpenFn:schema-validation May 20, 2026
3 of 4 checks passed
josephjclark added a commit that referenced this pull request May 20, 2026
* Add configuration schema validator and CI checks (#1667)

Add a new schema validation script (scripts/validate-configuration-schemas.mjs) that finds packages/*/*configuration-schema.json and validates them against JSON Schema draft-07 using Ajv. The script prints human-friendly errors (or a markdown table with --markdown) and exits non-zero on failures. Wire this check into CI: run pnpm validate:schemas in .github workflows (ci, docs, publish). Update package.json to add the validate:schemas script and Ajv dependency, and update README, templates, and the wiki to document JSON Schema draft-07 and instruct maintainers to run pnpm validate:schemas after editing configuration-schema.json.

* don't validate schemas while publishing docs

docs workflow depends on publish workflow, and publish has already validated

---------

Co-authored-by: Alassane Ndoye <aloutndoye.an@gmail.com>
@aloundoye aloundoye deleted the 1661 branch May 21, 2026 15:42
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.

Validate credential schemas against JSON Schema draft-07 in CI

3 participants