Skip to content

Commit

Permalink
jsonschema: ignore extension fields
Browse files Browse the repository at this point in the history
`x-` fields are documented as fields we ignore, so make it so jsonschema
validations ignore it as well.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
  • Loading branch information
cpuguy83 committed Oct 30, 2024
1 parent a5b8c35 commit 03a2c75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/gen-jsonschema/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ func main() {
}

schema := r.Reflect(&dalec.Spec{})
if schema.PatternProperties == nil {
schema.PatternProperties = make(map[string]*jsonschema.Schema)
}
schema.PatternProperties["^x-"] = &jsonschema.Schema{}

dt, err := json.MarshalIndent(schema, "", "\t")
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions docs/spec.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1250,5 +1250,8 @@
],
"description": "TestStep is a wrapper for [BuildStep] to include checks on stdio streams"
}
},
"patternProperties": {
"^x-": true
}
}

0 comments on commit 03a2c75

Please sign in to comment.