-
Notifications
You must be signed in to change notification settings - Fork 91
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
Nullable enum in query string does not generate compilable code #936
Comments
What's the impact of: @io.quarkiverse.openapi.generator.annotations.GeneratedParam("source") @jakarta.ws.rs.QueryParam("source") EnumType source Being null? |
not sure I understand the question, but: |
I must run this locally actually to see what's happening. Based on your description, I'm unsure if I'm following what's happening. Maybe my old brain is getting rusty. 😅 |
sorry. Here is some code with:
We end up with 2 methods for the client (simplified here): public io.smallrye.mutiny.Uni<String> helloGet(@jakarta.ws.rs.BeanParam Fred.FredQueryParam fred
);
public io.smallrye.mutiny.Uni<String> hiGet(@jakarta.ws.rs.QueryParam("fred") Fred fred
);
This class is not generated in the import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* Gets or Sets Fred
*/
@com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)
public enum Fred {
/**
* Special value if the API response contains some new value not declared in this enum.
* You should react accordingly.
*/
UNEXPECTED(String.valueOf("unexpected")),
BOB(String.valueOf("BOB"));
// caching enum access
private static final java.util.EnumSet<Fred> values = java.util.EnumSet.allOf(Fred.class);
private String value;
Fred(String value){
this.value = value;
}
@com.fasterxml.jackson.annotation.JsonValue
public String value() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@com.fasterxml.jackson.annotation.JsonCreator
public static Fred fromString(String text) {
for (Fred b : values) {
if (String.valueOf(b.value).equalsIgnoreCase(text)) {
return b;
}
}
return UNEXPECTED;
}
} If Thanks for your help! |
If the parameter is defined as
@QueryParam("status") status: StatusEnum
the OAS is as such:
And the generated param is
@io.quarkiverse.openapi.generator.annotations.GeneratedParam("source") @jakarta.ws.rs.QueryParam("source") EnumType source
If the parameter is defined as
@QueryParam("status") status: StatusEnum?
the OAS is as such:
And the generated param is:
@io.quarkiverse.openapi.generator.annotations.GeneratedParam("source") @jakarta.ws.rs.BeanParam EnumType.EnumTypeQueryParam source
Here, it does not compile because
EnumType.EnumTypeQueryParam
is not generated.Here is a complete yaml exposing the issue:
I tried to wrap my head around this, maybe generate a
QueryParam
class for the enum, but I failed to make sense of it. The enum is just the enum, theQueryParam
class is here to explode members of actual classes.The example yaml is generated from a quarkus project, and I feel the issue could be there and the schema is incorrect.
So I'm unsure this report is valid.
The text was updated successfully, but these errors were encountered: