cmd/cue/cmd: allow lossy conversion by default and add --strict option
Applies to JSON Schema now, but generallly applicable for
other conversions.
Change-Id: Ie6abe0ea0daf2d2ede1850a16cd2c1d831fb7f13
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/5649
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/jsonschema/jsonschema.go b/encoding/jsonschema/jsonschema.go
index 09e4173..5f5791b 100644
--- a/encoding/jsonschema/jsonschema.go
+++ b/encoding/jsonschema/jsonschema.go
@@ -57,7 +57,8 @@
type Config struct {
PkgName string
- ID string // URL of the original source, corresponding to the $id field.
+ // 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.
@@ -81,5 +82,9 @@
// - selection and definition of formats
// - documentation hooks.
+ // Strict reports an error for unsupported features, rather than ignoring
+ // them.
+ Strict bool
+
_ struct{} // prohibit casting from different type.
}