如何使用OpenAPI-Generator-Maven-Plugin/ Swagger生成Java模型类,而无需注释?
我想从YAML文件中生成Java模型类,而无需注释生成类。 如何生成?我尝试了多种方法,但无法在没有注释的情况下生成模型类。始终包含注释生成类。
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.1.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/pesttore.yml</inputSpec>
<modelPackage>com.my.path.to.api</modelPackage>
<generatorName>java</generatorName>
<generateApis>false</generateApis>
<generateModels>true</generateModels>
<generateModelDocumentation>false</generateModelDocumentation>
<generateModelTests>false</generateModelTests>
<apisToGenerate>false</apisToGenerate>
<withXml>false</withXml>
<!--<library>resttemplate</library> -->
<configOptions>
<sourceFolder>src/main/java</sourceFolder>
<serializableModel>true</serializableModel>
<dateLibrary>java8</dateLibrary>
<annotationLibrary>none</annotationLibrary>
<serializationLibrary>jsonb</serializationLibrary>
<additionalModelTypeAnnotations>null</additionalModelTypeAnnotations>
<documentationProvider>none</documentationProvider>
<additional-properties>generateModelBuilders=true,useJackson=false,sortParamsByRequiredFlag=false,useJacksonJsonIgnoreUnknownProperties=false</additional-properties>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
I want to generate java model classes from yaml file without annotations in generating classes.
How it is possible to generate? I tried multiple ways but not able to generate model classes without annotations. Always containing annotations in generating classes.
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.1.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/pesttore.yml</inputSpec>
<modelPackage>com.my.path.to.api</modelPackage>
<generatorName>java</generatorName>
<generateApis>false</generateApis>
<generateModels>true</generateModels>
<generateModelDocumentation>false</generateModelDocumentation>
<generateModelTests>false</generateModelTests>
<apisToGenerate>false</apisToGenerate>
<withXml>false</withXml>
<!--<library>resttemplate</library> -->
<configOptions>
<sourceFolder>src/main/java</sourceFolder>
<serializableModel>true</serializableModel>
<dateLibrary>java8</dateLibrary>
<annotationLibrary>none</annotationLibrary>
<serializationLibrary>jsonb</serializationLibrary>
<additionalModelTypeAnnotations>null</additionalModelTypeAnnotations>
<documentationProvider>none</documentationProvider>
<additional-properties>generateModelBuilders=true,useJackson=false,sortParamsByRequiredFlag=false,useJacksonJsonIgnoreUnknownProperties=false</additional-properties>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在版本 this pr 。您需要更新插件版本。
This was added in version 5.4.0 in this PR. You'll need to update your plugin version.