Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add empty response body support #43

Merged
merged 2 commits into from
Jan 26, 2025

Conversation

AlbRoehm
Copy link
Contributor

@AlbRoehm AlbRoehm commented Jan 24, 2025

When using the the Nothing type in a @KtorResponds([ResponseEntry("204", Nothing::class)]) annotation a empty response body will be created in the openapi spec.

It looked pretty straight forward so i gave it a try ... it's kinda late so i might have overlooked some stuff :)

@AlbRoehm AlbRoehm force-pushed the add-support-for-empty-response branch from b767364 to 87c2e44 Compare January 24, 2025 23:28
@AlbRoehm AlbRoehm force-pushed the add-support-for-empty-response branch from 87c2e44 to 2e88a3d Compare January 25, 2025 14:28
@@ -25,6 +25,7 @@ internal fun OpenApiSpec.serializeAndWriteTo(configuration: PluginConfiguration)
val sorted = new.copy(
components = new.components.copy(
schemas = new.components.schemas.toSortedMap()
.filter { (key, value) -> key != "kotlin.Nothing" }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, instead of filtering at the sorting site, we could do it inside convertInternalToOpenSpec where other sanitization is already performed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes definitely a better place to put it there. I guess that was just the first option that "worked"...

@tabilzad tabilzad merged commit a32f634 into tabilzad:master Jan 26, 2025
1 check passed
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