将OpenAPI3.0YAML导入邮递员7.1

将OpenAPI3.0YAML导入邮递员7.1,yaml,postman,openapi,json-api,openapi-generator,Yaml,Postman,Openapi,Json Api,Openapi Generator,我想将一个OpenAPI3.0YAML文件导入postman,v。7.1.1 我正在使用darkaonline/l5 swagger在Laravel中生成OpenApi 3.0文档。生成的open api 3.0 yaml文件在粘贴到editor.swagger.io时会生成一个无错误的输出。该api是根据json:api规范编写的(或打算这样做)。 当文件导入到postman(V7.1.1)时,会生成此错误:“导入OpenAPI3.0时出错:无法导入”我读过的所有文档都说postman现在支持

我想将一个OpenAPI3.0YAML文件导入postman,v。7.1.1

我正在使用darkaonline/l5 swagger在Laravel中生成OpenApi 3.0文档。生成的open api 3.0 yaml文件在粘贴到editor.swagger.io时会生成一个无错误的输出。该api是根据json:api规范编写的(或打算这样做)。 当文件导入到postman(V7.1.1)时,会生成此错误:“导入OpenAPI3.0时出错:无法导入”我读过的所有文档都说postman现在支持OpenAPI3.0。我试着从Zircote的github加载OpenApi 3.0 yaml示例,它们导入得很好。不过,它们比我们的文档要简单得多。 代码摘录:警告这是很多,但我觉得我需要提供足够的上下文(它实际上是完整文档的一小部分--文件有2000行长):


问题在于,在每个path对象的servers对象中,我只定义了基本URL,因为某种原因,假设基本URL将与路径连接。如果在path对象中定义服务器对象,则必须使用端点的完整URL。因为我定义了一个在servers对象中不存在的path变量,所以在/{id}端点上给了我错误。问题是,在每个path对象的servers对象中,我只定义了基本URL,因为某种原因,假设基本URL将与路径连接。如果在path对象中定义服务器对象,则必须使用端点的完整URL。因为我在第8行的servers对象中定义了一个不存在的path变量,
/accounts
前面有一个额外的空间,这会弄乱YAML缩进,并导致解析错误。Helen!谢谢你的回复。缩进错误只是由于复制和粘贴造成的。缩进在我的文件中是正确的——当我在swagger编辑器中修改它时,它抛出了一个错误。如果您的OpenAPI定义根据swagger编辑器是有效的,那么这可能是邮递员的问题。向他们的支持提交一张票。谢谢,海伦。我会的。我确实将问题隔离到了声明路径变量的位置(例如第93行)。我比较了其他OpenAPI3.0YAML文件的路径变量声明,据我所知是相同的。(除了单引号,description prop,我对其进行了调整,结果没有改变。)如果我将
中的
属性更改为
query
,它实际上可以导入,尽管它是无效的。在第8行,
/accounts
前面有一个额外的空格,这会弄乱YAML缩进并导致解析错误。嗨,海伦!谢谢你的回复。缩进错误只是由于复制和粘贴造成的。缩进在我的文件中是正确的——当我在swagger编辑器中修改它时,它抛出了一个错误。如果您的OpenAPI定义根据swagger编辑器是有效的,那么这可能是邮递员的问题。向他们的支持提交一张票。谢谢,海伦。我会的。我确实将问题隔离到了声明路径变量的位置(例如第93行)。我比较了其他OpenAPI3.0YAML文件的路径变量声明,据我所知是相同的。(除了单引号,description prop,我调整后没有变化。)如果我将
prop中的
更改为
query
,它实际上可以导入,尽管它是无效的。你能分享邮递员接受的最终格式吗。我在导入带有路径参数的端点时也遇到问题。我用不同的组合尝试了path对象中的服务器对象,但没有成功。@ThomasDietrichandley能否请您共享更新的yaml文件。我试图在postman中使用opnapi.json文件导入,postman显示了相同的问题,即“导入时出错:无法识别格式”。我尝试过传递完整的url。例如:“服务器”:[“url”:“FULL_url”]但是它失败了,并且出现了相同的错误。您可以共享邮递员接受的最终格式吗。我在导入带有路径参数的端点时也遇到问题。我用不同的组合尝试了path对象中的服务器对象,但没有成功。@ThomasDietrichandley能否请您共享更新的yaml文件。我试图在postman中使用opnapi.json文件导入,postman显示了相同的问题,即“导入时出错:无法识别格式”。我尝试过传递完整的url。例如:“服务器”:[“url”:“FULL_url”]但它失败,并出现相同的错误。
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' ```