Bug Report Checklist
Description
openapi-generator version
latest
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: test
description: examples
version: 1.0.0
servers:
- url: 'https'
paths:
/users/{id}:
get:
operationId: getUser
parameters:
- name: id
in: path
required: true
schema:
type: integer
responses:
"200":
description: User found
content:
application/json:
schema:
$ref: '#/components/schemas/UserResponse'
"400":
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
UserResponse:
properties:
name:
type: string
ErrorResponse:
properties:
feilmelding:
type: string
Generates
@Validated
interface DefaultApi {
@HttpExchange(
// "/users/{id}"
url = PATH_GET_USER,
method = "GET"
)
fun getUser(
@Parameter(description = "", required = true) @PathVariable("id") id: kotlin.Int
): ResponseEntity<UserResponse>
companion object {
//for your own safety never directly reuse these path definitions in tests
const val BASE_PATH: String = ""
const val PATH_GET_USER: String = "/users/{id}"
}
}
package no.test.examples.models
/**
* Sealed interface for all possible responses from getUser
*/
sealed interface GetUserResponse
data class UserResponse(
@Schema(example = "null", description = "")
@get:JsonProperty("name") val name: kotlin.String? = null
) : GetUserResponse {
}
ResponseType should be GetUserResponse, not UserResponse
Suggest a fix
I'll make a pr
Bug Report Checklist
Description
openapi-generator version
latest
OpenAPI declaration file content or url
Generates
ResponseType should be GetUserResponse, not UserResponse
Suggest a fix
I'll make a pr