{
	"$schema": "http://json-schema.org/draft-07/schema#",
    "title": "JSON Schema for NVD CVE History API version 2.0",
	"$id": "https://csrc.nist.gov/schema/nvd/api/2.0/history_api_json_2.0.schema",
    "definitions": {
		"defChange": {
			"properties": {
				"change": {"$ref": "#/definitions/changeItem"}
			},
			"required": ["change"],
			"additionalProperties": false
		},
		
		"changeItem": {
			"properties": {
				"cveId": {
					"type": "string",
					"pattern": "^CVE-[0-9]{4}-[0-9]{4,}$"
				},
				"eventName": {"type": "string"},
				"cveChangeId": {"type": "string", "format": "uuid"},
				"sourceIdentifier": {"type": "string"},
				"created": {"type": "string", "format": "date-time"},
				"details": {
					"type": "array",
					"items": {"$ref": "#/definitions/detail"}
				}
			},
			"required": ["cveId", "eventName", "cveChangeId", "sourceIdentifier"],
			"additionalProperties": false
        },
		
		"detail": {
			"properties": {
				"action": {"type": "string"},
				"type": {"type": "string"},
				"oldValue": {"type": "string"},
				"newValue": {"type": "string"}
			},
			"required": ["type"],
			"additionalProperties": false
		}
	},
		
    "type": "object",
    "properties": {
		"resultsPerPage": {"type": "integer"},
		"startIndex": {"type": "integer"},
		"totalResults": {"type": "integer"},
		"format": {"type": "string"},
		"version": {"type": "string"},
		"timestamp": {"type": "string", "format": "date-time"},
        "cveChanges": {
            "description": "Array of CVE Changes",
            "type": "array",
            "items": {"$ref": "#/definitions/defChange"}
        }
    },
    "required": [
		"resultsPerPage",
		"startIndex",
		"totalResults",
		"format",
		"version",
		"timestamp"
    ]
}