diff --git a/encoding/jsonschema/decode_test.go b/encoding/jsonschema/decode_test.go index 3c9f09bdc..16f2f9fd0 100644 --- a/encoding/jsonschema/decode_test.go +++ b/encoding/jsonschema/decode_test.go @@ -79,6 +79,7 @@ func TestDecode(t *testing.T) { // OpenAPI doesn't have a JSON Schema URI so it gets a special case. cfg.DefaultVersion = jsonschema.VersionOpenAPI cfg.Root = "#/components/schemas/" + cfg.StrictKeywords = true // OpenAPI always uses strict keywords cfg.Map = func(p token.Pos, a []string) ([]ast.Label, error) { // Just for testing: does not validate the path. return []ast.Label{ast.NewIdent("#" + a[len(a)-1])}, nil @@ -90,7 +91,7 @@ func TestDecode(t *testing.T) { } } cfg.Strict = t.HasTag("strict") - cfg.StrictKeywords = t.HasTag("strictKeywords") + cfg.StrictKeywords = cfg.StrictKeywords || t.HasTag("strictKeywords") cfg.StrictFeatures = t.HasTag("strictFeatures") ctx := t.CueContext() diff --git a/encoding/jsonschema/testdata/txtar/openapi_date-time.txtar b/encoding/jsonschema/testdata/txtar/openapi_date-time.txtar new file mode 100644 index 000000000..b60f017f0 --- /dev/null +++ b/encoding/jsonschema/testdata/txtar/openapi_date-time.txtar @@ -0,0 +1,13 @@ +#version: openapi + +-- schema.yaml -- +components: + schemas: + DateTime: + type: string + format: date-time + +-- out/decode/extract -- +ERROR: +unknown format "date-time": + schema.yaml:5:9