@@ -1132,36 +1132,6 @@ static void test_all(const std::string & lang, std::function<void(const TestCase
11321132 )"""
11331133 });
11341134
1135- test ({
1136- SUCCESS,
1137- " top-level $ref array item" ,
1138- R"""( {
1139- "$ref": "#/definitions/0",
1140- "definitions": [
1141- {
1142- "type": "object",
1143- "properties": {
1144- "a": {
1145- "type": "string"
1146- }
1147- },
1148- "required": [
1149- "a"
1150- ],
1151- "additionalProperties": false
1152- }
1153- ]
1154- })""" ,
1155- R"""(
1156- char ::= [^"\\\x7F\x00-\x1F] | [\\] (["\\bfnrt] | "u" [0-9a-fA-F]{4})
1157- ref-definitions-0 ::= "{" space ref-definitions-0-a-kv "}" space
1158- ref-definitions-0-a-kv ::= "\"a\"" space ":" space string
1159- root ::= ref-definitions-0
1160- space ::= | " " | "\n"{1,2} [ \t]{0,20}
1161- string ::= "\"" char* "\"" space
1162- )"""
1163- });
1164-
11651135 test ({
11661136 SUCCESS,
11671137 " anyOf" ,
@@ -1195,6 +1165,44 @@ static void test_all(const std::string & lang, std::function<void(const TestCase
11951165 )"""
11961166 });
11971167
1168+ test ({
1169+ SUCCESS,
1170+ " anyOf $ref" ,
1171+ R"""( {
1172+ "properties": {
1173+ "a": {
1174+ "anyOf": [
1175+ {"type": "string"},
1176+ {"type": "number"}
1177+ ]
1178+ },
1179+ "b": {
1180+ "anyOf": [
1181+ {"$ref": "#/properties/a/anyOf/0"},
1182+ {"type": "boolean"}
1183+ ]
1184+ }
1185+ },
1186+ "type": "object"
1187+ })""" ,
1188+ R"""(
1189+ a ::= string | number
1190+ a-kv ::= "\"a\"" space ":" space a
1191+ a-rest ::= ( "," space b-kv )?
1192+ b ::= b-0 | boolean
1193+ b-0 ::= string
1194+ b-kv ::= "\"b\"" space ":" space b
1195+ boolean ::= ("true" | "false") space
1196+ char ::= [^"\\\x7F\x00-\x1F] | [\\] (["\\bfnrt] | "u" [0-9a-fA-F]{4})
1197+ decimal-part ::= [0-9]{1,16}
1198+ integral-part ::= [0] | [1-9] [0-9]{0,15}
1199+ number ::= ("-"? integral-part) ("." decimal-part)? ([eE] [-+]? integral-part)? space
1200+ root ::= "{" space (a-kv a-rest | b-kv )? "}" space
1201+ space ::= | " " | "\n"{1,2} [ \t]{0,20}
1202+ string ::= "\"" char* "\"" space
1203+ )"""
1204+ });
1205+
11981206 test ({
11991207 SUCCESS,
12001208 " mix of allOf, anyOf and $ref (similar to https://json.schemastore.org/tsconfig.json)" ,
0 commit comments