@@ -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
}
@@ -847,8 +847,11 @@ sub E {
847
847
push @{$state -> {errors }}, JSON::Schema::Draft201909::Error-> new(
848
848
instance_location => $state -> {data_path },
849
849
keyword_location => $state -> {traversed_schema_path }.$state -> {schema_path }.$suffix ,
850
- !$state -> {absolute_schema_path } ? ()
851
- : ( absolute_keyword_location => $state -> {absolute_schema_path }.$state -> {schema_path }.$suffix ),
850
+ !$state -> {absolute_schema_uri } ? () : ( absolute_keyword_location => do {
851
+ my $abs = $state -> {absolute_schema_uri }-> clone;
852
+ $abs -> fragment($abs -> fragment.$state -> {schema_path }.$suffix );
853
+ $abs ;
854
+ } ),
852
855
error => @args ? sprintf ($error_string , @args ) : $error_string ,
853
856
);
854
857
0 commit comments