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

AliasFor from custom TypeElementVisitor is not visible to other visitors #4983

Closed
3 of 4 tasks
asodja opened this issue Feb 23, 2021 · 1 comment
Closed
3 of 4 tasks
Labels
type: bug Something isn't working

Comments

@asodja
Copy link
Contributor

asodja commented Feb 23, 2021

When mapping annotations with custom TypeElementVisitor AliasFor annotations are not seen to other Visitors.

For example JaxRsTypeElementVisitor maps @javax.ws.rs.Path to @Controller. @Controller has AliasFor(annotation = UriMapping.class, member = "value"). But this UriMapping is then not visible to OpenAPI Visitor. Example project is provided in https://github.com/asodja/micronaut-type-visitor-issue.

In example we have TestController.java:

  • with @Path("/user") on class
  • with @Path("/{userId}") on method

After running ./gradlew compileJava Swagger yaml has path as /{userId} instead of /user/{userId}.

This can be fixed in OpenAPI with:
asodja/micronaut-openapi@3d69c56.
From this fix it seems that @Controller is correctly applied by JaxRsTypeElementVisitor but UriMapping is not accesible. So this looks to me like it is micronaut-core issue.

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. git clone git@github.com:asodja/micronaut-type-visitor-issue.git
  2. ./gradlew compileJava
  3. cat ./build/classes/java/main/META-INF/swagger/demo-0.0.yml

Expected Behaviour

Swagger yaml contains path /user/{userId}

Actual Behaviour

Swagger yaml contains path /{userId}

Environment Information

  • Operating System: MacOS
  • Micronaut Version: 2.3.3
  • JDK Version: 1.8

Example Application

https://github.com/asodja/micronaut-type-visitor-issue

@altro3
Copy link
Contributor

altro3 commented Feb 18, 2024

sdelamo added a commit to micronaut-projects/micronaut-openapi that referenced this issue Feb 20, 2024
sdelamo added a commit to micronaut-projects/micronaut-openapi that referenced this issue Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants