Skip to content

feat: JSON schemas + editor modelines for module YAML - #33

Merged
ValgulNecron merged 1 commit into
mainfrom
feat/module-yaml-schema
Jul 17, 2026
Merged

ValgulNecron merged 1 commit into
mainfrom
feat/module-yaml-schema

Conversation

@ValgulNecron

Copy link
Copy Markdown
Collaborator

Problem

VS Code's YAML extension (redhat.vscode-yaml) auto-guesses a schema from its store and mis-matches template.yaml against the AWS CloudFormation SAM schema, flagging valid fields:

Property apiVersion is not allowed. yaml-schema: AWS CloudFormation Serverless Application Model (SAM)(513)

Fix

Give both module YAML files an explicit $schema so the extension stops guessing — and gets real validation + autocomplete.

  • .schema/gametemplate.schema.json — generated from the GameTemplate CRD's openAPIV3Schema (a module template.yaml is a GameTemplate custom resource). Regenerated from the Gameplane repo via make module-schema.
  • .schema/module.schema.json — hand-maintained, mirrors docs/module-authoring.md.
  • A first-line modeline in every template.yaml/module.yaml:
    # yaml-language-server: $schema=../.schema/gametemplate.schema.json
    The relative ../.schema path resolves whether this repo is opened standalone or as the Gameplane repo's modules/ submodule.

Verification

  • Both schemas accept all 16 modules' files (validated locally: every module.yaml key is in the schema, all required present; every template.yaml matches the const apiVersion/kind).
  • The modeline is a leading comment, so build.sh's ymv parser still extracts name/version, and validate.py's YAML load is unaffected — .schema/ has no template.yaml, so discover_modules skips it.

Companion

The generator + make module-schema target land in the Gameplane repo; the submodule pointer bump follows once this merges.

Note: curseforgeGameID (added in Gameplane #156) isn't in the generated schema yet — it's regenerated once that CRD change hits main. The schema sets no additionalProperties: false, so it does not flag the field in the meantime.

🤖 Generated with Claude Code

VS Code's YAML extension guessed a schema from its store and mis-matched
template.yaml against the AWS CloudFormation SAM schema, flagging valid
fields ("Property apiVersion is not allowed"). Give both module YAML
files an explicit schema instead.

- .schema/gametemplate.schema.json — generated from the GameTemplate CRD's
  openAPIV3Schema (template.yaml IS a GameTemplate CR). Regenerated from the
  Gameplane repo via `make module-schema`.
- .schema/module.schema.json — hand-maintained, mirrors module-authoring.md.
- Every template.yaml/module.yaml gets a first-line
  `# yaml-language-server: $schema=…` modeline. The relative ../.schema path
  resolves whether this repo is opened standalone or as the modules/
  submodule.

Validated: both schemas accept all 16 modules' files; the modeline is a
leading comment so build.sh's parser and validate.py's YAML load are
unaffected (.schema/ has no template.yaml, so discover_modules skips it).

Signed-off-by: valgulnecron <39313199+ValgulNecron@users.noreply.github.com>
@ValgulNecron
ValgulNecron merged commit c093ea2 into main Jul 17, 2026
1 check passed
@ValgulNecron
ValgulNecron deleted the feat/module-yaml-schema branch July 17, 2026 20:15
ValgulNecron added a commit that referenced this pull request Jul 19, 2026
The 'fix version' commits (1adc510, 7b4e7c0) were branched from PR #31
(1d153c2) and force-pushed over main, silently dropping the already-merged
PR #32 (per-game CurseForge/Steam ids: ARK curseforgeGameID 83374, CS2
Workshop browse) and PR #33 (module YAML .schema/ + editor modelines).
The published registry still served ark:1.0.8 / cs2:1.1.0 from that lost
state, but with the pre-bump gameplaneMinVersion: 0.2.0, so a v0.2.0-beta.7
operator rejected them (0.2.0-beta.7 < 0.2.0 by semver).

Merge c093ea2 (the PR #33 tip) back in to restore that work. The 3-way
merge keeps main's 0.2.0 -> 0.2.0-beta.7 gameplaneMinVersion bump (incl.
the minecraft-java correction) on the min-version lines and takes c093ea2's
content everywhere else: ark 1.0.8 + CurseForge id, cs2 1.1.0 + Workshop,
.schema/ + modelines. Republishing from here overwrites the orphan
ark:1.0.8 / cs2:1.1.0 tags with the correct min-version.

Signed-off-by: valgulnecron <39313199+ValgulNecron@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant