Swagger:结构错误应该需要 属性 'paths' missingProperty:路径 - 将通用组件提取到外部 swagger 文件
Swagger: Structural error at should have required property 'paths' missingProperty: paths - extracting common components to external swagger file
我有几个 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 中验证为路径
Structural error at should have required property 'paths'
missingProperty: paths
正如消息所说,您的 swagger 文件应该有 path
属性.
我有几个 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 中验证为路径
Structural error at should have required property 'paths' missingProperty: paths
正如消息所说,您的 swagger 文件应该有 path
属性.