rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[node-core-library] Add support json-schema 'draft-07' validation in JsonFile / JsonSchema

Open bartvandenende-wm opened this issue 1 year ago • 2 comments

Summary

[node-core-library] Add support json-schema 'draft-07' validation in JsonFile / JsonSchema

Details

JsonFile and the related JsonSchema in the @rushstack/node-core-library library make use of z-schema which does not have proper support of newer json-schema standards. Json-schema draft-07 was published in 2018 and draft-04 is slowly being replaced with draft-07 in the community.

It would be great if the rushstack is able to support draft-07 json schema in addition to draft-04 to ensure backwards compatibility (specifically as most of rush its own definitions are using draft-04)

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
Package name: @rushstack/node-core-library
Package version? 4.3.0
Operating system? Mac
Would you consider contributing a PR? yes
Node.js version (node -v)? v18.16.1

bartvandenende-wm avatar May 15 '24 14:05 bartvandenende-wm

Would it make sense to also add support for the latest non-draft version (2020-12)?

We could consider making this a breaking change and publishing a new major version of @rushstack/node-core-library.

iclanton avatar May 15 '24 18:05 iclanton

I created a PR to support this ticket which migrates the underlying validator in JsonSchema from z-schema to avj which already supports the 2020 spec (opt-in).

Unfortunately vscode does not support it yet so it throws an ugly warning per https://github.com/microsoft/vscode/issues/165219. It should be pretty trivial though to add it if we wanted, but given the above I focussed in the linked PR only on draft-07 while keeping backwards compatibility with draft-04.

bartvandenende-wm avatar May 15 '24 19:05 bartvandenende-wm