admin管理员组

文章数量:1335107

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?:

本文标签: javascriptSwagger can39t seem to reference model when using examples (multiple example)Stack Overflow