feat: add hand-authored manifest JSON schema for editor validation#168
Merged
Conversation
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Authoring
.github/manifest.yamlhas no editor support: no autocomplete, no type checking, no enum hints, no hover docs. Typos and wrong-typed fields are only caught atparse-configtime.Approach
Add a hand-authored draft-07 JSON Schema for the manifest. It is hand-authored (not generated) so the union fields can be modeled precisely:
secrets:oneOfthe scalar"inherit",{inherit: bool}, or an explicit secret-name map (the map form disallows aninheritkey to keep the union unambiguous).runs_on:oneOfa single label, a list of labels, or a{group, labels}object requiring at least one of the two.concurrency: a closed{group, cancel_in_progress}object.The schema is embedded and printed by a new
cascade schemacommand (--outputto write a file). The JSON Schema validator used to test it is a test-only dependency and never enters the binary.A drift test is the lockstep guarantee against schema/type drift: it validates a corpus of real manifests (cascade's own manifest, every
e2e/scenarios/*.yamlconfig block, and the READMEci:examples) and asserts known-bad documents are rejected (unknown top-level key,environmentsas a string,secretsas an integer, a build missingname). A sibling test asserts the three on-disk copies of the schema stay byte-identical.The schema is published at
https://stablekernel.github.io/cascade/manifest.schema.json. Editors register it via the# yaml-language-server: $schema=...directive or ayaml.schemasmapping; both are documented under Configuration -> Editor support, with acascade schemaentry in the CLI reference and a pointer from the adoption guide.parse-configremains the authority for semantic and cross-field rules.Verification
go build ./... && go test ./... && golangci-lint run ./...all clean.go mod whyresolves only to the test package.cascade schemaandcascade schema -o <file>print/write the schema, matching the committed copy.