acacode / acacode/swagger-typescript-api

Request body not marked as optional by default

Open
#897 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
4.1k
Forks
436
PR merge metrics
No merged PRs in 30d

Description

According to the [swagger specification](https://swagger.io/docs/specification/describing-request-body/), request bodies are optional by default, i.e. if the `required` field doesn't exist, it should be inferred as `false`.

From my limited knowledge of the code, this seems to be doing the opposite, causing any `requestBody` without the `required` parameter to be inferred as required, even though it should not be.

https://github.com/acacode/swagger-typescript-api/blob/4d48d20626407fe91bf03671260ba520ba4889a6/src/schema-routes/schema-routes.js#L626-L628

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.