Repository navigation
fix(schema): declare the dialect in $schema and the version in $id - #5011
Merged
Merged
Conversation
print-schema wrote the document's own address into $schema: "$schema": "https://kairos.io/v4.3.0/cloud-config.json" $schema declares which JSON Schema dialect a document is written in, not where the document lives. A validator that honours it fetches that value as a meta-schema, and nothing has been published under https://kairos.io/ since v2.0.1, so the address 404s for every supported release. The document also carried no $id, and used draft-07's "definitions" without saying so, leaving a consumer nothing to read the references against. GenerateSchema now writes its second argument to $id, which names the document, and sets $schema to the draft-07 meta-schema the reflector actually emits. Both keys stay absent when the argument is empty, which is the form KConfig.validate compiles, so in-process validation keeps its current dialect. Signed-off-by: Ettore Di Giacinto <mudler@kairos.io>
ci-robbot
had a problem deploying
to
fork-pr-builds
September 27, 2026 06:10 — with
GitHub Actions
Failure
This branch had an error being deployed
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.
Fixes #5010
Summary
kairos-agent print-schemawrote the document's own address into$schema:$schemadeclares which JSON Schema dialect a document is written in, not wherethe document lives. That is what
$idis for. So a validator or an editor thathonours
$schemafetches that value as a meta-schema, and nothing has beenpublished under
https://kairos.io/since v2.0.1 (onlyv1.6.xandv2.0.xarechecked into
kairos-docs/static/), so the address 404s for every supportedrelease. The document also had no
$idat all, and used draft-07'sdefinitionsrather than
$defswithout declaring draft-07, so nothing in the output told aconsumer which dialect to read it as.
GenerateSchemanow writes its second argument to$id, which names thedocument, and sets
$schemato the draft-07 meta-schema the reflector actuallyemits. Both keys stay absent when that argument is empty, which is the form
KConfig.validatecompiles, sokairos validatekeeps the dialect it has today.The
versionargument toJSONSchemakeeps its meaning and its only caller,print-schema, is unchanged.Before and after, from the built binary:
This is the code half of the same defect as #4987, which fixed the docs half.
How it was tested
CGO_ENABLED=0 go test ./sdk/schema/ ./agent/pkg/cmd/ ./agent/pkg/config/...,67 specs in
sdk/schemagreen.jqconfirms$idand$schemaare set as intended and that the document still carriesdefinitionsand no$defs.santhosh-tekuri/jsonschemaandvalidates config through it, so the declared dialect is checked to resolve the
$reftargets the reflector emits rather than just asserted on a string. Itaccepts
users[0].name: kairosand rejectsusers[0].name: 7with"expected string, but got number".
WithSchema(id)line turns exactly the fivenew specs red and leaves the other 62 green.
CGO_ENABLED=0 go build ./...clean over the whole tree,go vetclean,gofmtclean on the changed files. The one unrelated failure insdk/sysextis this box having no docker daemon, not this change.
AI disclosure
Written by an automated agent (
ci-robbot, operated by @mudler). No human hasread the code before this pull request was opened.