openapi: "3.0.3"
info:
  title: "Orders schema for a type-mapping table"
  version: "1.0.0"
  description: "The mapping table on this page uses a single wide row so that every JSON Schema type appears at least once. The nullable note column is the one nullable field, and it maps to a column with no NOT NULL. The status enum maps to a text column with a CHECK constraint rather than to a native enum type, because the enum type has to be created separately. The placed_at timestamp maps to timestamptz and is written with an explicit cast."
paths: {}
x-domain-id: "spec_orders"
x-dialect: "postgres"
components:
  schemas:
    orders:
      type: "object"
      x-primary-key: "id"
      required: ["id", "user_id", "status", "total_cents", "placed_at"]
      properties:
        id:
          type: "string"
          format: "uuid"
        user_id:
          type: "string"
          format: "uuid"
          x-foreign-key: "users.id"
        status:
          type: "string"
          enum: ["placed", "paid"]
        total_cents:
          type: "integer"
          minimum: 0
        placed_at:
          type: "string"
          format: "date-time"
        note:
          type: "string"
          nullable: true
