{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "https://www.yacpdb.org/schemas/yacpdb-source.schema.json",
    "type": "object",
    "properties": {
        "name": {
            "$ref": "#/definitions/text"
        },
        "type": {
            "$ref": "#/definitions/source_type_type"
        },
        "foreignids": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/foreignid_type"
            },
            "minItems": 1
        },
        "comments": {
            "$ref": "#/definitions/text_list"
        }
    },
    "required": [
        "name"
    ],
    "additionalProperties": false,
    "definitions": {
        "text": {
            "anyOf": [
                {
                    "type": "number"
                },
                {
                    "type": "string",
                    "minLength": 1
                }
            ]
        },
        "text_list": {
            "type": "array",
            "elements": {
                "$ref": "#/definitions/text"
            },
            "minItems": 1,
            "_uniqueItems": true
        },
        "source_type_type": {
            "type": "string",
            "pattern": "^(magazine|newspaper|award booklet|book|anthology|article|lecture|solving event|website|booklet)$",
            "maxLength": 255
        },
        "foreignid_type": {
            "type": "object",
            "properties": {
                "domain": {
                    "type": "string",
                    "pattern": "^database\\.wfcc\\.ch$"
                },
                "id": {
                    "type": "integer",
                    "minimum": 1
                }
            },
            "required": [
                "domain",
                "id"
            ],
            "additionalProperties": false
        }
    }
}