网站搜索

typescript - 如何在 OpenAPI 中拥有自定义数据类型?


我正在尝试创建一个 REST API,并为每个端点设置不同的路由以返回一个值,但它不接受自定义数据类型,例如日期或坐标。我已经尝试创建它,但它仍然无法识别。

  Coordinate:
    type: object
    required:
      - longitude
      - latitude
    properties:
      longitude:
        type: number
        description: longitude for coordinate
      latitude:
        type: number
        description: latitude for coordinate

   facilities:
    properties:
     id:
       type: number
       description: facility Id
     name:
       type: string
       description: facility Name
     coordinates: #this gives an error says invalid data type
       type: Coordinate
       description: facility Coordinate
     address:
       type: string
       description: address of facility
     energyConsumption:
       allOf:
       - type: string
       - type: integer
       - type: boolean
       - type: number
       - type: array
       - type: object

我应该这样获取坐标

{(123,123),{2144123,123444)}