最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Swagger can't seem to reference model when using examples (multiple example) - Stack Overflow

programmeradmin0浏览0评论

How do i reference my models when trying to use multiple example using model/DTO?

@ApiExtraModels(DeliveryOrderListOkDTO, DeliveryOrderListOk2DTO)
@ApiOkResponse({
  content: {
    'application/json': {
      examples: {
        exampleOne: {
          $ref: getSchemaPath(DeliveryOrderListOkDTO),
        },
        exampleTwo: {
          $ref: getSchemaPath(DeliveryOrderListOk2DTO),
        },
        exampleThree: {
          value: {
            message: 'Works fine without ref',
          },
        },
      },
    },
  },
})
// ...

Output:

Generated Swagger/OpenAPI 3.0 Schema:

How am i suppose to use the $ref variable from the source code?:

发布评论

评论列表(0)

  1. 暂无评论