openapi: "3.0.3"
info:
  title: "Warehouse inventory API"
  version: "1.0.0"
  description: "The generator-versus-generator comparison on this page focuses on whether the foreign key value is drawn from a real parent row. The quantity constraint rejects negative stock, and the naive output violates it in roughly one case out of ten. The warehouse code is unique, which gives the fixture a second dimension to check. This is the smallest fixture where an FK bug is guaranteed to show up in the database rather than only in the JSON."
paths: {}
x-domain-id: "alt_inventory"
x-dialect: "postgres"
components:
  schemas:
    warehouses:
      type: "object"
      x-primary-key: "id"
      required: ["id", "code", "region"]
      properties:
        id:
          type: "string"
          format: "uuid"
        code:
          type: "string"
          x-unique: true
        region:
          type: "string"
    stock_items:
      type: "object"
      x-primary-key: "id"
      required: ["id", "warehouse_id", "sku", "quantity"]
      properties:
        id:
          type: "string"
          format: "uuid"
        warehouse_id:
          $ref: "#/components/schemas/warehouses"
        sku:
          type: "string"
        quantity:
          type: "integer"
          minimum: 0
