Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8990
Closed
Open
Issue created Mar 17, 2021 by Administrator@rootContributor

[BUG][cpp-restsdk]How to define login API to return cookie from response header for cpp-restsdk generator

Created by: himadree-shekhar

Description

I want to write a API for login request. If the login request is successful then it API should return the cookie from the response header.

openapi-generator version 5.0.1
OpenAPI declaration file content or url
/api/v1/user/login:
    post:
      tags:
        - login/logout
      summary: Login as a user.
      description: Send login request
      operationId: loginUser
      requestBody:
        description: Send login credentials.
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:               
                username:
                  type: string
                password:
                  type: string                
              required:               
                - username
                - password
              example:                
                username: usr
                password: '123'
      responses:
        '200':
          description: returns cookie from header.          
          content:
            text/html:
              schema:
                type: string
tags:
  - name: login/logout
    description: 'login, logout operations'

Generated Code: The generated API function, it only returns the HTTP body instead of the extracting cookie from the header: return localVarResponse.extract_string(); So, How can we get the cookie.

Generation Details

npx openapi-generator-cli generate -g cpp-restsdk -i test.yaml -o ./cpp

Steps to reproduce
Related issues/PRs
Suggest a fix
Assignee
Assign to
Time tracking