{
"id" : "person",
"description": "A person subtype",
"type": "object",
"properties": { "name": { "type": "string" }
}
{
"id" : "adult",
"description": "An adult subtype",
"type": {"$ref" : "person"},
"properties": { "age": { "minimum": 21 }
}
}
-Gary
> --
> You received this message because you are subscribed to the Google Groups "JSON Schema" group.
> To post to this group, send email to json-...@googlegroups.com.
> To unsubscribe from this group, send email to json-schema...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/json-schema?hl=en.
>
>
-Gary
{
"id" : "adult",
"description": "An adult subtype",
"type": {
"id" : "person",
"description": "A person subtype",
"type": "object",
"properties": { "name": { "type": "string" }
},
"properties": { "age": { "minimum": 21 }
}
}
-Gary
No, when you need to use the same schema again, you can just use the
reference. (Although, there is nothing stopping you from including it
again if you wanted) A schema has to be defined at least once
somewhere for it to be used as a reference later. Example:
{
"id" : "adult",
"description": "An adult subtype",
"type": {
"id" : "person",
"description": "A person subtype",
"type": "object",
"properties": { "name": { "type": "string" } }
},
"properties": {
"age": { "minimum": 21 },
"son" : { "$ref" : "person" },
"daughter" : { "$ref" : "person" }
}
}
-Gary
-Gary
Hi Dean,
It was for the same reason as David had for the original post about types. I want to have everything in a single schema file but still want to have some hierarchy between the different types.
If you're embedding the type definition you're not getting any reusability, so why not just inline it?