rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
152 stars 47 forks source link

fix: conform bsconfig.schema.json to strict types #1205

Closed bartvandenende-wm closed 3 weeks ago

bartvandenende-wm commented 1 month ago

Summary

bsconfig.schema.json is not (strict) type valid against jsonschema draft-07 target

fixes https://github.com/rokucommunity/brighterscript/issues/1204

Details

Validation steps

  1. Install npm install -g ajv-cli
  2. compile schema with ajv compile -s bsconfig.schema.json --allow-union-types=true
    schema bsconfig.schema.json is valid
TwitchBronBron commented 1 month ago

This is great! Would you be willing to add a unit test that runs the validation steps? That way we can ensure it remains in compliance with the json schema in the future.

bartvandenende-wm commented 1 month ago

This is great! Would you be willing to add a unit test that runs the validation steps? That way we can ensure it remains in compliance with the json schema in the future.

I could, but that likely would require us to move the bsconfig.schema.json into the TS src folder for the json to be importable for the unit test, which would be a breaking change.

TwitchBronBron commented 1 month ago

So vscode supports the "deprecationMessage" option, and it even shows up as deprecated in the edtior. I'm not sure we should remove that property as it provides useful error messaging in the editor. I'm sure JSON schema allows for having other properties? Or perhaps ajv-cli would have an option for ignoring that error?

image

TwitchBronBron commented 1 month ago

I added a unit test that validates the schema using ajv. The test also registers deprecationMessage as a keyword so ajv won't fail validation.

Thoughts?