wowprompt

OpenAPI specification from existing endpoint code

Reads route handlers and request validation code and writes an OpenAPI 3.1 YAML file with paths, parameters, request bodies, response schemas, error responses and examples. Use it to document an API that grew without docs, or to generate client SDKs and a test collection from it.

An OpenAPI 3.1 YAML file generated from route code with paths, schemas, error responses and examples, plus a list of gaps found
The output this prompt produced, unedited.

The prompt

Fill in these first

  • Framework: [e.g. Laravel, Express, Django REST framework, Spring Boot]
  • Route definitions: [paste]
  • Handlers and validation rules for each route: [paste]
  • Authentication method: [e.g. bearer token, API key header, session cookie]
  • Base URL placeholder: [e.g. https://api.example.com/v1]
  • Error response shape used today: [paste one example]

Task

Write an OpenAPI 3.1 document that matches the code exactly as it behaves now.

Output format

  1. One YAML code block: info, servers, security schemes, paths, and shared schemas under components.
  2. For each operation: summary, operationId, parameters, request body, success response, and every error the code can return.
  3. One realistic example for each request and response body.
  4. A gap list: | Route | What the code does that is unclear | Question for the team |

Rules

  • Describe only what the code does; never add endpoints or fields that are not there.
  • Reuse schemas through references instead of repeating them.
  • Mark fields required only when validation enforces it.
  • Mark any inferred type with a short description saying it was inferred.
openapi specificationswagger docsapi documentationopenapi yamlrest api docsapi schema

How to run this

Copy the prompt and paste it into Gemini, then set the aspect ratio to 3:4. No reference photo is needed for this one.

The prompt is written in Markdown with each part under its own heading, which is what the copy action hands over. Change one section at a time, keeping the rest intact, so you can tell which change did the work.

Related prompts

All productivity