-
Notifications
You must be signed in to change notification settings - Fork 330
Closed
Labels
Description
Does this library support multiple json files?
I'm having this schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"address": {
"type": "object",
"properties": {
"street_address": { "type": "string" },
"city": { "type": "string" },
"state": { "type": "string" }
},
"required": ["street_address", "city", "state"]
}
},
"type": "object",
"properties": {
"billing_address": { "$ref": "file2.json#/address" },
"shipping_address": { "$ref": "file2.json#/address" }
}
}
and file2.json
{
"address": {
"type": "object",
"properties": {
"street_address": { "type": "string" },
"city": { "type": "string" },
"state": { "type": "string" }
},
"required": ["street_address", "city", "state"]
}
}
and I'm getting this error:
Exception in thread "main" com.networknt.schema.JsonSchemaException: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
at [Source: UNKNOWN; line: 1, column: 0]
at com.networknt.schema.JsonSchemaFactory.getSchema(JsonSchemaFactory.java:57)
at com.networknt.schema.RefValidator.<init>(RefValidator.java:63)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at com.networknt.schema.JsonSchema.read(JsonSchema.java:120)
at com.networknt.schema.JsonSchema.<init>(JsonSchema.java:54)
at com.networknt.schema.PropertiesValidator.<init>(PropertiesValidator.java:36)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at com.networknt.schema.JsonSchema.read(JsonSchema.java:120)
at com.networknt.schema.JsonSchema.<init>(JsonSchema.java:54)
at com.networknt.schema.JsonSchema.<init>(JsonSchema.java:44)
at com.networknt.schema.JsonSchemaFactory.getSchema(JsonSchemaFactory.java:64)
at json.JsonTest.main(JsonTest.java:19)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
at [Source: UNKNOWN; line: 1, column: 0]
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:261)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3829)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3774)
at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2312)
at com.networknt.schema.JsonSchemaFactory.getSchema(JsonSchemaFactory.java:53)
... 17 more
On single json file it works. Am I doing something wrong?