Add JSON Schemas to tsconfig.json and package.json#2330
Add JSON Schemas to tsconfig.json and package.json#2330westonruter merged 9 commits intoWordPress:trunkfrom
tsconfig.json and package.json#2330Conversation
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #2330 +/- ##
=======================================
Coverage 69.17% 69.17%
=======================================
Files 90 90
Lines 7696 7696
=======================================
Hits 5324 5324
Misses 2372 2372
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds JSON Schema references to tsconfig.json and package.json files to enable validation via the existing validate-json-schema.js script. It enhances the validator to support multiple JSON Schema draft versions by introducing separate AJV instances for draft-04 and draft-07, along with schema caching to optimize network requests.
- Added
$schemareferences totsconfig.jsonandpackage.json - Introduced
ajv-draft-04dependency to support draft-04 schema validation - Refactored the validator to detect schema drafts and route to appropriate AJV instances
Reviewed changes
Copilot reviewed 1 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tsconfig.json | Added $schema reference for validation support |
| package.json | Added $schema reference and ajv-draft-04 dependency |
| package-lock.json | Installed ajv-draft-04 package |
| bin/validate-json-schema.js | Refactored to support multiple schema drafts with caching and draft detection |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
@ShyamGadde This is great! Any reason why this is still a draft? |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@westonruter I left it as a draft initially to get feedback on the AJV draft-handling approach. It should be ready now. |
Summary
Fixes #2329
This PR adds JSON Schema references to
tsconfig.jsonandpackage.jsonso that these files can be validated by the existingvalidate-json-schema.jsscript.It also updates the validator to correctly handle schemas defined using different JSON Schema drafts. In particular, the
tsconfig.jsonschema is defined using draft-04, whereas AJV defaults to draft-07.Relevant technical choices
ajv-draft-04as a dependency to support validation of schemas defined using JSON Schema draft-04 (e.g., thetsconfig.jsonschema).$schemavalue and route validation to the appropriate AJV instance.