{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://apigenie.pl/schemas/apigenie-commands-report.json",
  "title": "apigenie commands --json",
  "description": "The command tree of a binary (ADR-239): the binary itself as the root command, with every command, positional argument and option its parsers define, read from the parsers, so it says what that build of the binary accepts. Hidden options and internal commands are left out. apigenie-generator and apigenie-catalog print theirs too. Adding members keeps formatVersion; removing a member or changing its meaning or type increments it.",
  "type": "object",
  "allOf": [{ "$ref": "#/$defs/command" }],
  "required": ["formatVersion"],
  "properties": {
    "formatVersion": {
      "description": "The version of this format.",
      "const": 1
    }
  },
  "$defs": {
    "command": {
      "type": "object",
      "required": ["name", "command", "description", "arguments", "options", "commands"],
      "properties": {
        "name": {
          "description": "The name of the command, the word that runs it (\"extract\"); for the root, the name of the binary.",
          "type": "string"
        },
        "command": {
          "description": "The full command line that runs it, from the binary on: \"apigenie i18n extract\".",
          "type": "string"
        },
        "description": {
          "description": "What the command does, as its help says it; empty when the help has no description.",
          "type": "string"
        },
        "arguments": {
          "description": "The positional arguments, in the order they are given.",
          "type": "array",
          "items": {
            "type": "object",
            "allOf": [{ "$ref": "#/$defs/argument" }],
            "required": ["name"],
            "properties": {
              "name": {
                "description": "The name of the argument in the usage line: \"FILES\".",
                "type": "string"
              }
            }
          }
        },
        "options": {
          "description": "The options of the command, -h/--help and --json included; the options of the commands above it are not repeated.",
          "type": "array",
          "items": {
            "type": "object",
            "allOf": [{ "$ref": "#/$defs/argument" }],
            "required": ["names"],
            "properties": {
              "names": {
                "description": "The names of the option, short ones first as defined: [\"-f\", \"--format\"].",
                "type": "array",
                "items": { "type": "string" },
                "minItems": 1
              },
              "value": {
                "description": "The name of the option's value in the help (\"FORMAT\"), or \"VALUE\" when it has none and the help shows \"VAR\"; absent for an option that takes no value, a flag.",
                "type": "string"
              }
            }
          }
        },
        "commands": {
          "description": "The subcommands, in the order the help lists them.",
          "type": "array",
          "items": { "$ref": "#/$defs/command" }
        }
      }
    },
    "argument": {
      "type": "object",
      "required": ["description", "minValues", "required", "repeatable"],
      "properties": {
        "description": {
          "description": "What the argument or option is, as its help says it.",
          "type": "string"
        },
        "minValues": {
          "description": "The fewest values it takes each time it is given: 0 for a flag, or for an option whose value is optional.",
          "type": "integer",
          "minimum": 0
        },
        "maxValues": {
          "description": "The most values it takes each time it is given: 0 for a flag; absent when it takes any number.",
          "type": "integer",
          "minimum": 0
        },
        "choices": {
          "description": "The values it accepts, when it accepts only these.",
          "type": "array",
          "items": { "type": "string" },
          "minItems": 1
        },
        "required": {
          "description": "Whether the command line must have the option or the positional argument; a positional argument is required exactly when minValues is above 0, as its usage line shows it.",
          "type": "boolean"
        },
        "repeatable": {
          "description": "Whether the option may be given more than once, each time adding its values.",
          "type": "boolean"
        }
      }
    }
  }
}
