func Extract(data cue.InstanceOrValue, cfg *Config) (f *ast.File, err error)
Extract converts JSON Schema data into an equivalent CUE representation.
The generated CUE schema is guaranteed to deem valid any value that is a valid instance of the source JSON schema.
A Config configures a JSON Schema encoding or decoding.
type Config struct { PkgName string // ID sets the URL of the original source, corresponding to the $id field. ID string // JSON reference of location containing schema. The empty string indicates // that there is a single schema at the root. // // Examples: // "#/" top-level fields are schemas. // "#/components/schemas" the canonical OpenAPI location. Root string // Map maps the locations of schemas and definitions to a new location. // References are updated accordingly. A returned label must be // an identifier or string literal. // // The default mapping is // {} {} // {"definitions", foo} {#foo} or {#, foo} // {"$defs", foo} {#foo} or {#, foo} Map func(pos token.Pos, path []string) ([]ast.Label, error) // Strict reports an error for unsupported features, rather than ignoring // them. Strict bool // contains filtered or unexported fields }