-
Notifications
You must be signed in to change notification settings - Fork 96
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
Update HelloController.kt #1491
Closed
adrianofsp
wants to merge
1
commit into
micronaut-projects:master
from
ferreiraad:adriano/fix-kotlin-swagger-annotation
Closed
Update HelloController.kt #1491
adrianofsp
wants to merge
1
commit into
micronaut-projects:master
from
ferreiraad:adriano/fix-kotlin-swagger-annotation
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fix missing annotation parameter name identifier.
With KSP it is work fine. It's strange why the library works correctly and the compiler doesn't complain.... But I think this solution will be better: BEFORE: @Get(uri = "/greetings/{name}", produces = [MediaType.TEXT_PLAIN])
@Operation(summary = "Greets a person", description = "A friendly greeting is returned")
// Please Note: Repeatable Annotations with non-SOURCE retentions are not yet supported with Kotlin, so we are using `@ApiResponses`
// instead of `@ApiResponse`, see https://youtrack.jetbrains.com/issue/KT-12794
@ApiResponses(
ApiResponse(content = [Content(mediaType = "text/plain", schema = Schema(type = "string"))]),
ApiResponse(responseCode = "400", description = "Invalid Name Supplied"),
ApiResponse(responseCode = "404", description = "Person not found")
)
@Tag(name = "greeting")
open fun greetings(name: String): Mono<String> {
return Mono.just("Hello $name, how are you doing?")
} AFTER: @Tag(name = "greeting")
@Operation(summary = "Greets a person", description = "A friendly greeting is returned")
@ApiResponse(content = [Content(mediaType = "text/plain", schema = Schema(type = "string"))])
@ApiResponse(responseCode = "400", description = "Invalid Name Supplied")
@ApiResponse(responseCode = "404", description = "Person not found")
@Get(uri = "/greetings/{name}", produces = [MediaType.TEXT_PLAIN])
open fun greetings(name: String): Mono<String> {
return Mono.just("Hello $name, how are you doing?")
} Need to remove comment about @adrianofsp WDYT? |
Hi,
It’s true the compiler does not complain and it works.
I forgot to include one dependency on the build.
Thanks
El El jue, 21 mar 2024 a las 5:54, altro3 ***@***.***>
escribió:
… With KSP it is work fine. It's strange why the library works correctly and
the compiler doesn't complain....
default.png (view on web)
<https://github.com/micronaut-projects/micronaut-openapi/assets/48474279/04acb9e5-523c-46c0-aad4-7e0e84a34ea2>
default.png (view on web)
<https://github.com/micronaut-projects/micronaut-openapi/assets/48474279/dc81e26b-cfcd-4261-9a0f-ca5971f79ab7>
But I think this solution will be better:
BEFORE:
@get(uri = "/greetings/{name}", produces = [MediaType.TEXT_PLAIN])
@operation(summary = "Greets a person", description = "A friendly greeting is returned")
// Please Note: Repeatable Annotations with non-SOURCE retentions are not yet supported with Kotlin, so we are using ***@***.***`
// instead of ***@***.***`, see https://youtrack.jetbrains.com/issue/KT-12794
@ApiResponses(
ApiResponse(content = [Content(mediaType = "text/plain", schema = Schema(type = "string"))]),
ApiResponse(responseCode = "400", description = "Invalid Name Supplied"),
ApiResponse(responseCode = "404", description = "Person not found")
)
@tag(name = "greeting")
open fun greetings(name: String): Mono<String> {
return Mono.just("Hello $name, how are you doing?")
}
AFTER:
@tag(name = "greeting")
@operation(summary = "Greets a person", description = "A friendly greeting is returned")
@ApiResponse(content = [Content(mediaType = "text/plain", schema = Schema(type = "string"))])
@ApiResponse(responseCode = "400", description = "Invalid Name Supplied")
@ApiResponse(responseCode = "404", description = "Person not found")
@get(uri = "/greetings/{name}", produces = [MediaType.TEXT_PLAIN])
open fun greetings(name: String): Mono<String> {
return Mono.just("Hello $name, how are you doing?")
}
Need to remove comment about https://youtrack.jetbrains.com/issue/KT-12794
- it's already fixed
@adrianofsp <https://github.com/adrianofsp> WDYT?
—
Reply to this email directly, view it on GitHub
<#1491 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAK42DUE4S7Z6HVU4WGHKVDYZJRWZAVCNFSM6AAAAABFAQRGQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJRGIYTMNJSG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Ok, I fixed this example here #1492 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix missing annotation parameter name identifier.