Skip to content

fix: allow generating GET and POST openapi spec#159

Merged
razor-x merged 4 commits intomainfrom
generate-post-get
Jun 18, 2025
Merged

fix: allow generating GET and POST openapi spec#159
razor-x merged 4 commits intomainfrom
generate-post-get

Conversation

@mikewuu
Copy link
Copy Markdown
Contributor

@mikewuu mikewuu commented Jun 18, 2025

Closes #115

Pretty much the title, previously generating the OpenAPI json would ignore GET if POST was defined as well. Now it generates both (and DELETE too).

Main change was to remove the filter at https://github.com/seamapi/nextlove/pull/159/files#diff-3f2c0f6d81a28b504bad9f4790e395fdf0d3fd6dd3fe8848371b3499e243abd1L179

CleanShot 2025-06-19 at 07 16 41@2x

But because request body and query definitions were checked at the route level and not the method level, this resulted in the generated spec to be wrong. i.e. generating a requestBody for GET and not a parameters.

The fix was to create a loop per method, and move the body and query defs in there instead. Looks like lots of changes, but it's just moving nesting: https://github.com/seamapi/nextlove/pull/159/files#diff-3f2c0f6d81a28b504bad9f4790e395fdf0d3fd6dd3fe8848371b3499e243abd1R213

This test asserts that each generated method looks right

@mikewuu mikewuu requested a review from razor-x June 18, 2025 22:20
@razor-x razor-x merged commit f0a61a8 into main Jun 18, 2025
4 checks passed
github-actions bot pushed a commit that referenced this pull request Jun 18, 2025
## [2.17.3](v2.17.2...v2.17.3) (2025-06-18)

### Bug Fixes

* allow generating GET and POST openapi spec ([#159](#159)) ([f0a61a8](f0a61a8))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants