【问题标题】:Swagger resolver error - could not resolve pointer [duplicate]Swagger 解析器错误 - 无法解析指针 [重复]
【发布时间】:2021-12-20 08:10:30
【问题描述】:

我有一个 Spring 控制器方法如下。

@PutMapping("/update")
public ResponseEntity<String> updateMethod(@RequestBody() ListDto listDto) {
...
}

输入参数应该是ListDto 类的实例。 ListDto 类如下。

@Data
@ApiModel(description = "update list dto")
public class ListDto extends ArrayList<ObjectDto> {
}

ObjectDto 类如下。

@Data
@ApiModel(description = "update object dto")
public class ObjectDto {
    @ApiModelProperty(example = "1")
    private String id;

    @ApiModelProperty(example = "new message")
    private String message;
}

问题是,当尝试在 Swagger 中使用该方法时,我收到以下错误 - 似乎 ObjectDto 类的 swagger 定义未在运行时创建。

有没有办法强制创建定义并使这个错误消失?

【问题讨论】:

标签: java spring-boot swagger


【解决方案1】:

尝试重新安装您的架构。 为此,您只需重新安装 swagger!

【讨论】:

  • 能否请您解释/链接如何做到这一点?
  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
  • 为此,您只需重新安装 Swagger!
猜你喜欢
  • 2019-07-22
  • 2020-07-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-25
  • 2023-03-20
  • 2017-12-05
相关资源
最近更新 更多