Documentation
¶
Overview ¶
Package schema models the slice of JSON Schema 2020-12 that the compat-shim emitter cares about. Most of JSON Schema is irrelevant for shim emission — we only need the type, properties, required list, and $defs of every object. Anything else (numeric ranges, format, patternProperties, …) is left to go-jsonschema.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Schema ¶
type Schema struct {
// ID corresponds to the JSON Schema `$id` keyword. Used as the match
// key for cross-tree package mappings (plan §6 schema-packages): when
// a schema's $id matches an entry in Configuration.SchemaPackages,
// its types live in another Go package and the compat-shim emitter
// must skip them (Go forbids methods on imported types).
ID string `json:"$id"`
Title string `json:"title"`
Type string `json:"type"`
Required []string `json:"required"`
Properties map[string]any `json:"properties"`
Defs map[string]*Schema `json:"$defs"`
// Ref is the schema's own `$ref`. go-jsonschema generates the type of
// the schema it points at, not one named after Title.
Ref string `json:"$ref"`
// SourcePath is the absolute path the schema was loaded from. Used
// only for error messages.
SourcePath string `json:"-"`
}
Schema is the typed representation of a JSON Schema file. Fields not needed for shim emission are intentionally omitted; unknown properties in the input are dropped during decoding.