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
  • #2608
Closed
Open
Issue created Apr 05, 2019 by Administrator@rootContributor0 of 2 checklist items completed0/2 checklist items

[BUG] NPE in DefaultGenerator.getOAuthMethods

Created by: kymbalon

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • [x ] Have you validated the input using an OpenAPI validator (example)?
  • [x ] What's the version of OpenAPI Generator used?
  • [x ] Have you search for related issues/PRs?
  • [x ] What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

DefaultGenerator.getOAuthMethods iterates a list of CodegenSecurity querying the Boolean (object) isOAuth without checking it for null. Maybe there are similar places in the code where Boolean variables should be double-checked (or auto-boxed).

openapi-generator version

4.0.0-beta2

OpenAPI declaration file content or url
components:
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
    BearerAuth:
      type: http
      scheme: bearer
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
    OpenID:
      type: openIdConnect
      openIdConnectUrl: https://example.com/.well-known/openid-configuration
    OAuth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://example.com/oauth/authorize
          tokenUrl: https://example.com/oauth/token
          scopes:
            read: Grants read access
            write: Grants write access
            admin: Grants access to admin operations
Command line used for generation
Steps to reproduce

API spec with at least one securityScheme which is not OAuth2.

Related issues/PRs

Other issues concerning NPEs might be related.

Suggest a fix
    for (CodegenSecurity cs : authMethods) {
        if (Boolean.TRUE.equals(cs.isOAuth)) {
            oauthMethods.add(cs);
        }
    }
Assignee
Assign to
Time tracking