小编Van*_*sis的帖子

将 lombok(或任何)注释添加到 swagger 生成的类

我清理了互联网,但没有找到任何解决此问题的方法。是否可以在 swagger 类 UPON 生成中添加 lombok 注释?

我有这个招摇的模式:

Product:
type: "object"
required:
  - idSeller
  - model
  - name
  - description
  - price
properties:
  id:
    type: string
  idSeller:
    type: string
  model:
    type: string
  name:
    type: string
  description:
    type: string
  price:
    type: number
    format: currency
    minimum: 0.01
Run Code Online (Sandbox Code Playgroud)

生成了这段代码:

@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-18T20:36:31.834-03:00")

public class Product   {
    @JsonProperty("id")
    private String id = null;

    @JsonProperty("idSeller")
    private String idSeller = null;

    //rest of the code ommited
} 
Run Code Online (Sandbox Code Playgroud)

但我需要它来生成这个:

@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", …
Run Code Online (Sandbox Code Playgroud)

java lombok spring-boot swagger-2.0

5
推荐指数
1
解决办法
2820
查看次数

标签 统计

java ×1

lombok ×1

spring-boot ×1

swagger-2.0 ×1