Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

导入swagger文件失败,格式经过swagger.editor验证 #22

Closed
hua-js opened this issue Jan 25, 2021 · 1 comment
Closed

导入swagger文件失败,格式经过swagger.editor验证 #22

hua-js opened this issue Jan 25, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@hua-js
Copy link

hua-js commented Jan 25, 2021

Bug 描述
Uncaught (in promise) TypeError: Cannot convert undefined or null to object
at Function.keys ()
at importDataTypes (/src/lib/NEI_import/dist/NEISwagger.js:13399)
at /src/lib/NEI_import/dist/NEISwagger.js:13436

预期期望
如果是文件格式错误,希望能有个demo参照;
如果格式没有错误,我应该如何使用导入swagger这个功能

导入文件
swagger: '2.0'
info:
version: 1.0.0
title: Simple Artist API
description: A simple API to understand the Swagger Specification in greater detail
schemes:

  • https
    host: example.io
    basePath: /v1
    securityDefinitions:
    UserSecurity:
    type: basic
    security:

    • UserSecurity: []
      paths:
      /artists:
      get:
      description: Returns a list of artists
      parameters:
      - name: limit
      in: query
      type: integer
      description: Limits the number of items on a page
      - name: offset
      in: query
      type: integer
      description: Specifies the page number of the artists to be displayed

      responses:
      200:
      description: Successfully returned a list of artists
      schema:
      type: array
      items:
      type: object
      required:
      - username
      properties:
      artist_name:
      type: string
      artist_genre:
      type: string
      albums_recorded:
      type: integer
      username:
      type: string

      400:
        description: Invalid request 
        schema:
          type: object
          properties:   
            message:
              type: string
      

      post:
      description: Lets a user post a new artist
      parameters:
      - name: artist
      in: body
      description: creates a new artist in our database
      schema:
      type: object
      required:
      - username
      properties:
      artist_name:
      type: string
      artist_genre:
      type: string
      albums_recorded:
      type: integer
      username:
      type: string

      responses:
      200:
      description: Successfully created a new artist

      400:
        description: Invalid request 
        schema:
          type: object
          properties:   
            message:
              type: string
      

    ----- Added lines ----------------------------------------

    /artists/{username}:
    get:
    description: Obtain information about an artist from his or her unique username
    parameters:
    - name: username
    in: path
    type: string
    required: true

    responses:
      200:
        description: Successfully returned an artist
        schema:
          type: object
          properties:
            artist_name:
              type: string
            artist_genre:
              type: string
            albums_recorded:
              type: integer
              
      400:
        description: Invalid request
        schema:
          type: object 
          properties:           
            message:
              type: string
    

    ---- /Added lines ----------------------------------------

@hua-js hua-js added the bug Something isn't working label Jan 25, 2021
@xuchaoying
Copy link

这是由于没有对数据模型判空导致的bug,我们稍后修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants