@@ -81,6 +81,37 @@ TEST(AlterSchema_lint_draft3, enum_with_type_4) {
8181 EXPECT_EQ (document, expected);
8282}
8383
84+ TEST (AlterSchema_lint_draft3, forbid_empty_enum_1) {
85+ sourcemeta::core::JSON document = sourcemeta::core::parse_json (R"JSON( {
86+ "$schema": "http://json-schema.org/draft-03/schema#",
87+ "title": "Example",
88+ "description": "Example schema",
89+ "properties": {
90+ "foo": {
91+ "enum": []
92+ }
93+ }
94+ })JSON" );
95+ const sourcemeta::core::JSON expected = sourcemeta::core::parse_json (R"JSON( {
96+ "$schema": "http://json-schema.org/draft-03/schema#",
97+ "title": "Example",
98+ "description": "Example schema",
99+ "properties": {
100+ "foo": false
101+ }
102+ })JSON" );
103+
104+ LINT_AND_FIX (document, result, traces);
105+
106+ EXPECT_TRUE (result.first );
107+ EXPECT_EQ (traces.size (), 1 );
108+ EXPECT_LINT_TRACE (traces, 0 , " /properties/foo" , " forbid_empty_enum" ,
109+ " An empty `enum` validates nothing and is equivalent to "
110+ " `false`" ,
111+ true );
112+ EXPECT_EQ (document, expected);
113+ }
114+
84115TEST (AlterSchema_lint_draft3, non_applicable_enum_validation_keywords_1) {
85116 sourcemeta::core::JSON document = sourcemeta::core::parse_json (R"JSON( {
86117 "$schema": "http://json-schema.org/draft-03/schema#",
0 commit comments