3

I have several yaml files in which many components are the same. For example I have 10 Language.java files with classes in different packages generated therefore I cannot write universal converters in code and I have some copy paste code in project.. Is it possible to do that somehow ?

Moreover I am using Java 8 and Maven to generate java code from swagger files:

 <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

The swagger:

openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Commons

components:
  schemas:
    Languages:
      type: array
      items:
        type: string

But this does not validate in swagger io as path

Structural error at should have required property 'paths' missingProperty: paths

michealAtmi
  • 1,012
  • 2
  • 14
  • 36

1 Answers1

0

As the message says, your swagger file should have a path property.

Mate Mrše
  • 7,997
  • 10
  • 40
  • 77