openapi: "3.0.3"
info:
  title: "API contract registry"
  version: "1.0.0"
  description: "The contract test row references an endpoint, and the endpoint references a spec, so the registry has a strict three-level insert order. The method enum has five members and an upper-case GET fails the check constraint. A failing contract test is a normal row, not an error, so the fixture has to include failing rows on purpose. The format enum distinguishes OpenAPI from Swagger documents, which matters because the two produce different sample payloads."
paths: {}
x-domain-id: "contracts"
x-dialect: "postgres"
components:
  schemas:
    specs:
      type: "object"
      x-primary-key: "id"
      required: ["id", "name", "version", "format", "source_url"]
      properties:
        id:
          type: "string"
          format: "uuid"
        name:
          type: "string"
          x-unique: true
        version:
          type: "string"
        format:
          type: "string"
          enum: ["openapi", "swagger"]
        source_url:
          type: "string"
          format: "uri"
    endpoints:
      type: "object"
      x-primary-key: "id"
      required: ["id", "spec_id", "method", "path"]
      properties:
        id:
          type: "string"
          format: "uuid"
        spec_id:
          $ref: "#/components/schemas/specs"
        method:
          type: "string"
          enum: ["get", "post", "put", "patch", "delete"]
        path:
          type: "string"
    contract_tests:
      type: "object"
      x-primary-key: "id"
      required: ["id", "endpoint_id", "status", "ran_at"]
      properties:
        id:
          type: "string"
          format: "uuid"
        endpoint_id:
          $ref: "#/components/schemas/endpoints"
        status:
          type: "string"
          enum: ["passing", "failing", "skipped"]
        ran_at:
          type: "string"
          format: "date-time"
