【问题标题】:OpenApi generator generating empty lines between annotationsOpenApi 生成器在注释之间生成空行
【发布时间】:2021-02-07 17:10:42
【问题描述】:
  /**
   * Get form
   * @return form
  */
  @ApiModelProperty(value = "")

  @Valid

  public AlertForm getForm() {
    return form;
  }

  /**
   * Get data
   * @return data
  */
  @ApiModelProperty(value = "")


  public Object getData() {
    return data;
  }

知道如何摆脱它吗?我正在使用插件版本 5.0.0。配置如下:

<plugin>
    <groupId>org.openapitools</groupId>
    <artifactId>openapi-generator-maven-plugin</artifactId>
    <version>${openapitools.version}</version>
    <executions>
        <execution>
            <id>client-api</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <inputSpec>${project.basedir}/api/client-api.yaml</inputSpec>
                <generatorName>spring</generatorName>
                <apiPackage>com.org</apiPackage>
                <modelPackage>com.org.model</modelPackage>
                <supportingFilesToGenerate>ApiUtil.java</supportingFilesToGenerate>
                <configOptions>
                    <hideGenerationTimestamp>true</hideGenerationTimestamp>
                    <delegatePattern>true</delegatePattern>
                    <dateLibrary>java8-localdatetime</dateLibrary>
                    <useBeanValidation>true</useBeanValidation>
                </configOptions>
                <ignoreFileOverride>
                    ${project.basedir}/src/main/resources/.openapi-generator-ignore
                </ignoreFileOverride>
            </configuration>
        </execution>
    </executions>
</plugin>

我找不到任何有用的信息,而且我对打开 api 生成还很陌生,所以我会很感激任何线索。

【问题讨论】:

    标签: java spring openapi openapi-generator


    【解决方案1】:

    您可以使用您最喜欢的代码格式化程序/linter(例如prettier.io)根据您喜欢的代码样式来处理自动生成的代码。

    【讨论】:

    • 不太确定这是一个选项,因为每个包构建都会生成类,因此格式会丢失。我只是希望它们更具可读性。
    猜你喜欢
    • 2023-01-12
    • 1970-01-01
    • 2023-01-23
    • 1970-01-01
    • 2021-07-12
    • 1970-01-01
    • 1970-01-01
    • 2021-08-15
    • 2020-02-17
    相关资源
    最近更新 更多