This will lead to a FileNotFoundException because it will try to resolve https://example.com/./uuid.json
com.networknt.schema.JsonSchemaException: Failed to load json schema fromhttps://example.com/./uuid.json
at com.networknt.schema.JsonSchemaFactory.getMappedSchema(JsonSchemaFactory.java:521)
at com.networknt.schema.JsonSchemaFactory.getSchema(JsonSchemaFactory.java:464)
at com.networknt.schema.RefValidator.lambda$getRefSchema$0(RefValidator.java:64)
at com.networknt.schema.CachedSupplier.get(CachedSupplier.java:36)
at com.networknt.schema.JsonSchemaRef.getSchema(JsonSchemaRef.java:32)
at com.networknt.schema.RefValidator.validate(RefValidator.java:173)
at com.networknt.schema.JsonSchema.validate(JsonSchema.java:569)
at com.networknt.schema.PropertiesValidator.validate(PropertiesValidator.java:85)
at com.networknt.schema.JsonSchema.validate(JsonSchema.java:569)
at com.networknt.schema.RefValidator.validate(RefValidator.java:181)
at com.networknt.schema.JsonSchema.validate(JsonSchema.java:569)
at com.networknt.schema.PropertiesValidator.validate(PropertiesValidator.java:85)
at com.networknt.schema.JsonSchema.validate(JsonSchema.java:569)
at com.networknt.schema.ItemsValidator.doValidate(ItemsValidator.java:152)
at com.networknt.schema.ItemsValidator.validate(ItemsValidator.java:122)
at com.networknt.schema.JsonSchema.validate(JsonSchema.java:569)
at com.networknt.schema.BaseJsonValidator.validate(BaseJsonValidator.java:287)
at com.networknt.schema.JsonSchema.validate(JsonSchema.java:879)
at com.networknt.schema.JsonSchema.validate(JsonSchema.java:702)
at com.networknt.schema.JsonSchema.validate(JsonSchema.java:682)
at com.networknt.schema.JsonSchema.validate(JsonSchema.java:629)
... 4 more
Caused by: java.io.FileNotFoundException: https://example.com/./uuid.json
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1994)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1599)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:223)
at com.networknt.schema.resource.UriSchemaLoader.openConnectionCheckRedirects(UriSchemaLoader.java:51)
at com.networknt.schema.resource.UriSchemaLoader.lambda$getSchema$0(UriSchemaLoader.java:36)
at com.networknt.schema.JsonSchemaFactory.getMappedSchema(JsonSchemaFactory.java:494)
... 24 more
In versions < 1.3.0 it worked this way. Changing the schema to "$ref": "uuid.json" fixes this issue, but it should also work using dot slash paths.
Env
json-schema-validator version: 1.3.1
Java: OpenJDK 64-Bit Server VM Temurin-21+35 (build 21+35-LTS, mixed mode)
Describe the bug
When loading a schema via IRL, $ref files cannot be loaded when using the "dot slash" path e.g:
./file.json
To Reproduce
Loading the following schema via an IRL
Java Code:
This will lead to a
FileNotFoundException
because it will try to resolvehttps://example.com/./uuid.json
In versions
< 1.3.0
it worked this way. Changing the schema to"$ref": "uuid.json"
fixes this issue, but it should also work using dot slash paths.Env