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

Bug Report: OpenAPI @Parameter(... explode = Explode.???) gives stacktrace/FISH-5798 #5436

Open
mb-dbc-dk opened this issue Oct 6, 2021 · 1 comment
Assignees
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev

Comments

@mb-dbc-dk
Copy link

When writing OpenAPI documentation and a repeated query-parameter is wanted OpenAPI generation fails.

Using

@Parameter(name = "name", description = "The name(s)", required = false,
                   schema = @Schema(type = SchemaType.ARRAY, implementation = String.class),
                   explode = Explode.TRUE)

to describe a repeated parameter (ie. ?name=a&name=b&name=c). A valid openapi yaml is expected on /openapi

Expected Outcome

Status 200 from /openapi

Current Outcome

Status 500 from /openapi and this stacktrace:

StandardWrapperValve[microprofile-openapi-servlet]: Servlet.service() for servlet microprofile-openapi-servlet threw exception
java.lang.ClassCastException: class org.glassfish.hk2.classmodel.reflect.impl.EnumModelImpl cannot be cast to class java.lang.Boolean (org.glassfish.hk2.classmodel.reflect.impl.EnumModelImpl is in unnamed module of loader fish.payara.micro.boot.loader.ExplodedURLClassloader @7699a589; java.lang.Boolean is in module java.base of loader 'bootstrap')
	at fish.payara.microprofile.openapi.impl.model.parameters.ParameterImpl.createInstance(ParameterImpl.java:102)
	at fish.payara.microprofile.openapi.impl.processor.ApplicationProcessor.visitParameters(ApplicationProcessor.java:949)
	at fish.payara.microprofile.openapi.impl.visitor.OpenApiWalker.processAnnotation(OpenApiWalker.java:172)
	at fish.payara.microprofile.openapi.impl.visitor.OpenApiWalker.processAnnotation(OpenApiWalker.java:136)
	at fish.payara.microprofile.openapi.impl.visitor.OpenApiWalker.accept(OpenApiWalker.java:124)
...

Steps to reproduce

Environment

  • Distribution: payara-micro-5.2021.7.jar
  • JDK Version: openjdk version "11.0.12" 2021-07-20 / OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2deb10u1)
  • Operating System: Linux

Culprit?

But annotation is from:

@Target({ ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(Parameters.class)
@Inherited
public @interface Parameter {
...
     * @return whether or not to expand individual array members
     **/
    Explode explode() default Explode.DEFAULT;

...

So I would expect something about EnumModel.class like the parameter "in", instead of Boolean.class.

@mb-dbc-dk mb-dbc-dk added Status: Open Issue has been triaged by the front-line engineers and is being worked on verification Type: Bug Label issue as a bug defect labels Oct 6, 2021
@shub8968 shub8968 self-assigned this Oct 11, 2021
@shub8968
Copy link
Contributor

Hi, @mb-dbc-dk. I am able to reproduce this issue. I have raised an internal issue with JIRA FISH-5978. Thanks. It may take a while to fix the issue. You are free to submit a PR to fix this issue if you feel confident to do so.

@shub8968 shub8968 added Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev and removed Status: Open Issue has been triaged by the front-line engineers and is being worked on verification Type: Bug Label issue as a bug defect labels Oct 12, 2021
@shub8968 shub8968 changed the title Bug Report: OpenAPI @Parameter(... explode = Explode.???) gives stacktrace Bug Report: OpenAPI @Parameter(... explode = Explode.???) gives stacktrace\FISH-5978 Oct 12, 2021
@shub8968 shub8968 changed the title Bug Report: OpenAPI @Parameter(... explode = Explode.???) gives stacktrace\FISH-5978 Bug Report: OpenAPI @Parameter(... explode = Explode.???) gives stacktrace/FISH-5978 Oct 12, 2021
@shub8968 shub8968 changed the title Bug Report: OpenAPI @Parameter(... explode = Explode.???) gives stacktrace/FISH-5978 Bug Report: OpenAPI @Parameter(... explode = Explode.???) gives stacktrace/FISH-5798 Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev
Projects
None yet
Development

No branches or pull requests

2 participants