openapi: "3.0.3"
info:
  title: "Inventory fixture for a YAML-to-SQL walkthrough"
  version: "1.0.0"
  description: "The fixture is chosen because a YAML document with nested anchors maps onto exactly these two tables. The quantity and reserved constraints are both non-negative, so the boundary cases are easy to state. The warehouse code is unique and is the natural key a YAML anchor refers back to. The region column is free text, which is where a YAML value with trailing whitespace causes a silent mismatch."
paths: {}
x-domain-id: "tut_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", "reserved"]
      properties:
        id:
          type: "string"
          format: "uuid"
        warehouse_id:
          $ref: "#/components/schemas/warehouses"
        sku:
          type: "string"
        quantity:
          type: "integer"
          minimum: 0
        reserved:
          type: "integer"
          minimum: 0
