openapi: 3.0.0
info:
  title: SMALL Protocol v1 Discovery API
  version: 1.0.0
  description: |
    Public HTTP discovery surface for the SMALL Protocol v1.

    smallprotocol.dev currently serves protocol metadata and versioned schema assets.
    Manifest validation and replay are implemented by the CLI or downstream systems,
    not by hosted POST endpoints on smallprotocol.dev.

servers:
  - url: https://smallprotocol.dev
    description: Production
  - url: http://localhost:5173
    description: Local development server

paths:
  /protocol/small/v1:
    get:
      summary: Get SMALL Protocol v1 contract
      description: Returns the protocol definition including primitives, rules, and published schema URLs.
      operationId: getProtocol
      tags:
        - Protocol
      responses:
        '200':
          description: Protocol contract
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Protocol'

  /schemas/small/v1/{schemaFile}:
    get:
      summary: Get a published SMALL schema file
      description: Returns one of the published versioned schema files served by smallprotocol.dev.
      operationId: getSchemaFile
      tags:
        - Schemas
      parameters:
        - name: schemaFile
          in: path
          required: true
          description: Filename of the published schema asset
          schema:
            $ref: '#/components/schemas/PublishedSchemaFile'
      responses:
        '200':
          description: JSON Schema
          content:
            application/json:
              schema:
                type: object
        '404':
          description: Schema not found

components:
  schemas:
    Protocol:
      type: object
      required: [protocol, version, primitives, rules, schemas]
      properties:
        protocol:
          type: string
          example: SMALL
        version:
          type: string
          example: "1.0.0"
        primitives:
          type: array
          items:
            type: string
          example: [Schema, Manifest, Artifact, Lineage, Lifecycle]
        rules:
          type: object
          additionalProperties:
            type: boolean
        schemas:
          type: object
          additionalProperties:
            type: string

    PublishedSchemaFile:
      type: string
      enum:
        - intent.schema.json
        - constraints.schema.json
        - plan.schema.json
        - progress.schema.json
        - handoff.schema.json
        - manifest.schema.json
        - artifact.schema.json
        - lineage.schema.json
        - lifecycle.schema.json
