{
  "openapi": "3.1.0",
  "info": {
    "title": "Example Notes API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.example.test"
    }
  ],
  "paths": {
    "/notes": {
      "post": {
        "tags": [
          "Notes"
        ],
        "summary": "Create a note",
        "description": "Save a short note in this fictional API.",
        "operationId": "createNote",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "text"
                ],
                "properties": {
                  "text": {
                    "type": "string",
                    "maxLength": 280,
                    "description": "The note to save."
                  }
                }
              },
              "examples": {
                "greeting": {
                  "summary": "A greeting",
                  "value": {
                    "text": "Hello from Shoalrun!"
                  }
                },
                "reminder": {
                  "summary": "A reminder",
                  "value": {
                    "text": "Review the release notes."
                  }
                },
                "question": {
                  "summary": "A question",
                  "value": {
                    "text": "Is the preview ready?"
                  }
                },
                "update": {
                  "summary": "A status update",
                  "value": {
                    "text": "The build passed."
                  }
                },
                "handoff": {
                  "summary": "A handoff",
                  "value": {
                    "text": "Casey owns the next review."
                  }
                },
                "meeting": {
                  "summary": "A meeting note",
                  "value": {
                    "text": "Discuss the API response shape."
                  }
                },
                "followup": {
                  "summary": "A follow-up",
                  "value": {
                    "text": "Check the example links."
                  }
                },
                "label": {
                  "summary": "A short label",
                  "value": {
                    "text": "Needs review"
                  }
                },
                "unicode": {
                  "summary": "Unicode text",
                  "value": {
                    "text": "Café notes"
                  }
                },
                "completion": {
                  "summary": "A completion note",
                  "value": {
                    "text": "Documentation published."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The saved note.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                },
                "examples": {
                  "saved": {
                    "summary": "Created release note",
                    "description": "An active note with a nested author, two labels, and optional display metadata.",
                    "value": {
                      "id": "note_123",
                      "text": "Review the release candidate.",
                      "createdAt": "2026-10-18T09:30:00Z",
                      "archivedAt": null,
                      "author": {
                        "id": "usr_42",
                        "displayName": "Morgan Lee"
                      },
                      "tags": [
                        "release",
                        "review"
                      ],
                      "metadata": {
                        "source": "release-checklist",
                        "pinned": true
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Note": {
        "type": "object",
        "description": "A saved note with its author, labels, and display metadata.",
        "required": [
          "id",
          "text",
          "createdAt",
          "archivedAt",
          "author"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The generated note ID."
          },
          "text": {
            "type": "string",
            "maxLength": 280,
            "description": "The saved text."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the note was created."
          },
          "archivedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the note was archived, or null while active."
          },
          "author": {
            "type": "object",
            "description": "The person who created the note.",
            "required": [
              "id",
              "displayName"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "The author's user ID."
              },
              "displayName": {
                "type": "string",
                "description": "The author's display name."
              }
            }
          },
          "tags": {
            "type": "array",
            "description": "Labels used to organize the note.",
            "items": {
              "type": "string"
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/NoteMetadata"
          }
        }
      },
      "NoteMetadata": {
        "type": "object",
        "description": "Optional display information for a note.",
        "properties": {
          "source": {
            "type": "string",
            "description": "Where the note came from."
          },
          "pinned": {
            "type": "boolean",
            "description": "Whether the note stays at the top."
          }
        }
      }
    }
  }
}
