diff --git a/cmd/cue/cmd/testdata/script/def_jsonschema.txtar b/cmd/cue/cmd/testdata/script/def_jsonschema.txtar index 474f09973..f68cc3b97 100644 --- a/cmd/cue/cmd/testdata/script/def_jsonschema.txtar +++ b/cmd/cue/cmd/testdata/script/def_jsonschema.txtar @@ -5,7 +5,10 @@ cmp stdout expect-stdout exec cue def schema.json -p schema -l '#Person:' cmp stdout expect-stdout -exec cue def jsonschema: bad.json +! exec cue def jsonschema: bad.json +cmp stderr expect-stderr-strict-features + +exec cue def jsonschema+strictFeatures=0: bad.json ! exec cue def jsonschema: bad.json --strict cmp stderr expect-stderr diff --git a/internal/filetypes/filetypes_test.go b/internal/filetypes/filetypes_test.go index c069bffa5..c929097ae 100644 --- a/internal/filetypes/filetypes_test.go +++ b/internal/filetypes/filetypes_test.go @@ -180,7 +180,7 @@ func TestFromFile(t *testing.T) { Form: build.Schema, BoolTags: map[string]bool{ "strict": false, - "strictFeatures": false, + "strictFeatures": true, "strictKeywords": false, }, }, @@ -418,7 +418,7 @@ func TestParseArgs(t *testing.T) { Interpretation: "jsonschema", BoolTags: map[string]bool{ "strict": false, - "strictFeatures": false, + "strictFeatures": true, "strictKeywords": false, }, }, @@ -438,6 +438,21 @@ func TestParseArgs(t *testing.T) { }, }, }, + }, { + in: "jsonschema+strictFeatures=0: bar.schema", + out: []*build.File{ + { + Filename: "bar.schema", + Encoding: "json", + Interpretation: "jsonschema", + Form: build.Schema, + BoolTags: map[string]bool{ + "strict": false, + "strictFeatures": false, + "strictKeywords": false, + }, + }, + }, }, { in: `json: c:\foo.json c:\path\to\file.dat`, out: []*build.File{ diff --git a/internal/filetypes/types.cue b/internal/filetypes/types.cue index 3ce0a11b4..c4762542b 100644 --- a/internal/filetypes/types.cue +++ b/internal/filetypes/types.cue @@ -267,7 +267,7 @@ interpretations: jsonschema: { boolTags: { strict: *false | bool strictKeywords: *strict | bool - strictFeatures: *strict | bool + strictFeatures: *true | bool } }