@@ -72,7 +72,7 @@ sub evaluate {
72
72
short_circuit => $self -> short_circuit,
73
73
data_path => ' ' ,
74
74
traversed_schema_path => ' ' , # the accumulated path up to the last $ref traversal
75
- absolute_schema_path => ' ' , # the absolute path of the last traversed $ref
75
+ absolute_schema_uri => undef , # the absolute path of the last traversed $ref; always a Mojo::URL
76
76
schema_path => ' ' , # the rest of the path, since the last traversed $ref
77
77
errors => [],
78
78
};
@@ -166,11 +166,11 @@ sub _eval_keyword_ref {
166
166
167
167
# for now, the base_uri of the schema is always '' (yes I know this is not an absolute uri)
168
168
# TODO: we need to track the base_uri of the schema resource that we are referencing.
169
- # absolute_schema_path may not look anything like the contents of the $ref keyword.
169
+ # absolute_schema_uri may not look anything like the contents of the $ref keyword.
170
170
return $self -> _eval($data , $subschema ,
171
171
+{ %$state ,
172
172
traversed_schema_path => $state -> {traversed_schema_path }.$state -> {schema_path }.' /$ref' ,
173
- absolute_schema_path => $url -> to_string ,
173
+ absolute_schema_uri => $url ,
174
174
schema_path => ' ' ,
175
175
});
176
176
}
@@ -853,8 +853,10 @@ sub E {
853
853
push @{$state -> {errors }}, JSON::Schema::Draft201909::Error-> new(
854
854
instance_location => $state -> {data_path },
855
855
keyword_location => $state -> {traversed_schema_path }.$state -> {schema_path }.$suffix ,
856
- !$state -> {absolute_schema_path } ? ()
857
- : ( absolute_keyword_location => $state -> {absolute_schema_path }.$state -> {schema_path }.$suffix ),
856
+ !$state -> {absolute_schema_uri } ? () : ( absolute_keyword_location => do {
857
+ my $abs = $state -> {absolute_schema_uri }-> clone;
858
+ $abs -> fragment($abs -> fragment.$state -> {schema_path }.$suffix );
859
+ } ),
858
860
error => @args ? sprintf ($error_string , @args ) : $error_string ,
859
861
);
860
862
0 commit comments