位置响应标头中的引用服务器 URL

问题描述

在服务器对象中我定义了一个 URL:

servers: 
 - url: https://localhost:8088/abc

并且在响应定义中我想引用这个服务器 URL:

/test-sub-url:
  post:
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              id: 
               description: Some ID
               type: string
    responses:
      '201':
        description: Created
        headers:
          Location:
            required: true
            schema:
              type: string
              format: url
              example: $reference server URL here$

是否可以从 Location 响应标头的示例中引用服务器 URL?

解决方法

example 关键字需要一个文字示例值,所以不,您不能在那里引用另一个关键字。