我手头有多个 .yaml
文件,我想要通过 Maven 来生成模型和接口。有没有可能在单次执行中指向多个文件或一个文件夹,而不是单一文件?目前我的 Maven 配置如下:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>7.2.0</version>
<executions>
<execution>
<id>bookApi</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/books.yaml</inputSpec>
<generatorName>spring</generatorName>
<library>spring-boot</library>
<modelPackage>com.mhaque.bookstore.model</modelPackage>
<apiPackage>com.mhaque.bookstore.controller</apiPackage>
<configOptions>
<java8>false</java8>
<interfaceOnly>true</interfaceOnly>
<dateLibrary>java8</dateLibrary>
</configOptions>
</configuration>
</execution>
<execution>
<id>studentApi</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/students.yaml</inputSpec>
<generatorName>spring</generatorName>
<library>spring-boot</library>
<modelPackage>com.mhaque.bookstore.model</modelPackage>
<apiPackage>com.mhaque.bookstore.controller</apiPackage>
<configOptions>
<java8>false</java8>
<interfaceOnly>true</interfaceOnly>
<dateLibrary>java8</dateLibrary>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
我希望可以实现这样的配置:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>7.2.0</version>
<executions>
<execution>
<id>bookstoreApi</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/books.yaml,
${project.basedir}/src/main/resources/students.yaml
</inputSpec> <!-- 处理多个文件或目录 -->
<generatorName>spring</generatorName>
<library>spring-boot</library>
<modelPackage>com.mhaque.bookstore.model</modelPackage>
<apiPackage>com.mhaque.bookstore.controller.v1</apiPackage>
<configOptions>
<java8>false</java8>
<interfaceOnly>true</interfaceOnly>
<dateLibrary>java8</dateLibrary>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>