Bug Report Checklist
Description
For default responses, a response code of 200 is generated but should be a response code of default.
When there is a response with code 200 in the spec before the default response, then the default response "overrides" the one with the code 200 in the Swagger UI, i.e. the real 200 response description is invisible in the Swagger UI.
openapi-generator version
7.2.0-SNAPSHOT
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: example
version: 0.0.1
paths:
/pet:
post:
responses:
'default':
description: foo
content:
application/xml:
schema:
type: object
Generation Details
docker run --rm -v "${PWD}/output:/output" -v "${PWD}/openapi.yaml:/openapi.yaml" openapitools/openapi-generator-cli generate -i /openapi.yaml -g kotlin-spring -o /output
Steps to reproduce
see above
Actual output
class PetApiController() {
@Operation(
summary = "",
operationId = "petPost",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "foo", content = [Content(schema = Schema(implementation = kotlin.Any::class))]) ]
)
Expected output
class PetApiController() {
@Operation(
summary = "",
operationId = "petPost",
description = """""",
responses = [
ApiResponse(responseCode = "default", description = "foo", content = [Content(schema = Schema(implementation = kotlin.Any::class))]) ]
)
Related issues/PRs
Suggest a fix
Should maybe be done similar to the PR referenced in #14394 .
There is also suspicious code in
|
if ("0".equals(resp.code)) { |
.
Bug Report Checklist
Description
For default responses, a response code of 200 is generated but should be a response code of
default.When there is a response with code 200 in the spec before the default response, then the default response "overrides" the one with the code 200 in the Swagger UI, i.e. the real 200 response description is invisible in the Swagger UI.
openapi-generator version
7.2.0-SNAPSHOT
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
see above
Actual output
Expected output
Related issues/PRs
Suggest a fix
Should maybe be done similar to the PR referenced in #14394 .
There is also suspicious code in
openapi-generator/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java
Line 877 in 457622c