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

Fix hibernate-reactive-rest-data-panache when adding smallrye openapi #26074

Merged
merged 1 commit into from Jun 13, 2022

Conversation

Sgitario
Copy link
Contributor

This pull request will generate the rest data methods using the method signature that allows to use parameterized types.

Fix #25990

This pull request will generate the rest data methods using the method signature that allows to use parameterized types. 

Fix quarkusio#25990
import io.quarkus.gizmo.DescriptorUtils;
import io.quarkus.gizmo.MethodCreator;

public final class SignatureMethodCreator {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking: we don't already have something like this in Panache, do we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find something similar in Panache.
We could move it to the gizmo extension or even be part of the ClassCreator API. From my point of view, this is a good candidate for doing it in a second iteration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed!

@geoand geoand merged commit d58e793 into quarkusio:main Jun 13, 2022
@quarkus-bot quarkus-bot bot added this to the 2.11 - main milestone Jun 13, 2022
@Sgitario Sgitario deleted the panache_uni_param_new branch June 13, 2022 07:32
@gsmet gsmet modified the milestones: 2.11 - main, 2.10.0.Final Jun 13, 2022
Sgitario added a commit to Sgitario/gizmo that referenced this pull request Jun 15, 2022
This pull request handles the support of parameterized types when creating methods. Example:
```java
public List<String> methodName() {
}
```

Where `List<String>` is a parameterized type. 

In order to do this, we need to amend the `signature` of the method as the descriptor does not support it (it says class not found when trying to declare `Ljava.util.List<Ljava.lang.String;>;`). 

In order to resolve this, we have added a wrapper type `ParameterizedClass` where we can specify the wrapper type and the param types. Usage:

```
MethodCreator method = creator.getMethodCreator("methodName", new ParameterizedClass(List.class, String.class));
```

This pull request partially resolves: quarkusio#66 (which is intended to be for classes too)
Moreover, these changes are inspired by the changes in quarkusio/quarkus#26074 (that there will be deprecated once gizmo dependency is bumped).

I've verified these changes in Quarkus upstream too (reverting the changes of the mentioned Quarkus pull request) and it worked fine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reactive-rest-data not compliant with openapi
3 participants