我有几个yaml文件,其中许多组件是相同的。例如,我有10个language.java文件,其中的类在不同的包中生成,因此我不能用代码编写通用转换器,我在项目中有一些复制粘贴代码。。有可能吗?
此外,我使用java 8和maven从swagger文件生成java代码:
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator.version}</version>
<executions>
<execution>
<id>commons</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/common.yaml</inputSpec>
<generatorName>spring</generatorName>
<apiPackage>mypackage.api</apiPackage>
<modelPackage>mypackage.model</modelPackage>
<configOptions>
<dateLibrary>java8</dateLibrary>
<interfaceOnly>true</interfaceOnly>
</configOptions>
</configuration>
</execution>
<execution>
<id>forms</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/a.yaml</inputSpec>
<generatorName>spring</generatorName>
<apiPackage>mypackage.a.api</apiPackage>
<modelPackage>mypackage.a.model</modelPackage>
<configOptions>
<dateLibrary>java8</dateLibrary>
<interfaceOnly>true</interfaceOnly>
</configOptions>
</configuration>
</execution>
PLENTY OF OTHER YAML FILES AND PACKAGES GENERATING THE SAME COMMON CLASSES like Languages
招摇者:
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger Commons
components:
schemas:
Languages:
type: array
items:
type: string
但这在swagger io中不能作为路径进行验证
处的结构错误应具有必需的属性“paths”missingproperty:paths
1条答案
按热度按时间5q4ezhmt1#
正如消息所说,你的招摇文件应该有一个
path
财产。