feat: add schema for feature manifest files - #2347
Conversation
|
Possible point of contention: should the ...I think I'm leaning towards the latter, now that I spell it out like that. |
- preferences object must have at least one property - colorPreference.default must be an empty string or a colour hex code - componentPreference.src must match the pattern /^\/features\/.+\/.+\.js$/ - selectPreference.options must not be empty
Hm, I think either works well. Agreed with your lean, I think. |
|
In implementing the If folks want to use other editors to contribute, and stick around long enough to crave dev QoL things like schema validation (which is already an unrealistic circumstance, if the project's history is anything to go on), then we can revisit this decision or commit another editor config file. Attachments: diff.patch |
|
Hm, I guess I'm just used to |
|
Aside: I do find the true-json-schema approach interesting to compare to authoring types in typescript (and validating with e.g. typia, which was what I chose for https://github.com/discretize/discretize-gear-optimizer) or authoring in zod. Both seem quite a bit more succinct to author in and read. Things like To my knowledge, you can't get intellisense in a json file using either directly without a hacky VS Code plugin; using either without that would presumably either requiring running a script to convert the source of truth into a schema file wheneve it's changed (meh) or changing the metadata files to be js/ts default exports (also meh, besides that you get jsonc features for free; no-trailing-commas requirements should be banned by some kind of international treaty). So, not practical, really, but interesting. |
Description
I keep getting annoyed at how juvenile docs/Chapter 4.1 - Feature metadata.md seems. Better documentation would look more like the pages on Google's Chrome extension developer docs, with its own type definitions and better clarity about what can and cannot overlap.
Well, that sounds awfully like a schema to me. I think that maybe creating a schema could be a great starting point for writing better documentation, since it forces accurate recording of definitions without the additional effort of explaining too much of anything in English.
As a bonus, we get basic IntelliSense descriptions for properties in
feature.jsonfiles.I have to admit鈥擨 had fun doing this.
Screenshots
N/A, dev changes only
Testing steps
feature.jsonfiles against the new schema: