openapi: "3.0.3"
info:
  title: "Blog and comments API"
  version: "1.0.0"
  description: "Comments can be anonymous, so author_id is nullable while post_id is not. A post that is not published has a null published_at, which is different from an empty string. The comment body has a minimum length rule that a naive generator always violates by emitting an empty comment. Both the post slug and the author handle are unique, so the seed needs two distinct uniqueness namespaces."
paths: {}
x-domain-id: "blog"
x-dialect: "postgres"
components:
  schemas:
    authors:
      type: "object"
      x-primary-key: "id"
      required: ["id", "handle", "display_name"]
      properties:
        id:
          type: "string"
          format: "uuid"
        handle:
          type: "string"
          x-unique: true
        display_name:
          type: "string"
    posts:
      type: "object"
      x-primary-key: "id"
      required: ["id", "author_id", "slug", "title", "body"]
      properties:
        id:
          type: "string"
          format: "uuid"
        author_id:
          $ref: "#/components/schemas/authors"
        slug:
          type: "string"
          x-unique: true
        title:
          type: "string"
        body:
          type: "string"
        published_at:
          type: "string"
          format: "date-time"
          nullable: true
    comments:
      type: "object"
      x-primary-key: "id"
      required: ["id", "post_id", "body", "created_at"]
      properties:
        id:
          type: "string"
          format: "uuid"
        post_id:
          $ref: "#/components/schemas/posts"
        author_id:
          $ref: "#/components/schemas/authors"
        body:
          type: "string"
        created_at:
          type: "string"
          format: "date-time"
