Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating a client with useAuth = true with Kotlin causes Unresolved reference: defaultTokenPropagator #1665

Closed
scprek opened this issue Jul 31, 2024 · 1 comment · Fixed by #1666

Comments

@scprek
Copy link
Contributor

scprek commented Jul 31, 2024

Expected Behavior

I expect Open API Client generation in Kotlin language to compile out of the box. Instead I get an error.
Java Language has no compiler error

I saw this related issue and am past this problem #1623

Documentation Question

Moved here: micronaut-projects/micronaut-gradle-plugin#1020

Is there any documentation on which micronaut.security things are needed? I Don't use oauth2, but it appears i MUST add it implementation(mn.micronaut.security.oauth2) to compile.

Actual Behaviour

Generates API with @Authorization

@Get("/test")
@Authorization(value = "v7JwtAuth")
fun get(): Mono<TestOutputDTO>

but then this in the `AuthorizationFilter::getTokenPropagator(name: String)

build/generated/openapi/generateClientOpenApiApis/src/main/kotlin/org/openapitools/auth/AuthorizationFilter.kt:112:29 Unresolved reference: defaultTokenPropagator
Screenshot 2024-07-31 at 11 52 10 AM

Steps To Reproduce

micronaut {
    openapi {
        client(file("src/openapi/xxx.yaml")) {
        lang.set("kotlin")
       useAuth.set(true)
        }
}

OpenAPI Spec doesn't even need any securitySchemes or security sections to hit this error

But for sake of example

  securitySchemes:
    v7JwtAuth:
      type: http
      description: '`Bearer {TOKEN_HERE}`'
      scheme: bearer
security:
  -
    v7JwtAuth: []

Environment Information

micronautGradlePlugin=4.4.2
kotlinVersion=1.9.23

Example Application

#1666

Version

4.5.1

@scprek scprek changed the title Generating a clieht with useAuth = true with Kotlin causes Unresolved reference: defaultTokenPropagator Generating a client with useAuth = true with Kotlin causes Unresolved reference: defaultTokenPropagator Jul 31, 2024
@scprek
Copy link
Contributor Author

scprek commented Jul 31, 2024

This was fixed actually in 67d070c#diff-7cfb23613bf087752f599c9d16a611129cea5cf45fbe23f22bafe3e0d6cbd750L35

But I'll open a PR to add Auth based tests as they appear to be missing

@scprek scprek closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant