I want to reference a child schema in a parent json schema. Here is the child schema named child.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Child",
"description": "Child schema",
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"}
}}
and here is the parent schema named parent.json and all the two files are in the same folder. I want to refer to the child schema and i do like this:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Parent",
"description": "Parent schema",
"type": "object",
"properties": {
"allOf": [
{
"$ref": "file://child.json"
}
],
"adresse": {"type": "string"}
}}
I've an error saying that the file child.json is not found. I've tested lot of tings but anyone is working.
Thanks for your help
I've found a solution for my problem. Here is the solution
The context is that we always have two schemas: the parent and the child. The parent have to include the child schema in one of his properties like this par exemple:
And in the child schema at the beginning of him, you have to put an id on it like this
Now for the validation with jaySchema you will do like this
And it's all. :-D
This is my solution but it's not the best and i hope that it will help. Thanks to all for your answers