OpenAPITools / OpenAPITools/openapi-generator

[BUG] Using custom grant types doesn't work

Open
#12,296 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)? The online validator is also broken
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
Description

According to the oauth2 spec the list of grant types are non-exhaustive and you can add your own grant types.

https://datatracker.ietf.org/doc/html/rfc6749#section-8.3

However, when I supply our custom grant type the tool thinks the openapi file is invalid:

-attribute components.securitySchemes.OAuth2.<redacted> is unexpected
openapi-generator version
<openapi.generator.maven.plugin.version>5.3.0</openapi.generator.maven.plugin.version>
OpenAPI declaration file content or url
components:
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        <redacted>:
Steps to reproduce
  • Run generator with above openapi yaml.
Suggest a fix
  • Allow custom grant types
Workaround

I can work around it right now by disabling the validator, but it would be greater if I could disable only this check.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the validation failure with the provided OpenAPI YAML and inspect how components.securitySchemes OAuth2 flows are validated. Confirm that a non-standard grant type is accepted without disabling all validation, then add or update a focused regression test for the custom grant type case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.