Импорт yaml Open Api 3.0 в Postman 7.1 - PullRequest
0 голосов
/ 07 июня 2019

Я бы хотел импортировать файл yaml open-api 3.0 в почтальон, v. 7.1.1.

Я создаю документы OpenApi 3.0 в Laravel, используя darkaonline / l5-swagger. Сгенерированный файл yaml open-api 3.0 создает безошибочный вывод при вставке в editor.swagger.io. API написан в соответствии со спецификацией json: api (или предназначен). Когда файл импортируется в почтальон (v 7.1.1), генерируется эта ошибка: «Ошибка при импорте Open API 3.0: не удалось импортировать» Во всей прочитанной документации говорится, что почтальон теперь поддерживает open api 3.0. Я попытался загрузить примеры yaml OpenApi 3.0 из github Zircote, и они импортировались просто отлично. Они гораздо менее сложны, чем наши документы. Отрывок кода: Предупреждение, что это много, но я чувствую, что мне нужно было предоставить достаточно контекста (на самом деле это небольшой кусок полного документа - файл длиной 2000 строк):

info:
  title: 'NAME OF MY API'
  version: 1.0.0
servers:
  -
    url: 'https://api.API.com/v1'
paths:
   /accounts:
    get:
      tags:
        - accounts
      summary: 'list accounts'
      operationId: 'App\Http\Controllers\v1\AccountsController::index'
      responses:
        200:
          description: 'A list of accounts'
          content:
            application/vnd.api+json:
              schema:
                required:
                  - data
                properties:
                  data:
                    description: 'Show all accounts for this request.'
                    type: array
                    items:
                      properties:
                        type:
                          type: string
                        id:
                          type: string
                        attributes:
                          $ref: '#/components/schemas/account'
                        relationships:
                          properties:
                            persons:
                              type: array
                              items:
                                $ref: '#/components/schemas/relationship'
                          type: object
                        links:
                          $ref: '#/components/schemas/relationship/properties/links'
                      type: object
                  meta:
                    $ref: '#/components/schemas/meta'
                  links:
                    $ref: '#/components/schemas/links'
                type: object
        401:
          description: 'Unauthorized access'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/error-response'
        404:
          description: 'No records found'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/error-response'
      servers:
        -
          url: 'https://api.API.com/v1'
    post:
      tags:
        - accounts
      summary: 'new account'
      operationId: 'App\Http\Controllers\v1\AccountsController::store'
      responses:
        201:
          description: 'Successful save'
        401:
          description: 'Unauthorized access'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/error-response'
        400:
          description: 'Bad request, save failed'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/error-response'
      servers:
        -
          url: 'https://api.API.com/v1'
  '/accounts/{id}':
    get:
      tags:
        - accounts
      summary: 'get one account'
      operationId: 'App\Http\Controllers\v1\AccountsController::show'
      parameters:
        -
          name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        200:
          description: 'An account object'
          content:
            application/vnd.api+json:
              schema:
                properties:
                  type:
                    description: 'Display the specified resource.'
                    type: string
                  id:
                    description: 'Display the specified resource.'
                    type: string
                  attributes:
                    $ref: '#/components/schemas/account'
                  relationships:
                    description: 'Display the specified resource.'
                    properties:
                      persons:
                        description: 'Display the specified resource.'
                        type: array
                        items:
                          $ref: '#/components/schemas/relationship'
                    type: object
                  links:
                    $ref: '#/components/schemas/relationship/properties/links'
                type: object
        401:
          description: 'Unauthorized access'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/error-response'
        404:
          description: 'Record not found'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/error-response'
      servers:
        -
          url: 'https://api.API.com/v1'
    delete:
      tags:
        - accounts
      summary: 'remove account'
      operationId: 'App\Http\Controllers\v1\AccountsController::destroy'
      parameters:
        -
          name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        200:
          description: 'An account object'
        401:
          description: 'Unauthorized access'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/error-response'
        405:
          description: 'Method not allowed'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/error-response'
        400:
          description: 'Bad request, save failed'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/error-response'
      servers:
        -
          url: 'https://api.API.com/v1'
    patch:
      tags:
        - accounts
      summary: 'update account'
      operationId: 'App\Http\Controllers\v1\AccountsController::update'
      parameters:
        -
          name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        200:
          description: 'An account object'
        401:
          description: 'Unauthorized access'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/error-response'
        400:
          description: 'Bad request, save failed'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/error-response'
      servers:
        -
          url: 'https://api.API.com/v1'
components:
  schemas:
    account:
      title: 'account object'
      description: 'A single account object.'
      required:
        - ur_account_id
        - name
        - address1
        - city
        - state
        - zip
        - country_code
        - phone
        - email
      properties:
        _id:
          description: 'Unique identifier to include in path to get a single record.'
          type: string
        ur_account_id:
          description: 'The unique account ID.'
          type: string
        name:
          description: 'The name associated with the account'
          type: string
        address_1:
          description: 'The street address for the account.'
          type: string
        address_2:
          description: 'The Suite number, PO Box Number, Floor Number, etc, for the account.'
          type: string
        city:
          description: 'The city the account is resides in.'
          type: string
        state:
          description: 'The two letter abbreviation of the state the account resides in'
          type: string
        zip:
          description: 'The Postal Code the account resides in.'
          type: string
        country_code:
          description: 'Country code associated with the account.'
          type: string
        phone:
          description: 'The phone number associated with the account.'
          type: string
        phone_alpha:
          description: 'The phone number associated with the account.'
          type: string
        email:
          description: 'Email associated with the account'
          type: string
        require_po:
          description: 'Whether the account requires a PO.'
          type: string
        status:
          description: 'Status of current account'
          type: boolean
tags:
  -
    name: accounts
    description: 'Everything about accounts'
    externalDocs:
      description: 'Find out more'
      url: 'http://admin.API.com/documents' ```




...