{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://apigenie.pl/schemas/apigenie-catalog-report.json",
  "title": "apigenie-catalog list --json",
  "description": "The API catalog of a repository, as `apigenie-catalog list --json` writes it: every OpenAPI, AsyncAPI, Swagger, Protobuf and GraphQL specification found, ordered by path. Adding members keeps formatVersion; removing a member or changing its meaning or type increments it.",
  "type": "object",
  "required": ["formatVersion", "root", "config", "git", "specs", "warnings"],
  "properties": {
    "formatVersion": {
      "description": "The version of this format.",
      "const": 1
    },
    "root": {
      "description": "The absolute path of the root of the catalog, which the paths are relative to: the directory of the configuration file, else the root of the git repository, else the directory listed.",
      "type": "string"
    },
    "config": {
      "description": "The absolute path of the configuration file whose catalog section was applied, or null.",
      "type": ["string", "null"]
    },
    "git": {
      "description": "Whether the files were listed by git, which leaves out the files it ignores.",
      "type": "boolean"
    },
    "specs": {
      "description": "The specifications, ordered by path.",
      "type": "array",
      "items": { "$ref": "#/$defs/spec" }
    },
    "warnings": {
      "description": "Files that could not be read, and similar problems.",
      "type": "array",
      "items": {
        "type": "object",
        "required": ["path", "message"],
        "properties": {
          "path": {
            "description": "The file, relative to the root; null when the warning is not about a file.",
            "type": ["string", "null"]
          },
          "message": { "type": "string" }
        }
      }
    }
  },
  "$defs": {
    "spec": {
      "type": "object",
      "required": ["name", "title", "format", "specVersion", "version", "path", "owner", "listed", "commit"],
      "properties": {
        "name": {
          "description": "The name in the catalog: from the catalog section, else derived from info.title, the Protobuf package or the file name (lower-case letters, digits and dashes).",
          "type": "string"
        },
        "title": {
          "description": "info.title of an OpenAPI, AsyncAPI or Swagger document; null otherwise.",
          "type": ["string", "null"]
        },
        "format": {
          "enum": ["openapi", "asyncapi", "swagger", "protobuf", "graphql"]
        },
        "specVersion": {
          "description": "The version of the format: the `openapi`, `asyncapi` or `swagger` property, the Protobuf syntax; null for GraphQL.",
          "type": ["string", "null"]
        },
        "version": {
          "description": "info.version; null when the document has none.",
          "type": ["string", "null"]
        },
        "path": {
          "description": "The file, relative to the root, with `/` separators.",
          "type": "string"
        },
        "owner": {
          "description": "The owner from the catalog section; null when it gives none.",
          "type": ["string", "null"]
        },
        "listed": {
          "description": "Whether the catalog section lists the file.",
          "type": "boolean"
        },
        "commit": {
          "description": "The last commit changing the file; null outside git and for files not committed yet.",
          "oneOf": [
            { "type": "null" },
            {
              "type": "object",
              "required": ["id", "shortId", "author", "date", "subject"],
              "properties": {
                "id": { "type": "string" },
                "shortId": { "type": "string" },
                "author": { "type": "string" },
                "date": { "description": "ISO 8601, with the author's time zone.", "type": "string", "format": "date-time" },
                "subject": { "type": "string" }
              }
            }
          ]
        }
      }
    }
  }
}
