openapi-generator
openapi-generator copied to clipboard
[BUG][Spring] ReadOnly is ignored if the property is in a ref resource
Description
ReadOnly in an $ref resource is annotated with @NotNull
openapi-generator version
7.4.0 and 6.6.0
OpenAPI declaration file content or url
https://gist.github.com/ernesto-arm/300d15c63661e91854b5213f53d0c475
Command line used for generation
mvn compile
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>7.4.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>
${project.basedir}/src/main/resources/contract.yaml
</inputSpec>
<generatorName>spring</generatorName>
<documentationProvider>springfox</documentationProvider>
<serializableModel>true</serializableModel>
<apiPackage>com.acme.api</apiPackage>
<modelPackage>com.acme.model</modelPackage>
<serverVariableOverrides>basePath=/</serverVariableOverrides>
<configOptions>
<sourceFolder>src/main/java</sourceFolder>
<delegatePattern>true</delegatePattern>
<openApiNullable>false</openApiNullable>y
<performBeanValidation>true</performBeanValidation>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<useTags>true</useTags>
<annotationLibrary>swagger2</annotationLibrary>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
- after the generator is run with
mvn compile - in Purchase class the getName which is readonly and required does not generate the @NotNull
- in Purchase class the getLinks which is readonly and required but as an external reference does generate the @NotNull annotation