[BUG] spring generator with oas3=true tries to use non-existing parameter defaultValue of @Parameter
Created by: kdebski85
Bug Report Checklist
openapi-generator version
I am using org.openapitools:openapi-generator-maven-plugin:5.3.1 and io.swagger.core.v3:swagger-annotations:2.1.12
Description
I try to generate Spring MVC API with oas3 = true
<configuration>
<generatorName>spring</generatorName>
<library>spring-boot</library>
<apiPackage>...</apiPackage>
<modelPackage>...</modelPackage>
<generateApis>true</generateApis>
<generateApiDocumentation>true</generateApiDocumentation>
<generateApiTests>false</generateApiTests>
<generateModels>false</generateModels>
<generateModelDocumentation>false</generateModelDocumentation>
<generateModelTests>false</generateModelTests>
<generateSupportingFiles>false</generateSupportingFiles>
<configOptions>
<java8>true</java8>
<oas3>true</oas3>
<interfaceOnly>true</interfaceOnly>
<sourceFolder>src/gen/java/main</sourceFolder>
<dateLibrary>java8-localdatetime</dateLibrary>
<useTags>true</useTags>
<delegatePattern>false</delegatePattern>
<skipDefaultInterface>true</skipDefaultInterface>
<useBeanValidation>false</useBeanValidation>
</configOptions>
</configuration>
The generated code is:
@Parameter(name = "inclusive", description = "...", defaultValue = "false")
@RequestParam(value = "inclusive", required = false, defaultValue = "false") Boolean inclusive
The issue is that @io.swagger.v3.oas.annotations.Parameter
annotation does not have defaultValue
parameter and the code fails to compile:
[ERROR] symbol: method defaultValue()
[ERROR] location: @interface io.swagger.v3.oas.annotations.Parameter
OpenAPI declaration file content or url
One of the parameters has a default value:
parameters:
- name: inclusive
in: query
description: ...
schema:
type: boolean
default: false
Generation Details
Suggest a fix
Should not add defaultValue
to @Parameter
. I do not know if there is any annotation for a default value.