Microsoft Flow声明"此操作没有输入。"用于我的Custom API中的操作

时间:2016-11-03 02:33:20

标签: swagger microsoft-graph

我创建了一个swagger文件,试图从Microsoft Graph API定义我需要的操作。

此API需要一些稍微复杂的数据类型来执行创建用户的操作,因此我将这些对象和属性构建为提供参数'参数'在:身体。请参阅下面的代码段。

我可以在Flow中注册这个自定义API但是当我尝试使用具有in body参数的操作时,Flow中的操作表明"此操作没有输入。"

/users:
post:
  tags:
    - User
  summary: Create User
  operationId: UserCreate
  description: >-
    Use this API to create a new User. The request body contains the user to
    create. At a minimum, you must specify the required properties for the
    user. You can optionally specify any other writable properties.
  parameters:
    - name: parameters
      in: body
      required: true
      schema:
        $ref: '#/definitions/UserCreateParameters'
      description: Parameters to create a user.
  responses:
    '201':
      description: >-
        Created. Indicates success. The new user is returned in the response
        body.
      schema:
        $ref: '#/definitions/User'
    default:
      description: Error response
      schema:
        $ref: '#/definitions/GraphError'

解释

PasswordProfile:
properties:
  password:
    type: string
    description: Password
  forceChangePasswordNextLogin:
    type: boolean
    description: Force change password on next login
required:
  - password
description: Contains the password profile associated with a user.

UserCreateParameters:
properties:
  accountEnabled:
    type: boolean
    description: Enable the account. If it is enabled then true else false.
  displayName:
    type: string
    description: User display name
  passwordProfile:
    $ref: '#/definitions/PasswordProfile'
  userPrincipalName:
    type: string
    description: >-
      The user principal name (someuser@contoso.com). It must contain one of
      the verified domains for the tenant.
  mailNickname:
    type: string
    description: The mail alias for the user
  immutableId:
    type: string
    description: >-
      Needs to be specified if you are using a federated domain for the
      user's userPrincipalName (UPN) property while creating a new user
      account. It is used to associate an on-premises Active Directory user
      account to their Azure AD user object.
required:
  - accountEnabled
  - displayName
  - passwordProfile
  - userPrincipalName
  - mailNickname
description: Request parameters for create a new work or school account user

1 个答案:

答案 0 :(得分:1)

我发现定义,甚至认为它们是有效的Swagger并且由Flow验证,需要有一种'对象'。

因此,应遵循UserCreateParameters但键入:object。 E.g。

UserCreateParameters:
  type: object
  properties:

我现在已将此包含在每个定义的开头,所有字段都按预期显示。