Swagger not showing requestBody for POST/PUT with Scalar in Nuxt
Hi everyone,
I’m using Scalar with a Nuxt 4 project to generate Swagger docs. My issue is that requestBody does not appear in Swagger UI for POST and PUT endpoints, even though I’ve added it in the @openapi comments. I found that I can solve this by using defineRouteMeta in the API handler, but I’m wondering: is there another way to make Scalar recognize requestBody directly from the @openapi comments?
Thanks in advance!
2 Replies
Hi @Umut. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry, but the knowledge sources provided do not contain specific information about integrating Scalar with Nuxt 4 or how Scalar parses @openapi comments to generate Swagger documentation, especially regarding the requestBody for POST/PUT endpoints. The sources do cover how to define API routes and handle request bodies in Nuxt (using files like
server/api/submit.post.ts and readBody(event)), but they do not mention Scalar or its behavior with Swagger docs or @openapi comments in Nuxt projects Nuxt server directory structure.
If you have found that using defineRouteMeta in the API handler works, that may be a workaround, but there is no documentation in the provided sources about alternative ways to make Scalar recognize the requestBody directly from comments.
If you need more detailed guidance, you may want to consult Scalar's own documentation or open an issue in their repository for clarification on this integration.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@122082347326767107> Kapa.ai is still learning and improving, please let me know how I did by reacting below.