![](/img/trans.png)
[英]How to use several date classes for code generation by openapi-generator-maven-plugin?
[英]How can I generate several api classes with OpenApi maven plugin?
我有一個 Swagger 文件和 Maven 插件為我生成一個大的 API ZA2F2ED4F8EBC2CBB14C21A29DZ4。 我將如何設置插件來為每個 API class 創建一個端點?
插件的當前配置是:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.2.0</version>
<executions>
<execution>
<id>swagger-codegen-fbs4me</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/openapi/CarAPI_v0.2.yaml</inputSpec>
<generatorName>spring</generatorName>
<library>spring-boot</library>
<skipValidateSpec>true</skipValidateSpec>
<configHelp>false</configHelp>
<templateDirectory>${project.basedir}/src/main/resources/templates</templateDirectory>
<configOptions>
<delegatePattern>false</delegatePattern>
<apiPackage>com.ger.car.somewhere.clients</apiPackage>
<modelPackage>com.ger.car.somewhere.model</modelPackage>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
要使 openAPI 生成器為每個端點生成一個客戶端 class,您可以嘗試在 openapi 規范中為端點設置單獨的標簽,此方法可以創建單獨的 API 客戶端類。 IE:
/myEndpoint/{myParam}/:
parameters:
- name: myParam
in: path
required: true
schema:
type: string
get:
tags:
- {unique tag for this endpoint}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.