-
Notifications
You must be signed in to change notification settings - Fork 330
Closed
Description
I am attempting to use $ref
as part of a schema, in order to reference a repetitive schema definition in a separate file within the same directory.
However, after trying multiple path variations I still continue to receive a com.networknt.schema.JsonSchemaException: java.io.IOException
stating that the "Resource common-definitions.json not found in classpath"
Main Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"required" : ["DriverProperties"],
"properties": {
"DriverProperties": {
"type": "object",
"properties": {
"CommonProperties": {
"$ref": "common-definitions.json#/definitions/DriverProperties"
}
},
"required": ["CommonProperties"]
"additionalProperties": false
}
},
"additionalProperties": false
}
common-defintions.json:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"definitions": {
"DriverProperties": {
"type": "object",
"properties": {
"field1": {
"type": "string",
"minLength": 1,
"maxLength": 512
},
"field2": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": ["field1"],
"additionalProperties": false
}
}
}
Whenever I input the absolute path, referencing the external definition works. However, I want this to work on any machine, so I want to define the classpath relatively.
Any recommendations would be greatly appreciated.
Thank you.
Metadata
Metadata
Assignees
Labels
No labels