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
  • #7193
Closed
Open
Issue created Aug 13, 2020 by Administrator@rootContributor

[BUG] Oauth flows are not generated when there is more than 1

Created by: bilak

Description

When working with multiple oauth flows in definition and then using some kind of templates to use those flows, only first flow that is found is used. Problem is in DefaultCodegen where it's not iterated through all flows, but just first flow is taken.

openapi-generator version

4.2.3

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  title: test api
  version: 0.0.1
paths:
  /imports:
    post:
      summary: Creates import
      operationId: createImport
      responses:
        201:
          description: created
      security:
        - oauth_auth:
            - import:create
  /imports/{importId}/state:
    put:
      summary: Changes import state
      operationId: changeImportState
      parameters:
        - name: importId
          in: path
          required: true
          schema:
            type: string
      responses:
        200:
          description: State changed
      security:
        - oauht_auth:
            - import:process
components:
  securitySchemes:
    oauth_auth:
      type: oauth2
      flows:
        password:
          tokenUrl: "../auth/realms/master/protocol/openid-connect/token"
          scopes:
            import:create: create import
        clientCredentials:
          tokenUrl: "../auth/realms/master/protocol/openid-connect/token"
          scopes:
            import:create: create import
            import:process: process import
Suggest a fix

Loop inside method DefaultCodegen#fromSecurity also through all flows and then they should be generated.

Assignee
Assign to
Time tracking