Skip to content

How to refer response header in client generate api #2814

@Radha-rog

Description

@Radha-rog

I have defined the swagger in order to get the authorization token from the response header which can be used for next api call. However when I generate the client code out of swagger, it return only response body and not the header. I Have tried all the search but nothing was helpful.

Part of the swagger definition,

/token':
post:
tags:
- Token
parameters:
- $ref: '#/components/parameters/Authorization'
description: Used to generate token to call other api
operationId: generateToken
responses:
'200':
description: OK
content:
Application/Json:
schema:
type: array
items:
$ref: '#/components/schemas/XYZ'
headers:
authorization:
schema:
type: string

components:
parameters:
Authorization:
in: header
name: Authorization
description: Bearer token to access the one view API's.
schema:
type: string
required: true

Client Api generate: ( the method body doesnt have any code for response header"
public CompletableFuture<List> generateToken (String authorization) throws ApiException {
....
...}

If you could provide any insight that would be more helpfull

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions