Skip to content

How to refer response header in client generate api #2814

Closed

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

Activity

  1. locked and limited conversation to collaborators on Dec 3, 2021
  2. converted this issue into a discussion #2815 on Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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