Referencing Response Headers in Generated Response Schema #3177
Replies: 1 comment 3 replies
-
Yep. openapi: 3.0.0
info:
title: Example
version: 1.0.0
servers:
- url: https://example.net
paths:
/new-nonce:
head:
operationId: RetrieveNewNonce
responses:
'200':
headers:
Replay-Nonce:
$ref: '#/components/headers/ReplayNonce'
/order:
post:
operationId: OrderItem
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
nonce:
type: string
title:
type: string
responses:
'201':
headers:
Replay-Nonce:
$ref: '#/components/headers/ReplayNonce'
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponse'
components:
headers:
ReplayNonce:
schema:
type: string
schemas:
OrderResponse:
type: object
properties:
id:
type: integer
title:
type: string
The OpenAPI specification does not require implementations to support all possible content types. Most implementations desire to support |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working on an API where we're using JWS and we're intending to return a
Replay-Nonce
header in each response that we want to be able to be referenced in the generated code. Right now, we're only generating a Go client and the generated code is not providing anyway to access the header.The OpenAPI YAML we are using looks like:
We've also tried having separate request schema that we add additional code to generate a JWS that would look like:
But that naturally doesn't change anything. The generated code from this has a client struct with
(In other words, it's not returning anything other than an error)
Are we missing something? Is there syntax we're missing that would allow us to extract the value to the response struct?
Beta Was this translation helpful? Give feedback.
All reactions