is there way express reference element in same json document using json schema? title might bit confusing, i'm not looking "$ref"
attribute, references type, i'm curious, if there way, reference element in document using specified field. know possible enforce using xsd xml documents, not sure json.
i want this:
{ "people": [ { "id": "1", "name": "a" }, { "id": "2", "name": "b" }, { "id": "3", "name": "c" } ], "chosenone": "1" // want schema enforce person id here }
i have been looking @ schema definition of v4: http://json-schema.org/draft-04/schema didn't find anything, looks i'm trying do. did miss it?
what want desribe reference ($ref) in object schema describing.
kind of this
{ "people": [] "chosenone": { $ref: "#1"} }
(or maybe pointer if want value of id (http://json-spec.readthedocs.org/en/latest/pointer.html)
i know if no direct way might able use pattern or oneof properties force being right value. kind of this
"properties": { "chosenone" "type": "string", "oneof": ["1","2","3"] ] }, }
simmilarly force value of property reference pattern. said since there no reference value type (http://www.tutorialspoint.com/json/json_data_types.htm) number or string can't guarantee meaning of value. can guarantee if follows kind of reference pattern.
if need more json schema's can give you might want in odata example. odata has things can describe entityset , define navigation property set. force follow odata structure arn't free regular json schema.
Comments
Post a Comment