fix(openapi): document arrayBuffer bodies#341
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR fixes the empty ChangesBinary Request Body Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/openapi.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. test/openapi/to-openapi-schema.test.tsESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes elysiajs/elysia#1825
Problem
Routes using
parse: "arrayBuffer"with a body schema produced an OpenAPI request body with an emptycontentobject:{ "requestBody": { "content": {} } }That makes OpenAPI clients infer the request body as missing or
undefined.Fix
Map
arrayBufferrequest parsers toapplication/octet-streamwhen generating request body content. The same mapping is also used when the parser is already declared asapplication/octet-stream.Tests
Added a regression in
test/openapi/to-openapi-schema.test.tsfor:parse: "arrayBuffer"requestBody.content["application/octet-stream"]Verification run:
bun test test/openapi/to-openapi-schema.test.tsgit diff --checkbun run buildPATH="$PWD/node_modules/.bin:$PATH" bun run testSummary by CodeRabbit
New Features
Tests