-
Notifications
You must be signed in to change notification settings - Fork 270
Generate schema for v2 manifest #2997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I like adding them to templates, can we add multiple directives and do they need to be at the top? |
Given that schema is linked to Spin version I suggest adding it as a release artifact, with the latest then naturally available under the canary pre-release e.g. |
@karthik2804 I don't know about multiple directives - I'm not sure what it would mean to specify multiple schemas for a file - can you elaborate? (ETA: oh are you thinking about directives for non-Taplo based tools? Yeah that could get messy if we have to add more than one.) @lann agree, GH release asset seems easiest if we are comfortable with that |
I was wondering if we could have multiple schemes injected by each of the template for the trigger such that the entire thing can be validated. |
I don't believe so. I think you'd need something dynamic to inject a field and schema reference for each trigger in the manifest. Or you'd need to select out a range and apply a subschema to that. (You can't attempt to validate the whole document against the subschemata.) At that point, as far as I know, you're drifting beyond what JSON Schema can do and into a full-blown language server. |
Looking at their docs, there i no support for multiple definitions in the same doc https://taplo.tamasfe.dev/configuration/directives.html#the-schema-directive |
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
bf241d7
to
b1bbb50
Compare
Rebased and updated to be a subcommand of the |
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
Added release actions to include the schema JSON as part of GH releases. Tested by running in my fork (albeit a subset) - https://github.com/itowlson/spin/actions/runs/14369671054, https://github.com/itowlson/spin/releases/tag/canary) and that seemed okay. |
Attempts #930.
This is for discussion right now. Some questions:
#:schema https://gist.githubusercontent.com/itowlson/080922335ea080a185b77a17b9f1eb03/raw/3c24973fbeec3f3c78a1adc34284c235eba6df23/manifest.v2.triggy.json
at the top of a spin.toml file.spin schema
command but there's no reason anyone except people updating the manifest format should ever need to run it.#:schema
directive, which we could add to templates.If we decide to press ahead, the main remaining work is:
Docs are probably a few hours, and I can do them; distribution would depend on how we want to do it.