【问题标题】:SpringBoot model is not getting displayed on swaggerSpringBoot 模型没有大张旗鼓地显示
【发布时间】:2020-05-09 10:06:15
【问题描述】:

我在文档中使用 swagger,但是我看到 DTO 在 Swagger UI 上是空的。

这是 DTO PatientDto

我可以看到 swagger 中有一个空模型

Swagger UI

这里也是swagger配置

Swagger Config

有人可以帮忙吗?

【问题讨论】:

    标签: spring-boot swagger swagger-ui dto


    【解决方案1】:

    您需要使用以下内容注释控制器:

    @ApiImplicitParams({
            @ApiImplicitParam(
                name = "patientDto",
                dataType = "PatientDto",
                examples = @io.swagger.annotations.Example(
                    value = {
                        @ExampleProperty(value = "’patientDto‘:{'fName': 'John', 'lName='Doe'}", mediaType = "application/json")
                    })) 
        })
    

    有关更多信息,您可以查看此讨论 https://github.com/springfox/springfox/issues/2352

    它对我有用。

    【讨论】:

      猜你喜欢
      • 2022-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-13
      • 2019-06-30
      • 1970-01-01
      相关资源
      最近更新 更多