Tools, FAQ, Tutorials:
JSON Type Definitions and References
How to define a JSON type and reference it in JSON Schema?
✍: FYIcenter.com
If you want to define a JSON type, and reference it later in your JSON Schema,
you can:
1. Name your JSON type can put it inside the "definitions" property. For example, "rating" as a JSON type can be defined as shown below:
{ "definitions": { "rating": { "type": "integer", "minimum": 0, "maximum": 5 } }, ... }
2. Use "$ref" instead of "type" property to refer to a previously defined JSON type. For example, the following JSON schema defines a JSON Object that should have two properties with the same JSON type "rating":
{ ... "type": "object", "properties": { "clarity": { "$ref": "#/definitions/rating" }, "efficiency": { "$ref": "#/definitions/rating" } } }
2017-08-25, 772👍, 0💬
Popular Posts:
Where to find tutorials on Using Azure API Management Publisher Dashboard? Here is a list of tutoria...
How To Support Multiple-Page Forms in PHP? If you have a long form with a lots of fields, you may wa...
What properties and functions are supported on requests.models.Response objects? "requests" module s...
How to add request URL Template Parameters to my Azure API operation to make it more user friendly? ...
Where to see resource detailed information of my API Management Service on Azure Portal? Once you ha...