Swagger yaml 不合作
Swagger yaml not cooperating
我几乎完成了我的 Swagger yaml 文件,但有一段我似乎无法正确写出:
你看哪里写着 invitationCompletedOn
然后我需要添加 createdOn
和 completedOn
:
当我像这样添加 createdOn
时:
invitationCompletedOn:
type: string
example: 2021-09-22T08:27:49.622Z
createdOn:
type: string
example: 2021-09-22T08:27:49.622Z
但这会破坏输出。这是整个 yaml 文件:
/**
* @openapi
* /api/v2/organizations/:organizationId/invitations:
* get:
* description: Get a list of Data Access Object invitations.
* responses:
* 200:
* description: Get a list of Data Access Object invitations.
* content:
* application/json:
* schema:
* type: object
* properties:
* data:
* type: array
* items:
* type: object
* properties:
* _type:
* type: string
* description: Data Transfer Object of new invitation.
* example: ViewInvitationDto
* email:
* type: string
* description: Invitation email.
* example: dolittle@qa.co
* pui:
* type: string
* description: The patients user id.
* example: spyrt_p10102acc
* groupId:
* type: string
* description: The organizations identification.
* example: poi_5002
* roleDescription:
* type: string
* description: The role of the organization.
* example: admin
* viewHealthWorkerDto:
* type: object
* properties:
* _type:
* type: string
* description: Data Access Object for HealthWorker
* example: ViewHealthWorkerDto
* _id:
* type: string
* description: Identification for Healthworker
* example: 613ef0964b525196cf8599bf
* assignedRoleCode:
* type: string
* description: Assigned code role for organizations and healthworkers.
* example: armada.organization.doctor
* pui:
* type: string
* description: Assigned code role for organizations and healthworkers.
* example: spyrt_p10102acc
* firstName:
* type: string
* description: The first name of the healthworker.
* example: John
* lastName:
* type: string
* description: The last name of the healthworker.
* example: Dolittle
* healthWorkerTags:
* example:
* - key: migratedOn
* value: 2021-11-19T00:00:43.722Z
* - key: exporterVersion
* value: 2
* - key: _oldAccountId
* value: 10102
* - key: _oldPatientIds
* value: 10729
* schemaVersion:
* type: string
* example: 1
* createdOn:
* type: string
* example: 2020-05-08T07:43:43.000Z
* updatedOn:
* type: string
* example: 2020-05-08T07:43:43.000Z
* roleDescription:
* type: string
* example: admin
* email:
* type: string
* example: dolitle@qa.co
* userTags:
* example:
* - key: migratedOn
* value: 2021-11-19T00:00:43.722Z
* - key: exporterVersion
* value: 2
* - key: _oldAccountId
* value: 10102
* - key: _oldPatientIds
* value: 10729
* invitationCompletedOn:
* type: string
* example: 2021-09-22T08:27:49.622Z
*
*
*/
createdOn
和 completedOn
应该是 viewHealthWorkerDto
而不是 invitationCompletedOn
的兄弟属性。试试这个:
* viewHealthWorkerDto:
* type: object
* properties:
* ...
* createdOn:
* type: string
* example: 2021-09-22T08:27:49.622Z
* completedOn:
* type: string
* example: 2021-09-22T08:27:49.622Z
另外,我看到您为 userTags
定义了一个示例值,但没有定义实际架构。从您的屏幕截图看来,userTags
(以及类似的键值对象数组)可以像这样正确定义:
* userTags:
* type: array
* items:
* type: object
* properties:
* key:
* type: string
* value:
* type: string
* example:
* - key: migratedOn
* value: 2021-11-19T00:00:43.722Z
* - ...
我几乎完成了我的 Swagger yaml 文件,但有一段我似乎无法正确写出:
你看哪里写着 invitationCompletedOn
然后我需要添加 createdOn
和 completedOn
:
当我像这样添加 createdOn
时:
invitationCompletedOn:
type: string
example: 2021-09-22T08:27:49.622Z
createdOn:
type: string
example: 2021-09-22T08:27:49.622Z
但这会破坏输出。这是整个 yaml 文件:
/**
* @openapi
* /api/v2/organizations/:organizationId/invitations:
* get:
* description: Get a list of Data Access Object invitations.
* responses:
* 200:
* description: Get a list of Data Access Object invitations.
* content:
* application/json:
* schema:
* type: object
* properties:
* data:
* type: array
* items:
* type: object
* properties:
* _type:
* type: string
* description: Data Transfer Object of new invitation.
* example: ViewInvitationDto
* email:
* type: string
* description: Invitation email.
* example: dolittle@qa.co
* pui:
* type: string
* description: The patients user id.
* example: spyrt_p10102acc
* groupId:
* type: string
* description: The organizations identification.
* example: poi_5002
* roleDescription:
* type: string
* description: The role of the organization.
* example: admin
* viewHealthWorkerDto:
* type: object
* properties:
* _type:
* type: string
* description: Data Access Object for HealthWorker
* example: ViewHealthWorkerDto
* _id:
* type: string
* description: Identification for Healthworker
* example: 613ef0964b525196cf8599bf
* assignedRoleCode:
* type: string
* description: Assigned code role for organizations and healthworkers.
* example: armada.organization.doctor
* pui:
* type: string
* description: Assigned code role for organizations and healthworkers.
* example: spyrt_p10102acc
* firstName:
* type: string
* description: The first name of the healthworker.
* example: John
* lastName:
* type: string
* description: The last name of the healthworker.
* example: Dolittle
* healthWorkerTags:
* example:
* - key: migratedOn
* value: 2021-11-19T00:00:43.722Z
* - key: exporterVersion
* value: 2
* - key: _oldAccountId
* value: 10102
* - key: _oldPatientIds
* value: 10729
* schemaVersion:
* type: string
* example: 1
* createdOn:
* type: string
* example: 2020-05-08T07:43:43.000Z
* updatedOn:
* type: string
* example: 2020-05-08T07:43:43.000Z
* roleDescription:
* type: string
* example: admin
* email:
* type: string
* example: dolitle@qa.co
* userTags:
* example:
* - key: migratedOn
* value: 2021-11-19T00:00:43.722Z
* - key: exporterVersion
* value: 2
* - key: _oldAccountId
* value: 10102
* - key: _oldPatientIds
* value: 10729
* invitationCompletedOn:
* type: string
* example: 2021-09-22T08:27:49.622Z
*
*
*/
createdOn
和 completedOn
应该是 viewHealthWorkerDto
而不是 invitationCompletedOn
的兄弟属性。试试这个:
* viewHealthWorkerDto:
* type: object
* properties:
* ...
* createdOn:
* type: string
* example: 2021-09-22T08:27:49.622Z
* completedOn:
* type: string
* example: 2021-09-22T08:27:49.622Z
另外,我看到您为 userTags
定义了一个示例值,但没有定义实际架构。从您的屏幕截图看来,userTags
(以及类似的键值对象数组)可以像这样正确定义:
* userTags:
* type: array
* items:
* type: object
* properties:
* key:
* type: string
* value:
* type: string
* example:
* - key: migratedOn
* value: 2021-11-19T00:00:43.722Z
* - ...