You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the OpenAPI Generator plugin for server stub generation based on a Swagger 2.0 specification. I’ve encountered an issue where the generated code contains an unwanted "result" value in the produces attribute of the @RequestMapping annotation in the Spring Boot server stub.
Issue:
In the generated code, I have the following @RequestMapping annotation:
As you can see, the produces attribute includes "result" as a media type, which should not be there. The produces attribute is intended to specify valid media types (like "application/json", "application/xml", etc.), but "result" seems to have been mistakenly added.
Reviewed the Swagger Spec: I've checked my Swagger 2.0 spec, and there's no reason for "result" to be in the produces field. The spec only defines response data, not media types like "result".
Checked the Generated Code: The produces field in the generated @RequestMapping annotation is incorrectly including "result".
Looked at the OpenAPI Generator Templates: I haven’t customized the templates yet, but I’m wondering if this might be necessary.
My Question:
Why is OpenAPI Generator adding "result" as a value in the produces attribute of the @RequestMapping annotation? Could it be related to the way the response body is defined in the Swagger 2.0 spec?
How can I fix this issue so that only the correct media types (like "application/json") appear in the produces field, and "result" is not added?
Should I customize the OpenAPI Generator templates to prevent this from happening, and if so, how would I do that?
Any guidance or solutions would be greatly appreciated!
The text was updated successfully, but these errors were encountered:
I'm using the OpenAPI Generator plugin for server stub generation based on a Swagger 2.0 specification. I’ve encountered an issue where the generated code contains an unwanted
"result"
value in theproduces
attribute of the@RequestMapping
annotation in the Spring Boot server stub.Issue:
In the generated code, I have the following
@RequestMapping
annotation:As you can see, the
produces
attribute includes"result"
as a media type, which should not be there. Theproduces
attribute is intended to specify valid media types (like"application/json"
,"application/xml"
, etc.), but"result"
seems to have been mistakenly added.Example Swagger Spec (relevant part):
What I've Tried:
"result"
to be in theproduces
field. The spec only defines response data, not media types like"result"
.produces
field in the generated@RequestMapping
annotation is incorrectly including"result"
.My Question:
"result"
as a value in theproduces
attribute of the@RequestMapping
annotation? Could it be related to the way the response body is defined in the Swagger 2.0 spec?"application/json"
) appear in theproduces
field, and"result"
is not added?Any guidance or solutions would be greatly appreciated!
The text was updated successfully, but these errors were encountered: