Вызов API задач планировщика POST не работает из Swagger Doc - PullRequest
0 голосов
/ 13 июля 2020

Я создал проект Swagger 2.0 для Graph API из нашего внутреннего приложения. Ниже приведен код yaml swagger.

   /v1.0/planner/tasks:
    post:
      summary: Create a Planner Task
      tags:
      - Planner
      operationId: CreateaPlannerTask
      deprecated: false
      produces:
      - application/json
      consumes:
      - application/json
      parameters:
      - name: Body
        in: body
        required: true
        description: ''
        schema:
          $ref: '#/definitions/CreatePlannerTask'
      responses:
        201:
          description: Created
  CreatePlannerTask:
    title: CreatePlannerTask
    example:
      title: New Task
      planId: '{{PlanId}}'
      bucketId: '{{bucketId}}'
    type: object
    properties:
      planId:
        type: string
      bucketId:
        type: string
      title:
        type: string
    required:
    - planId
    - bucketId
    - title

Однако, когда я пытаюсь вызвать API с помощью следующего запроса:

{
  "planId": "{Plan-Id}",
  "bucketId": "{Bucket-Id}",
  "title": "Test from API",
  "assignments": {
    "{GUID}": {
      "@odata.type": "#microsoft.graph.plannerAssignment",
      "orderHint": " !"
    }
  }
}

, я получаю ответ ниже с кодом 400:

{
  "error": {
    "code": "",
    "message": "Schema validation has failed. Validation for field 'Title', on entity 'Task' has failed: A non-null value must be specified for this field.",
    "innerError": {
      "date": "2020-07-13T14:58:10",
      "request-id": "{request-Id}"
    }
  }
}

Я могу позвонить из Graph Explorer и Postman, но мой проект Swagger всегда получает ошибку поля заголовка. Я могу без проблем вызвать другие похожие API в моем swagger do c. Любая помощь или руководство будут оценены!

...