Почему опция «Создать потоки из REST API» отключена на платформе anypoint? - PullRequest
0 голосов
/ 23 марта 2019

Я пытаюсь создать новую конфигурацию Mule интерфейса API из файла RAML API. Во-первых, я опубликовал API для Anypoint Exchange, а затем импортировал API из центра дизайна в проект Anypoint Studio. Теперь, когда я щелкаю правой кнопкой мыши файл API RAML и выбираю Mule> Generate Flows из REST API, эта опция становится отключенной, и я не могу выбрать ее.

Я использую Mule 4 и Anypoint Studio версии: 7.3.2. Я проверил файл API RAML и в нем нет видимых ошибок. Что вызывает отключение этого параметра и как его включить?

Ниже приведен фактический файл RAML API.

#%RAML 1.0
version: v1
title: Accounts API

types:
  Account: !include datatypes/account.raml
  AccountNoID: !include datatypes/accountNoID.raml

/accounts:
  get:
    description: Retrieves accounts based on the given query parameters.
    headers:
      Requester-ID:
        description: id of the person requesting the accounts information
        required: true
    queryParameters:
      country:
        required: false
        type: string
      name:
        description: The system will look for names that contain the given value in the name parameter.
        required: false
        type: string
      type:
        required: true
        type: string
        enum: ["personal", "business"]
    responses:
      400:
        body:
          application/json:
            example: {
              "message": "Error retrieving data from the Account database."
            }
      200:
        description: Returns an array of Account objects in JSON
        body:
          application/json:
            type: Account[]
            examples:  !include examples/accountsExample.raml
  post:
    description: Creates new accounts based on a given array of Account objects.
    headers:
        Requester-ID:
          description: id of the person requesting the accounts information
          required: true
    body:
      application/json:
        description: Payload should be an array of Account objects with all fields present for each Account object.
        type: AccountNoID[]
        examples: !include examples/accountsExampleNoID.raml
    responses:
      400:
        body:
          application/json:
             example: {
               "message": "Error creating accounts. Please check the JSON object and make sure it's valid."
             }
      201:
        body:
          application/json:
            example: {
              "message": "Accounts uploaded (but not really)."
            }

1 Ответ

0 голосов
/ 24 марта 2019

Если опция недоступна, это означает, что Studio не может проанализировать RAML.

Недавно в Design Center произошли изменения в том, как он работает с узлом примеров в RAML.

Подробности здесь: https://docs.mulesoft.com/design-center/design-modify-raml-specs-conform

В этом случае RAML в Design Center действителен, но из-за ошибки в Studio это не считается действительным в Studio на данный момент.

Попробуйте использовать именованные примеры в RAML для узлов examples.

examples:  
  myNamedExample: !include examples/accountsExample.raml
...