我正在尝试为MS \Logic创建一个自定义连接器,它使用一些其他端点,这些端点是Microsoft图的一部分,但在理解如何在OpenAPI 2.0规范中记录API方面遇到了困难。
MS文档
https://learn.microsoft.com/en-us/graph/api/group-post-owners?view=graph-rest-1.0#example
说包括
"@odata.id": "https://graph.microsoft.com/v1.0/users/{id}"作为请求主体的一部分的$ref参数
但是如何在OpenAPI 2.0规范中记录这一点呢?
这就是我目前所得到的.
'/groups/{team-id}/owners':
post:
tags:
- teams.team
summary: Add a new owner to the team
operationId: teams.AddOwner
consumes:
- application/json
parameters:
- name: team-id
in: path
required: true
type: string
description: Id of the MS team
x-ms-summary: Team Id
x-ms-visibility: important
- name: body
in: body
required: true
schema:
type: object
properties:
userId:
type: string
description: Id of the user to be added as an owner to the team
x-ms-summary: User Id
x-ms-visibility: important
'@odata.id':
default: https://graph.microsoft.com/v1.0/users/{userId}
responses:
'204':
description: Success
default:
$ref: '#/responses/error'
x-ms-docs-operation-type: operation当我提交上面的内容来创建自定义连接器时,我会得到以下错误
指定的文件不符合OpenAPI 2.0规范:“JSON2.0对”oneOf“中的任何模式都无效。路径'paths./groups/{team-id}/owners.post.parameters1'.‘
编辑
我已经更新了OpenAPI如下所示
这意味着我可以导入和使用这个..。但是,我必须在工作流中手动为@odata.id参数构造URL!
"@odata.id": "https://graph.microsoft.com/v1.0/users/{id}"'/groups/{team-id}/owners/$ref':
post:
tags:
- teams.team
summary: Add a new owner to the team
operationId: teams.AddOwner
consumes:
- application/json
parameters:
- name: team-id
in: path
required: true
type: string
description: Id of the MS team
x-ms-summary: Team Id
x-ms-visibility: important
- name: body
in: body
required: true
schema:
type: object
properties:
'@odata.id':
title: User Id
type: string
x-ms-summary: User Id
x-ms-visibility: important
responses:
'204':
description: Success
default:
$ref: '#/responses/error'
x-ms-docs-operation-type: operation编辑
我应该如何指定这个以获得userId
如何正确地指定主体参数?
有没有关于如何做到这一点的文档\示例?
任何帮助都将不胜感激。
提前感谢
皮特
发布于 2019-05-09 03:35:08
我发现创建PowerApps自定义连接器的最简单方法之一是:
然后,如果需要,可以下载Swagger文件。基本上,让PowerApps为您构建Swagger文件,而不是反过来。
这是我喜欢使用的方法的YouTube视频。
https://stackoverflow.com/questions/55738130
复制相似问题