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
We're using Swagger annotations and Maven plugin to generate our spec. I'm attempting to add some @ApiResponse annotations to our operations, but the @Header annotation is not including the schema.type. For instance:
@Operation(summary = "List of services for the given account",
responses = {
@ApiResponse(responseCode = "200", description = "List of services for the given account"),
@ApiResponse(description = "User did not provide a valid auth token", responseCode = "401",
content = @Content(mediaType = MediaType.APPLICATION_JSON,
schema = @Schema(implementation = ErrorMessage.class)),
headers = { @Header(name = "testing-headers",
description = "Flow/trace ID for traceability in the logs",
schema = @Schema(type = "string")) })
})
This generates the following spec:
get:
operationId: getServicesparameters:
- in: pathname: accountIdrequired: trueschema:
type:
- stringresponses:
"200":
description: List of services for the given account"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'description: User did not provide a valid auth tokenheaders:
testing-headers:
description: Flow/trace ID for traceability in the logsschema: {} # <- no `type: string` nested here style: simple # <- not sure where this is coming fromsummary: List of services for the given account
Even if I add something like format to the @Schema:
headers = { @Header(name = "testing-headers",
description = "Flow/trace ID for traceability in the logs",
schema = @Schema(type = "string", format = "hexadecimal")) })
testing-headers:
description: Flow/trace ID for traceability in the logsschema:
format: hexadecimal# still no typestyle: simple
(Note that the motivation for adding the schema/type to the header is that linting tools complain about content/schema being required)
The text was updated successfully, but these errors were encountered:
Hi @emcintyre-hpe could you share more details about your problem (e.g sample project), I tried to reproduce this bug, used exactly same annotations that you provided and schema type appears. Closing this ticket, feel free to reopen if issue still appears for you.
parameters:
- name: accountIdin: pathrequired: trueschema:
type: stringresponses:
"200":
description: List of services for the given account"401":
description: User did not provide a valid auth tokenheaders:
testing-headers:
description: Flow/trace ID for traceability in the logsstyle: simpleschema:
type: stringcontent:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
Hello,
We're using Swagger annotations and Maven plugin to generate our spec. I'm attempting to add some
@ApiResponse
annotations to our operations, but the@Header
annotation is not including theschema.type
. For instance:This generates the following spec:
Even if I add something like
format
to the@Schema
:(Note that the motivation for adding the schema/type to the header is that linting tools complain about content/schema being required)
The text was updated successfully, but these errors were encountered: