OpenAPITools / OpenAPITools/openapi-generator

[BUG] The "info" section of the spec file is not generated

Open
#10,736 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Hello,
I have such a yaml file and it generates correctly - except for the info section.

openapi: 3.0.3
info:
  title: GlobalAPI
  version: 1.0.0
  description: API made for fun.
  termsOfService: http://localhost/terms/
  contact:
    name: API Support
    email: support@poczta.fm
    url: http://localhost/support
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0
paths:
  /account:
    post:
      operationId: accountPost
      summary: Create account.
      responses:
        '200':
          description: OK

I checked the yaml file in the swagger editor and everything is fine, but it is badly generated from the maven plugin.

I am using the openapi-generator for the first time and I wonder what I am doing wrong

My POM file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.4</version>
        <relativePath/>
    </parent>
    <groupId>pl.lukaszbaczek</groupId>
    <artifactId>GlobalAPI</artifactId>
    <packaging>jar</packaging>
    <version>${revision}</version>

    <properties>
        <java.version>15</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>

        <revision>1.0.0</revision>

        <lombok>1.18.22</lombok>
        <validation-api>2.0.1.Final</validation-api>
        <springfox>3.0.0</springfox>
        <swagger-annotations>1.6.3</swagger-annotations>
        <swagger-parser>1.0.56</swagger-parser>
        <postgresql>42.2.24</postgresql>
        <hibernate>5.5.7.Final</hibernate>
        <javadoc>3.3.1</javadoc>
        <openapi-generator>5.3.0</openapi-generator>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok}</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>${validation-api}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>${springfox}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${springfox}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${springfox}</version>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>${swagger-annotations}</version>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-parser</artifactId>
            <version>${swagger-parser}</version>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgresql}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${javadoc}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>${openapi-generator}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
                            <generatorName>spring</generatorName>
                            <library>spring-boot</library>
                            <modelNameSuffix>Dto</modelNameSuffix>
                            <generateApiTests>false</generateApiTests>
                            <generateApiDocumentation>true</generateApiDocumentation>
                            <generateApiTests>false</generateApiTests>
                            <generateSupportingFiles>true</generateSupportingFiles>
                            <generateModelTests>false</generateModelTests>
                            <configOptions>
                                <basePackage>pl.lukaszbaczek.GlobalAPI</basePackage>
                                <modelPackage>pl.lukaszbaczek.GlobalAPI.dto</modelPackage>
                                <apiPackage>pl.lukaszbaczek.GlobalAPI.api</apiPackage>
                                <configPackage>pl.lukaszbaczek.GlobalAPI.config</configPackage>
                                <licenseName>test</licenseName>
                                <licenseUrl>localhost</licenseUrl>
                                <delegatePattern>false</delegatePattern>
                                <interfaceOnly>true</interfaceOnly>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided src/main/resources/openapi.yaml and the openapi-generator-maven-plugin configuration using the spring generator. Run Maven generation with the example specification and inspect the generated API documentation and supporting files to identify how the info section is handled. Done means the generated output preserves the specification's info fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend-api-design, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.