{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"$id": "https://sh4zam.com/api/schema.json",
	"title": "SH4ZAM API index",
	"description": "Machine-readable index of every public SH4ZAM symbol. Generated from the upstream headers.",
	"type": "object",
	"required": [
		"library",
		"version",
		"upstream_commit",
		"generated",
		"modules",
		"symbols"
	],
	"properties": {
		"$schema": {
			"type": "string"
		},
		"library": {
			"const": "sh4zam"
		},
		"version": {
			"type": "string",
			"pattern": "^\\d+\\.\\d+\\.\\d+$"
		},
		"upstream": {
			"type": "string"
		},
		"upstream_commit": {
			"type": "string",
			"pattern": "^[0-9a-f]{40}$"
		},
		"generated": {
			"type": "string",
			"description": "Commit date of the upstream revision the index was generated from."
		},
		"conventions": {
			"type": "object",
			"additionalProperties": {
				"type": "string"
			}
		},
		"suffixes": {
			"type": "object",
			"additionalProperties": {
				"type": "string"
			}
		},
		"modules": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/module"
			}
		},
		"cpp": {
			"type": "object"
		},
		"symbols": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/symbol"
			}
		}
	},
	"definitions": {
		"module": {
			"type": "object",
			"required": [
				"id",
				"title",
				"header",
				"brief",
				"url",
				"md"
			],
			"properties": {
				"id": {
					"enum": [
						"scalar",
						"trig",
						"vector",
						"quat",
						"matrix",
						"xmtrx",
						"complex",
						"memory",
						"cdefs",
						"version"
					]
				},
				"title": {
					"type": "string"
				},
				"header": {
					"type": "string"
				},
				"cpp_header": {
					"type": "string"
				},
				"brief": {
					"type": "string",
					"minLength": 1
				},
				"url": {
					"type": "string",
					"format": "uri"
				},
				"md": {
					"type": "string",
					"format": "uri"
				},
				"symbol_count": {
					"type": "integer"
				},
				"sections": {
					"type": "array",
					"items": {
						"type": "string"
					}
				}
			}
		},
		"param": {
			"type": "object",
			"required": [
				"name",
				"type",
				"doc"
			],
			"properties": {
				"name": {
					"type": "string"
				},
				"type": {
					"type": "string"
				},
				"doc": {
					"type": "string"
				}
			}
		},
		"symbol": {
			"type": "object",
			"required": [
				"name",
				"kind",
				"module",
				"section",
				"header",
				"line",
				"signature",
				"brief",
				"url",
				"md",
				"cpp",
				"generic",
				"backends",
				"documented"
			],
			"properties": {
				"name": {
					"type": "string",
					"pattern": "^(shz|SHZ)_[A-Za-z0-9_]+$"
				},
				"kind": {
					"enum": [
						"function",
						"macro",
						"type",
						"typedef",
						"enum",
						"enumerator",
						"variable"
					]
				},
				"module": {
					"enum": [
						"scalar",
						"trig",
						"vector",
						"quat",
						"matrix",
						"xmtrx",
						"complex",
						"memory",
						"cdefs",
						"version"
					]
				},
				"section": {
					"type": "string"
				},
				"header": {
					"type": "string",
					"pattern": "^sh4zam/shz_\\w+\\.h$"
				},
				"line": {
					"type": "integer",
					"minimum": 1
				},
				"signature": {
					"type": "string",
					"minLength": 1
				},
				"return_type": {
					"type": "string"
				},
				"params": {
					"type": "array",
					"items": {
						"$ref": "#/definitions/param"
					}
				},
				"fields": {
					"type": "array",
					"items": {
						"$ref": "#/definitions/param"
					}
				},
				"brief": {
					"type": "string",
					"minLength": 1
				},
				"detail": {
					"type": "string",
					"description": "Markdown."
				},
				"returns": {
					"type": "string"
				},
				"notes": {
					"type": "array",
					"items": {
						"type": "string"
					}
				},
				"warnings": {
					"type": "array",
					"items": {
						"type": "string"
					}
				},
				"sa": {
					"type": "array",
					"items": {
						"type": "string"
					},
					"description": "See-also symbol names."
				},
				"documented": {
					"type": "boolean",
					"description": "False when the upstream header has no doc comment for this symbol."
				},
				"deprecated": {
					"type": "string"
				},
				"backends": {
					"description": "Per back-end implementation. sh4: \"asm\" = dedicated SH4 implementation (inline asm, .s or FPU builtins), \"c\" = shared C code. spu: \"simd\" = dedicated SPU implementation. null for non-functions.",
					"oneOf": [
						{
							"type": "null"
						},
						{
							"type": "object",
							"required": [
								"sh4",
								"sw",
								"spu"
							],
							"properties": {
								"sh4": {
									"enum": [
										"asm",
										"c"
									]
								},
								"sw": {
									"enum": [
										"c"
									]
								},
								"spu": {
									"enum": [
										"simd",
										"c"
									]
								}
							}
						}
					]
				},
				"generic": {
					"type": [
						"string",
						"null"
					],
					"description": "C type-generic macro that dispatches to this function."
				},
				"cpp": {
					"type": "array",
					"items": {
						"type": "string"
					},
					"description": "C++ names that wrap this symbol."
				},
				"url": {
					"type": "string",
					"format": "uri"
				},
				"md": {
					"type": "string",
					"format": "uri"
				},
				"doxygen_url": {
					"type": [
						"string",
						"null"
					],
					"description": "Legacy Doxygen URL on sh4zam.com (redirects to url)."
				},
				"source_url": {
					"type": "string",
					"format": "uri"
				}
			}
		}
	}
}
