Forum Discussion

rhanda's avatar
New Contributor
9 months ago

Not able to generate Swagger/OpenAPI for a request having RequestBody as protobuf.Message

Hello Community,


I'm working on a project which uses Kotlin and Springboot and we want to document our API using Swagger/OpenAPI.

One of the endpoint is used as both GRPC and HTTPS. The requestBody in it of type 
We have added custom decoders to parse the JSON to Message object using


We are using springdoc-openapi-webflux-ui for Swagger/OpenAPI ui and the problem that it is not able to generate example request body for the above API and it gets stuck.

What would be the best approach to solve it?

How to add custom decoders?

Can we use the custom decoder to define the schema used in Swagger? I'm referring to the schema present in /v3/api-docs, like 

"requestBody": {
 "content": {
    "application/json": {
        "schema": {
            "$ref": "#/components/schemas/ValidateRequest"



Example api:

value = ["/validate"],
produces = [MediaType.APPLICATION_JSON_VALUE],
consumes = [MediaType.APPLICATION_JSON_VALUE],
suspend fun sendOTPObject(
@RequestBody requestBody: ValidateRequest,
ğŸ˜ž ResponseEntity<ValidateRequest> {

    return ResponseEntity.ok(requestBody)