{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/typeship-dev/json-schema/typeship-dev-generation-result-schema.json",
  "title": "GenerationResult",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/typeship-dev-openapi.json#/components/schemas/GenerationResult",
  "type": "object",
  "required": [
    "object",
    "files",
    "warnings",
    "coverage",
    "request_id"
  ],
  "properties": {
    "object": {
      "type": "string",
      "const": "package",
      "description": "One generated package. It has no ID: download it with download.url before download.expires_at."
    },
    "files": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/GeneratedFile"
      }
    },
    "download": {
      "$ref": "#/$defs/GenerationDownload"
    },
    "warnings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/GenerationWarning"
      }
    },
    "coverage": {
      "$ref": "#/$defs/GenerationCoverage"
    },
    "claim": {
      "description": "Anonymous, URL-sourced generations only. A link a signed-in person can open to turn this run into a project in their organization (same Spec, Target, and config). Lasts seven days. Null for inline Specs; absent on keyed calls.",
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "object",
          "required": [
            "url",
            "expires_at"
          ],
          "properties": {
            "url": {
              "type": "string"
            },
            "expires_at": {
              "type": "string",
              "format": "date-time"
            }
          }
        }
      ]
    },
    "request_id": {
      "$ref": "#/$defs/RequestId"
    }
  },
  "$defs": {
    "GeneratedFile": {
      "type": "object",
      "required": [
        "path",
        "content"
      ],
      "properties": {
        "path": {
          "type": "string",
          "description": "Repo-relative path inside the generated package."
        },
        "content": {
          "type": "string"
        },
        "mode": {
          "type": "string",
          "enum": [
            "100644",
            "100755"
          ],
          "default": "100644",
          "description": "Exact Git file mode. Omitted one-shot outputs are regular files."
        }
      }
    },
    "GenerationCoverage": {
      "type": "object",
      "required": [
        "generated",
        "omitted",
        "total",
        "omitted_operations"
      ],
      "properties": {
        "generated": {
          "type": "integer",
          "minimum": 0
        },
        "omitted": {
          "type": "integer",
          "minimum": 0
        },
        "total": {
          "type": "integer",
          "minimum": 0
        },
        "omitted_operations": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "METHOD/path identities of operations omitted from the package."
        },
        "reason": {
          "type": "string",
          "enum": [
            "anonymous",
            "free_plan"
          ],
          "description": "Present when a plan or anonymous limit omitted operations."
        },
        "signup_url": {
          "type": "string",
          "format": "uri",
          "description": "Sign-up link for anonymous capped runs."
        },
        "upgrade_url": {
          "type": "string",
          "format": "uri",
          "description": "Upgrade link for capped signed-in runs."
        }
      }
    },
    "GenerationDownload": {
      "type": "object",
      "description": "Complete package ZIP from this exact result. Present on requests with Idempotency-Key, including automatic CLI, MCP, and SDK keys. Download before expires_at, verify sha256, and extract into an empty directory. Anyone with this URL can download the package; keep it private. Reading does not generate again or extend the 24-hour replay window.",
      "required": [
        "url",
        "expires_at",
        "sha256",
        "size_bytes",
        "file_count"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time"
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$",
          "description": "SHA-256 of the downloaded ZIP bytes."
        },
        "size_bytes": {
          "type": "integer",
          "minimum": 0
        },
        "file_count": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "GenerationWarning": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string",
          "description": "Stable machine-readable warning code."
        },
        "message": {
          "type": "string",
          "description": "Human-readable explanation."
        },
        "operation": {
          "type": "string",
          "description": "METHOD/path of the affected operation, when applicable."
        }
      }
    },
    "RequestId": {
      "type": "string",
      "pattern": "^req_[a-z0-9]{16}$",
      "description": "Server-generated identifier used to correlate this response with Typeship logs."
    }
  }
}