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:
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"
        }
    }
}
⇒ References to JSON Types Defined Externally
2017-08-25, ∼2070🔥, 0💬
Popular Posts:
What is test testing area for? The testing area is provided to allow visitors to post testing commen...
How to add an API to an API product for internal testing on the Publisher Portal of an Azure API Man...
Where to find tutorials on Visual Studio? I want to know How to learn Visual Studio. Here is a large...
What are "*..." and "**..." Wildcard Parameters in Function Definitions? If you want to define a fun...
How to dump (or encode, serialize) a Python object into a JSON string using json.dumps()? The json.d...