{
    "definitions": {
        "error": {
            "$schema": "http://json-schema.org/draft-04/schema",
            "definitions": {
                "code": {
                    "description": "error code",
                    "enum": [
                        "invalid_params",
                        "invalid_request",
                        "unauthorized",
                        "unsupported_client_version"
                    ],
                    "example": "invalid_params",
                    "readOnly": true,
                    "type": [
                        "string"
                    ]
                },
                "detail": {
                    "description": "error detail",
                    "example": "invalid param",
                    "readOnly": true,
                    "type": [
                        "string"
                    ]
                },
                "errorFields": {
                    "description": "detail for invalid param field",
                    "items": {
                        "properties": {
                            "message": {
                                "description": "error message for invalid param field",
                                "example": "invalid status",
                                "readOnly": true,
                                "type": [
                                    "string"
                                ]
                            },
                            "name": {
                                "description": "param field name",
                                "example": "status",
                                "readOnly": true,
                                "type": [
                                    "string"
                                ]
                            }
                        },
                        "required": [
                            "name",
                            "message"
                        ],
                        "type": [
                            "object"
                        ]
                    },
                    "readOnly": true,
                    "type": [
                        "array"
                    ]
                }
            },
            "description": "This resource represents API error",
            "properties": {
                "code": {
                    "$ref": "#/definitions/error/definitions/code"
                },
                "detail": {
                    "$ref": "#/definitions/error/definitions/detail"
                },
                "errorFields": {
                    "$ref": "#/definitions/error/definitions/errorFields"
                }
            },
            "required": [
                "code",
                "detail"
            ],
            "stability": "prototype",
            "strictProperties": true,
            "title": "Error",
            "type": [
                "object"
            ]
        },
        "task": {
            "$schema": "http://json-schema.org/draft-04/schema",
            "definitions": {
                "completedAt": {
                    "description": "time completed a task",
                    "example": "2016-02-01T12:13:14Z",
                    "format": "date-time",
                    "readOnly": true,
                    "type": [
                        "string"
                    ]
                },
                "createdAt": {
                    "description": "time created a task",
                    "example": "2016-02-01T12:13:14Z",
                    "format": "date-time",
                    "readOnly": true,
                    "type": [
                        "string"
                    ]
                },
                "id": {
                    "description": "task id",
                    "example": "ec0a1edc-062e-11e7-8b1e-040ccee2aa06",
                    "format": "uuid",
                    "readOnly": true,
                    "type": [
                        "string"
                    ]
                },
                "identity": {
                    "$ref": "#/definitions/task/definitions/id"
                },
                "spent": {
                    "description": "time spent doing task in minutes",
                    "example": 12,
                    "readOnly": true,
                    "type": [
                        "integer"
                    ]
                },
                "startedAt": {
                    "description": "time started a task",
                    "example": "2016-02-01T12:13:14Z",
                    "format": "date-time",
                    "readOnly": true,
                    "type": [
                        "string"
                    ]
                },
                "status": {
                    "description": "task status",
                    "enum": [
                        "done",
                        "doing",
                        "stopped"
                    ],
                    "example": "done",
                    "readOnly": true,
                    "type": [
                        "string"
                    ]
                },
                "tags": {
                    "description": "tags",
                    "items": {
                        "example": "study",
                        "type": [
                            "string"
                        ]
                    },
                    "type": [
                        "array"
                    ]
                },
                "title": {
                    "description": "task title",
                    "example": "Buy coffee",
                    "readOnly": true,
                    "type": [
                        "string"
                    ]
                },
                "userId": {
                    "$ref": "#/definitions/user/definitions/id"
                }
            },
            "description": "This resource represents task",
            "links": [
                {
                    "description": "Get task detail",
                    "href": "/tasks/{(%23%2Fdefinitions%2Ftask%2Fdefinitions%2Fidentity)}",
                    "method": "GET",
                    "rel": "self",
                    "title": "detail"
                },
                {
                    "description": "Create task",
                    "href": "/tasks",
                    "method": "POST",
                    "rel": "create",
                    "schema": {
                        "properties": {
                            "tags": {
                                "$ref": "#/definitions/task/definitions/tags"
                            },
                            "title": {
                                "$ref": "#/definitions/task/definitions/title"
                            }
                        },
                        "required": [
                            "title"
                        ],
                        "type": [
                            "object"
                        ]
                    },
                    "targetSchema": {
                        "$ref": "#/definitions/task",
                        "type": [
                            "object"
                        ]
                    },
                    "title": "create"
                },
                {
                    "description": "Get task list",
                    "href": "/tasks",
                    "method": "GET",
                    "rel": "instances",
                    "schema": {
                        "properties": {
                            "limit": {
                                "description": "limit",
                                "example": 20,
                                "type": [
                                    "integer"
                                ]
                            },
                            "offset": {
                                "description": "offset",
                                "example": 20,
                                "type": [
                                    "integer"
                                ]
                            }
                        },
                        "type": [
                            "object"
                        ]
                    },
                    "targetSchema": {
                        "items": {
                            "$ref": "#/definitions/task"
                        },
                        "type": [
                            "array"
                        ]
                    },
                    "title": "list"
                }
            ],
            "properties": {
                "completedAt": {
                    "$ref": "#/definitions/task/definitions/completedAt"
                },
                "createdAt": {
                    "$ref": "#/definitions/task/definitions/createdAt"
                },
                "id": {
                    "$ref": "#/definitions/task/definitions/id"
                },
                "spent": {
                    "$ref": "#/definitions/task/definitions/spent"
                },
                "startedAt": {
                    "$ref": "#/definitions/task/definitions/startedAt"
                },
                "status": {
                    "$ref": "#/definitions/task/definitions/status"
                },
                "tags": {
                    "$ref": "#/definitions/task/definitions/tags"
                },
                "title": {
                    "$ref": "#/definitions/task/definitions/title"
                },
                "user": {
                    "$ref": "#/definitions/user"
                }
            },
            "required": [
                "id",
                "title",
                "status",
                "spent",
                "startedAt",
                "createdAt",
                "completedAt",
                "tags"
            ],
            "stability": "prototype",
            "strictProperties": true,
            "title": "Task",
            "type": [
                "object"
            ]
        },
        "user": {
            "$schema": "http://json-schema.org/draft-04/schema",
            "definitions": {
                "id": {
                    "description": "user id",
                    "example": "ec0a1edc-062e-11e7-8b1e-040ccee2aa06",
                    "format": "uuid",
                    "readOnly": true,
                    "type": [
                        "string"
                    ]
                },
                "identity": {
                    "$ref": "#/definitions/user/definitions/id"
                },
                "name": {
                    "description": "user name",
                    "example": "8maki",
                    "readOnly": true,
                    "type": [
                        "string"
                    ]
                }
            },
            "description": "This resource represents user",
            "links": [
                {
                    "description": "Get authenticated user detail",
                    "href": "/me",
                    "method": "GET",
                    "rel": "self",
                    "title": "detail"
                }
            ],
            "properties": {
                "id": {
                    "$ref": "#/definitions/user/definitions/id"
                },
                "name": {
                    "$ref": "#/definitions/user/definitions/name"
                }
            },
            "required": [
                "id",
                "name"
            ],
            "stability": "prototype",
            "strictProperties": true,
            "title": "User",
            "type": [
                "object"
            ]
        }
    },
    "description": "Task API",
    "links": [
        {
            "href": "https://tasky.io/v1",
            "rel": "self"
        }
    ],
    "properties": {
        "error": {
            "$ref": "#/definitions/error"
        },
        "task": {
            "$ref": "#/definitions/task"
        },
        "user": {
            "$ref": "#/definitions/user"
        }
    },
    "title": "tasky API JSON Schema",
    "type": [
        "object"
    ]
}