如何在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)}
I'm trying to create a REST API and have different routes to each endpoint to return a value, but it does not accept custom data types such as Date or Coordinate. I have tried to create it but it is still not recognized.
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
I'm supposed to take coordinate like this
{(123,123),{2144123,123444)}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论