goldisfine
goldisfine

Reputation: 4850

What is the purpose of the "description" field in JSON Schemas?

I'm not sure what the purpose of a JSON Schema "description" field is. Does the field serve as a space to comment? Does the field serve as an ID?

{
    "id": "http://www.noodle.org/entry-schema#",
    "schema": "http://json-schema.org/draft-04/schema#",
    "description": "schema for online courses",
    "type": "object",
    "properties": {
        "institution": {
            "type": "object",
           "$ref" : "#/definitions/institution" 
        },
        "person": {
            "type": "object",
            "items": {
                "type": "object",
                "$ref": "#/definitions/person"
            }   
    "definitions": {        
        "institution": {
            "description": "University",
            "type": "object",
            "properties": {
                "name":{"type":"string"},
                "url":{
                    "format": "uri",
                    "type": "string"
                },
                "descriptionofinstitution":{"type":"string"},
                "location": {
                    "description": "location",
                "type": "string",
                "required": true
                }
        }

}

Upvotes: 5

Views: 9823

Answers (2)

mfenniak
mfenniak

Reputation: 491

According to the JSON-Schema specification (http://json-schema.org/latest/json-schema-validation.html#anchor98), the purpose of the "description" (and "title") fields is to decorate a user interface with information about the data produced by this user interface. A title will preferrably be short, whereas a description will provide explanation about the purpose of the instance described by this schema.

Upvotes: 19

brbtsl
brbtsl

Reputation: 332

It is probably some additional explanation, in order to enhance the knowledge concerning the specific entry, if the id is not enough. Of course it doesn't affect the behavior of the code as code itself

Upvotes: 1

Related Questions