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/internal/encoding/encoding.go b/internal/encoding/encoding.go
index 5b4a733..e720284 100644
--- a/internal/encoding/encoding.go
+++ b/internal/encoding/encoding.go
@@ -132,6 +132,7 @@
PkgName string // package name for files to generate
Force bool // overwrite existing files.
+ Strict bool
Stream bool // will potentially write more than one document per file
AllErrors bool
@@ -246,6 +247,8 @@
cfg := &jsonschema.Config{
ID: id,
PkgName: cfg.PkgName,
+
+ Strict: cfg.Strict,
}
file, err = simplify(jsonschema.Extract(i, cfg))
return file, id, err