{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://footown.com/generic/credentials+v1#",
    "description": "a generic user credentials schema",
    "type": "object",
    "required": [
        "username",
        "password"
    ],
    "properties": {
        "credentials": {
            "type": "object",
            "username": {
                "description": "The persons unique id in the system",
                "$ref": "#/definitions/login"
            },
            "password": {
                "description": "The persons unique id in the system",
                "$ref": "#/definitions/login"
            },
            "api": {
                "type": "object",
                "properties": {
                    "key": {
                        "oneOf": [
                            {
                                "$ref": "#/definitions/nested"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                }
            }
        }
    },
    "definitions": {
        "login": {
            "type": "string",
            "minLength": 1
        },
        "nested": {
            "allOf": [
                {
                    "$ref": "#/definitions/login"
                }
            ]
        }
    }
}