{
  "components": {
    "schemas": {
      "Artifact": {
        "additionalProperties": false,
        "properties": {
          "bytes": {
            "minimum": 1,
            "type": "integer"
          },
          "contract_version": {
            "type": "string"
          },
          "download_path": {
            "type": "string"
          },
          "media_type": {
            "const": "application/json"
          },
          "name": {
            "type": "string"
          },
          "schema_aliases": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "schema_id": {
            "type": "string"
          },
          "scope": {
            "enum": [
              "public_contract_downloads",
              "public_feed_cache",
              "public_signed_feed",
              "public_read_api"
            ]
          },
          "sha256": {
            "pattern": "^[a-f0-9]{64}$",
            "type": "string"
          }
        },
        "required": [
          "name",
          "schema_id",
          "schema_aliases",
          "contract_version",
          "scope",
          "media_type",
          "sha256",
          "bytes",
          "download_path"
        ],
        "type": "object"
      },
      "Bundle": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/LegacyBundle"
          },
          {
            "$ref": "#/components/schemas/PreviousBundle"
          },
          {
            "$ref": "#/components/schemas/CurrentBundle"
          }
        ]
      },
      "CurrentBundle": {
        "additionalProperties": false,
        "properties": {
          "api_version": {
            "const": "1.0"
          },
          "artifacts": {
            "items": {
              "$ref": "#/components/schemas/Artifact"
            },
            "type": "array"
          },
          "bundle_version": {
            "const": "1.2.0"
          },
          "feed_record_versions": {
            "const": [
              "1.0",
              "1.1",
              "1.2",
              "1.3"
            ]
          }
        },
        "required": [
          "bundle_version",
          "api_version",
          "feed_record_versions",
          "artifacts"
        ],
        "type": "object"
      },
      "LegacyBundle": {
        "additionalProperties": false,
        "properties": {
          "api_version": {
            "const": "1.0"
          },
          "artifacts": {
            "items": {
              "$ref": "#/components/schemas/Artifact"
            },
            "type": "array"
          },
          "bundle_version": {
            "const": "1.0.0"
          },
          "feed_record_versions": {
            "const": [
              "1.0",
              "1.1",
              "1.2"
            ]
          }
        },
        "required": [
          "bundle_version",
          "api_version",
          "feed_record_versions",
          "artifacts"
        ],
        "type": "object"
      },
      "PreviousBundle": {
        "additionalProperties": false,
        "properties": {
          "api_version": {
            "const": "1.0"
          },
          "artifacts": {
            "items": {
              "$ref": "#/components/schemas/Artifact"
            },
            "type": "array"
          },
          "bundle_version": {
            "const": "1.1.0"
          },
          "feed_record_versions": {
            "const": [
              "1.0",
              "1.1",
              "1.2",
              "1.3"
            ]
          }
        },
        "required": [
          "bundle_version",
          "api_version",
          "feed_record_versions",
          "artifacts"
        ],
        "type": "object"
      }
    }
  },
  "info": {
    "description": "Contract download endpoints only; not a complete public read API specification. API version 1.0 is independent of bundle and feed record versions.",
    "title": "Security Intelligence public contract downloads",
    "version": "1.2.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1/public/contracts/{version}": {
      "get": {
        "operationId": "publicContractBundle",
        "parameters": [
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "enum": [
                "current",
                "1.0.0",
                "1.1.0",
                "1.2.0"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Bundle"
                }
              }
            },
            "description": "Manifest listing exact-byte artifact SHA-256, sizes and version-pinned download paths"
          },
          "404": {
            "description": "Unsupported bundle version"
          },
          "429": {
            "description": "Public read limit reached"
          }
        }
      }
    },
    "/api/v1/public/contracts/{version}/{artifact}": {
      "get": {
        "operationId": "publicContractArtifact",
        "parameters": [
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "enum": [
                "current",
                "1.0.0",
                "1.1.0",
                "1.2.0"
              ],
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "artifact",
            "required": true,
            "schema": {
              "enum": [
                "public-contracts.openapi.json",
                "issue-page.schema.json",
                "feed-manifest.schema.json",
                "feed-record.schema.json",
                "feed-record-v1.1.schema.json",
                "feed-record-v1.2.schema.json",
                "feed-recovery.schema.json",
                "feed-record-v1.3.schema.json",
                "issue-page-v1.3.schema.json",
                "public-api.openapi.v1.0.0.json"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Unmodified UTF-8 JSON artifact; X-SI-Contract-SHA256 hashes the returned bytes",
            "headers": {
              "X-SI-Contract-Bundle-Version": {
                "schema": {
                  "enum": [
                    "1.0.0",
                    "1.1.0",
                    "1.2.0"
                  ]
                }
              },
              "X-SI-Contract-SHA256": {
                "schema": {
                  "pattern": "^[a-f0-9]{64}$",
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "Unsupported bundle version or artifact"
          },
          "429": {
            "description": "Public read limit reached"
          }
        }
      }
    }
  }
}
