mnahkies / mnahkies/openapi-code-generator
add support for multiple request body types
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 34
- Forks
- 8
- Avg merge
- 20h 27m
- Merged PRs (30d)
- 7
Description
It's possible to declare different request bodies for different content types.
Currently we simply use the first one that we find: https://github.com/mnahkies/openapi-code-generator/blob/1ffdc52f8c2b5358d59346c0eb54032a0708b4b5/packages/openapi-code-generator/src/typescript/common/typescript-common.ts#L95-L109
At a minimum we should support:
multipart/form-dataapplication/octet-streamtext/plain
Ideally we'd additionally support XML, but that might be left for it's own issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/openapi-code-generator/src/typescript/common/typescript-common.ts at lines 95-109, where the first request body is selected. Trace how request bodies are represented and generated, then account for multipart/form-data, application/octet-stream, and text/plain instead of only the first body; XML is explicitly optional for a separate issue. Done means these listed content types can be declared and generated correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100