openapi: "3.0.3"
info:
  title: "Legacy Swagger 2.0 catalog"
  version: "1.0.0"
  description: "The category tree references itself, so the seed needs an explicit insertion order that respects the parent relationship. Swagger 2.0 writes the price as a double, which is the one column that survives the conversion to Postgres unchanged. The join table product_tag repeats the same tag on the same product unless the position column is respected. The nullable parent_id on the root category is what tells the generator to insert the tree roots first."
paths: {}
x-domain-id: "legacy_catalog"
x-dialect: "postgres"
components:
  schemas:
    category:
      type: "object"
      x-primary-key: "id"
      required: ["id", "name"]
      properties:
        id:
          type: "integer"
        name:
          type: "string"
          x-unique: true
        parent_id:
          $ref: "#/components/schemas/category"
    product:
      type: "object"
      x-primary-key: "id"
      required: ["id", "category_id", "title"]
      properties:
        id:
          type: "integer"
        category_id:
          $ref: "#/components/schemas/category"
        title:
          type: "string"
        price:
          type: "number"
          minimum: 0
          nullable: true
        created_at:
          type: "string"
          format: "date-time"
          nullable: true
    product_tag:
      type: "object"
      required: ["product_id", "tag", "position"]
      properties:
        product_id:
          $ref: "#/components/schemas/product"
        tag:
          type: "string"
        position:
          type: "integer"
          minimum: 0
