{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "required": [
        "name",
        "description",
        "url",
        "apis",
        "maintainer"
    ],
    "properties": {
        "name": {
            "type": "string"
        },
        "description": {
            "type": "string"
        },
        "url": {
            "type": "string"
        },
        "image": {
            "type": "string"
        },
        "apis": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/apisDefinition"
            }
        },
        "maintainer": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/maintainerDefinition"
            }
        }
    },
    "definitions": {
        "maintainerDefinition": {
            "required": [
                "name"
            ],
            "properties": {
                "name": {
                    "type": "string"
                }
            },
            "additionalProperties": {
                "type": "string"
            }
        },
        "apisDefinition": {
            "oneOf": [
                {
                    "required": [
                        "$ref"
                    ],
                    "properties": {
                        "$ref": {
                            "type": "string"
                        }
                    }
                },
                {
                    "required": [
                        "name"
                    ],
                    "properties": {
                        "name": {
                            "type": "string"
                        },
                        "description": {
                            "type": "string"
                        },
                        "image": {
                            "type": "string"
                        },
                        "humanURL": {
                            "type": "string"
                        },
                        "tags": {
                            "type": "string"
                        },
                        "urls": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/urlsDefinition"
                            }
                        },
                        "contact": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/contactDefinition"
                            }
                        },
                        "meta": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/metaDefinition"
                            }
                        }
                    }
                }
            ]
        },
        "metaDefinition": {
            "required": [
                "key",
                "value"
            ],
            "properties": {
                "key": {
                    "type": "string"
                },
                "value": {
                    "type": "string"
                }
            }
        },
        "contactDefinition": {
            "required": [
                "type",
                "url"
            ],
            "properties": {
                "type": {
                    "type": "string",
                    "enum": [
                        "twitter"
                    ]
                },
                "url": {
                    "type": "string",
                    "pattern": "^(http)|(https)://(.*)$"
                }
            }
        },
        "urlsDefinition": {
            "required": [
                "type",
                "url"
            ],
            "properties": {
                "type": {
                    "type": "string",
                    "pattern": "^(portal)|(console)|(signup)|(libraries)|(swagger)|(X-[a-z0-9\\-]*)$"
                },
                "url": {
                    "type": "string",
                    "pattern": "^(http)|(https)://(.*)$"
                }
            }
        }
    }
}