我有一个Swagger文件,Maven插件为我生成了一个很大的API类。如何设置插件才能为每个API类创建一个端点?
插件的当前配置为:
<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>发布于 2020-12-16 18:05:37
要让API生成器为每个端点生成一个客户端类,您可以尝试在您的openAPI规范中为端点使用单独的标记,此方法可以创建单独的openapi客户端类。即:
/myEndpoint/{myParam}/:
parameters:
- name: myParam
in: path
required: true
schema:
type: string
get:
tags:
- {unique tag for this endpoint}https://stackoverflow.com/questions/62344965
复制相似问题