@@ -2932,6 +2932,76 @@ TEST(Frame_2020_12, ref_with_id) {
29322932 " https://www.sourcemeta.com/schema#/$defs/string" );
29332933}
29342934
2935+ TEST (Frame_2020_12, ref_with_percent_encoded_colon_in_fragment) {
2936+ const sourcemeta::core::JSON document = sourcemeta::core::parse_json (R"JSON( {
2937+ "$schema": "https://json-schema.org/draft/2020-12/schema",
2938+ "$ref": "#/$defs/https%3A~1~1example.com~1schema~1type",
2939+ "$defs": {
2940+ "https://example.com/schema/type": { "type": "string" }
2941+ }
2942+ })JSON" );
2943+
2944+ sourcemeta::blaze::SchemaFrame frame{
2945+ sourcemeta::blaze::SchemaFrame::Mode::References};
2946+ frame.analyse (document, sourcemeta::blaze::schema_walker,
2947+ sourcemeta::blaze::schema_resolver);
2948+
2949+ EXPECT_EQ (frame.locations ().size (), 6 );
2950+
2951+ // JSON Pointers
2952+
2953+ EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA (
2954+ frame, " " , " " , " https://json-schema.org/draft/2020-12/schema" ,
2955+ JSON_Schema_2020_12, std::nullopt , false , false );
2956+ EXPECT_ANONYMOUS_FRAME_STATIC_POINTER (
2957+ frame, " #/$schema" , " /$schema" ,
2958+ " https://json-schema.org/draft/2020-12/schema" , JSON_Schema_2020_12, " " ,
2959+ false , false );
2960+ EXPECT_ANONYMOUS_FRAME_STATIC_POINTER (
2961+ frame, " #/$ref" , " /$ref" , " https://json-schema.org/draft/2020-12/schema" ,
2962+ JSON_Schema_2020_12, " " , false , false );
2963+ EXPECT_ANONYMOUS_FRAME_STATIC_POINTER (
2964+ frame, " #/$defs" , " /$defs" ,
2965+ " https://json-schema.org/draft/2020-12/schema" , JSON_Schema_2020_12, " " ,
2966+ false , false );
2967+ EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA (
2968+ frame, " #/$defs/https:~1~1example.com~1schema~1type" ,
2969+ " /$defs/https:~1~1example.com~1schema~1type" ,
2970+ " https://json-schema.org/draft/2020-12/schema" , JSON_Schema_2020_12, " " ,
2971+ false , true );
2972+ EXPECT_ANONYMOUS_FRAME_STATIC_POINTER (
2973+ frame, " #/$defs/https:~1~1example.com~1schema~1type/type" ,
2974+ " /$defs/https:~1~1example.com~1schema~1type/type" ,
2975+ " https://json-schema.org/draft/2020-12/schema" , JSON_Schema_2020_12,
2976+ " /$defs/https:~1~1example.com~1schema~1type" , false , true );
2977+
2978+ // References
2979+
2980+ EXPECT_EQ (frame.references ().size (), 2 );
2981+
2982+ EXPECT_STATIC_REFERENCE (
2983+ frame, " /$schema" , " https://json-schema.org/draft/2020-12/schema" ,
2984+ " https://json-schema.org/draft/2020-12/schema" , std::nullopt ,
2985+ " https://json-schema.org/draft/2020-12/schema" );
2986+ EXPECT_STATIC_REFERENCE (frame, " /$ref" ,
2987+ " #/$defs/https:~1~1example.com~1schema~1type" , " " ,
2988+ " /$defs/https:~1~1example.com~1schema~1type" ,
2989+ " #/$defs/https%3A~1~1example.com~1schema~1type" );
2990+
2991+ // Reachability
2992+
2993+ EXPECT_FRAME_LOCATION_REACHABLE (frame, Static, " " , frame.root ());
2994+ EXPECT_FRAME_LOCATION_REACHABLE (frame, Static,
2995+ " #/$defs/https:~1~1example.com~1schema~1type" ,
2996+ frame.root ());
2997+
2998+ EXPECT_FRAME_LOCATION_NON_REACHABLE (
2999+ frame, Static, " " , " #/$defs/https:~1~1example.com~1schema~1type" );
3000+ EXPECT_FRAME_LOCATION_REACHABLE (
3001+ frame, Static, " #/$defs/https:~1~1example.com~1schema~1type" ,
3002+ " #/$defs/https:~1~1example.com~1schema~1type" );
3003+ }
3004+
29353005TEST (Frame_2020_12, ref_from_definitions) {
29363006 const sourcemeta::core::JSON document = sourcemeta::core::parse_json (R"JSON( {
29373007 "$id": "https://www.sourcemeta.com/schema",
0 commit comments