You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
My use case is that I'd like to hide certain operation parameters based on an annotation and an environment specific condition. I've successfully done this with OperationCustomizer and PropertyCustomizer without any issues but unfortunately in case of ParameterCustomizer this results in a NullPointerException.
Describe the solution you'd like ParameterCustomizer to support returning null values and omit the parameter from the OpenAPI JSON if customizer returns null
Describe alternatives you've considered
I considered setting some property with a specific value in Parameter and later filter it out in the OperationCustomizer. This works but a bit ugly.
Caused by: java.lang.NullPointerException: Cannot invoke "io.swagger.v3.oas.models.parameters.Parameter.getName()" because "parameter" is null
at org.springdoc.core.models.ParameterId.<init>(ParameterId.java:57)
at java.base/java.util.stream.Collectors.lambda$toMap$68(Collectors.java:1673)
at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at org.springdoc.core.service.AbstractRequestService.getParameterLinkedHashMap(AbstractRequestService.java:388)
at org.springdoc.core.service.AbstractRequestService.build(AbstractRequestService.java:351)
at org.springdoc.api.AbstractOpenApiResource.calculatePath(AbstractOpenApiResource.java:496)
at org.springdoc.api.AbstractOpenApiResource.calculatePath(AbstractOpenApiResource.java:676)
at org.springdoc.webmvc.api.OpenApiResource.lambda$calculatePath$11(OpenApiResource.java:219)
at java.base/java.util.Optional.ifPresent(Optional.java:178)
at org.springdoc.webmvc.api.OpenApiResource.calculatePath(OpenApiResource.java:200)
at org.springdoc.webmvc.api.OpenApiResource.lambda$getPaths$2(OpenApiResource.java:170)
at java.base/java.util.Optional.ifPresent(Optional.java:178)
at org.springdoc.webmvc.api.OpenApiResource.getPaths(OpenApiResource.java:149)
at org.springdoc.api.AbstractOpenApiResource.getOpenApi(AbstractOpenApiResource.java:353)
at org.springdoc.webmvc.api.OpenApiResource.openapiJson(OpenApiResource.java:124)
at org.springdoc.webmvc.api.OpenApiWebMvcResource.openapiJson(OpenApiWebMvcResource.java:114)
at org.springdoc.webmvc.api.MultipleOpenApiWebMvcResource.openapiJson(MultipleOpenApiWebMvcResource.java:95)
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
My use case is that I'd like to hide certain operation parameters based on an annotation and an environment specific condition. I've successfully done this with
OperationCustomizer
andPropertyCustomizer
without any issues but unfortunately in case ofParameterCustomizer
this results in aNullPointerException
.Describe the solution you'd like
ParameterCustomizer
to support returning null values and omit the parameter from the OpenAPI JSON if customizer returns nullDescribe alternatives you've considered
I considered setting some property with a specific value in
Parameter
and later filter it out in theOperationCustomizer
. This works but a bit ugly.Additional context
Here is my customizer...
...causing this exception:
The text was updated successfully, but these errors were encountered: