-
Notifications
You must be signed in to change notification settings - Fork 424
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
@NotNull
is added by default for fields that are not required
#1295
Comments
@NotNull
is added by default for fields that are required @NotNull
is added by default for fields that are not required
I found out that you can restore the old behavior (no The description of this option is @frantuma would it be enough to change the default to |
What is the proper way to set the cliOption I found some examples online where similar cliOptions are added under <plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<executions>
<execution>
<?m2e execute onConfiguration,onIncremental?>
<id>gcloud-generation</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${swagger.input.spec}</inputSpec>
<language>spring</language>
<apiPackage>${swagger.api.package}</apiPackage>
<modelPackage>${swagger.model.package}</modelPackage>
<invokerPackage>${swagger.invoker.package}</invokerPackage>
<generateApiTests>false</generateApiTests>
<configOptions>
<serializableModel>true</serializableModel>
<interfaceOnly>true</interfaceOnly>
<dateLibrary>java8-localdatetime</dateLibrary>
<sourceFolder>.</sourceFolder>
<useTags>true</useTags>
</configOptions>
<additionalProperties>
<!-- useNullableForNotNull -->
<!-- Add @NotNull depending on `nullable` property instead of `required` -->
<additionalProperty>useNullableForNotNull=false</additionalProperty>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin> However it also seems to work when i add the config option under <plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<executions>
<execution>
<?m2e execute onConfiguration,onIncremental?>
<id>gcloud-generation</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${swagger.input.spec}</inputSpec>
<language>spring</language>
<apiPackage>${swagger.api.package}</apiPackage>
<modelPackage>${swagger.model.package}</modelPackage>
<invokerPackage>${swagger.invoker.package}</invokerPackage>
<generateApiTests>false</generateApiTests>
<configOptions>
<serializableModel>true</serializableModel>
<interfaceOnly>true</interfaceOnly>
<dateLibrary>java8-localdatetime</dateLibrary>
<sourceFolder>.</sourceFolder>
<useTags>true</useTags>
<!-- useNullableForNotNull -->
<!-- Add @NotNull depending on `nullable` property instead of `required` -->
<useNullableForNotNull>false</useNullableForNotNull>
</configOptions>
</configuration>
</execution>
</executions>
</plugin> In practice, is there a difference between the 2 ways to define the config option? If so, which is the recommended way? |
3.0.57 introduced a change in behavior which breaks many of our MVC unit tests. See: swagger-api/swagger-codegen-generators#1295 Runtime groovy dependency caused bootRun to fail on startup. It was previously needed for logback, but we use XML now (logback hasn't supported groovy since 2021: https://logback.qos.ch/news.html#1.2.9) Hadoop upgrades used in tests required the exclusion of slf4j-reload4j dependency for Spring Boot tests to initialize.
|
Re-opening, see #1308 (comment) |
Given the following step:
Swagger Definition:
swagger-codegen-maven-plugin
3.0.56
generates the following model:While swagger-codegen-maven-plugin
3.0.57
generates this:It seems that this is what introduced with #1291
The text was updated successfully, but these errors were encountered: