Skip to content

[Java][okhttp-gson] Bug when specifying grant-type (flow) for OAuth token retry #1181

Description

@Kiran-Sivakumar
Description

The okhttp-gson Java library has support for automatic OAuth access token retry. The grant-type use for this functionality is specified using the "flow" value provided in the OpenAPI specification. However, the way in which this is performed (using the Java enum valueOf method) results in an IllegalArgumentException being thrown. This is because "flow" values do not correspond 1-to-1 to the GrantType enum values.

openapi-generator version

3.3.0

OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

I plan on submitting a PR myself by implementing a solution very similar to the one used in the retrofit2 library: https://github.com/OpenAPITools/openapi-generator/blob/69d956f16b6c18d6282b5bd0d408505cf1adb56a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/auth/OAuth.mustache

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions