Parameter annotation doesn't take defaultValue attribute
Describe the bug
- io.swagger.v3.oas.annotations.Parameter doesn't have defaultValue attribute which is required in our case because we have default value available for one of our query parameters and also we were migrating from io.springfox for swagger2.0 and which was supporting it.
- May I know, is there any reason for not having it?
Version: 'org.springdoc:springdoc-openapi-ui:1.4.6'

I believe the defaultValue is part of the @Schema and not the @Parameter.
See the example below (from this sample project):
@Schema(description = "Test enum object", defaultValue = "TestEnum.C")
@NotNull
@JsonProperty("testEnum")
private TestEnum testEnum = TestEnum.C;
@satyavemuri,
The class io.swagger.v3.oas.annotations.Parameter is not a springdoc-openapi class.
Please raison your question on the swagger github instead.
Hi @bnasslahsen,
Thanks for the response, I will raise the issue in Swagger Github.
for convenience: https://github.com/swagger-api/swagger-core/issues/4174
We also ran into this issue and were able to make the following workaround
in cases where there was a @Parameter annotated parameter that also had a @org.springframework.web.bind.annotation.RequestParam annotation.
@Component
public class DefaultValueParameterCustomizer implements ParameterCustomizer {
@Override
public Parameter customize(Parameter parameterModel, MethodParameter methodParameter) {
RequestParam requestParamAnnotation = methodParameter.getParameterAnnotation(RequestParam.class);
if (requestParamAnnotation != null &&
!ValueConstants.DEFAULT_NONE.equals(requestParamAnnotation.defaultValue())) {
String defaultValue = requestParamAnnotation.defaultValue();
parameterModel.setExtensions(new HashMap<>());
parameterModel.getExtensions().put("default", defaultValue);
}
return parameterModel;
}
}