Copy for AI
operationToAiText(endpoint) is a pure function (no I/O, no React) that turns a normalized endpoint into the text block behind the Copy for AI button.
operationToAiText
Defined in src/transformers/copy-for-ai.ts. Output structure: Purpose → Request → Responses → Error Responses → Validation.
Edge cases
Edge cases are handled explicitly instead of guessed:
- No
requestBody→ no Request section. - No
4xx/5xxdeclared → no Error Responses section. oneOf/anyOfschemas → annotated as(one of N possible shapes)instead of arbitrarily picking one.- Schema with no constraints → no Validation section.
- Long description with no
summary→ truncated to two sentences in Purpose.
Performance and cycles
Generation stays consistently well under 100ms (no spinner is shown), and recursive/circular DTOs are handled safely.