Giter Site home page Giter Site logo

swagger_spec_validator's Introduction

swagger_spec_validator

Build Status Coverage Status Latest Version

About

Swagger Spec Validator is a Python library that validates Swagger Specs against the Swagger 1.2 or Swagger 2.0 specification. The validator aims to check for full compliance with the Specification.

Example Usage

Validate a spec from a url:

from swagger_spec_validator import validate_spec_url

# example for swagger spec v1.2
validate_spec_url('http://petstore.swagger.io/api/api-docs')

# example for swagger spec v2.0
validate_spec_url('http://petstore.swagger.io/v2/swagger.json')

Documentation

More documentation is available at http://swagger_spec_validator.readthedocs.org

Installation

$ pip install swagger_spec_validator

Contributing

  1. Fork it ( http://github.com/Yelp/swagger_spec_validator/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Copyright (c) 2015, Yelp, Inc. All rights reserved. Apache v2

swagger_spec_validator's People

Contributors

analogue avatar asottile avatar atran2 avatar benbariteau avatar brycedrennan avatar cdunklau avatar ceridwen avatar daym avatar dnephin avatar drpoggi avatar googlygoo avatar ignatenkobrain avatar jnb avatar kaisen avatar kentwills avatar macisamuele avatar mangin avatar mattmetlis avatar max-muoto avatar prat0318 avatar sanga avatar sjaensch avatar ymilki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swagger_spec_validator's Issues

swagger_spec failed to validated file type on response.

spec-first/connexion#324

Description

When i code my swagger on editor.swagger.io , its work properly. however when i try to run connexion, i got the following execution error:

swagger_spec_validator.common.SwaggerValidationError: {'description': 'Download static files', 'schema': {'description': 'binary file', 'type': 'file'}} is not valid under any of the given schemas

I can not found a good example how to return a file as response. Someone can help me?

Expected bahaviour

paths:
  /download/{filename}:
    get:
      tags:
      - "files"
      description: |
        Download static files
      operationId: "controllers.static_controller.download_get"
      parameters:
      - name: "filename"
        in: "path"
        description: "Issue number"
        required: true
        type: "string"
      responses:
        200:
          description: "Download static files"
          schema:
            description: "binary file"
            type: "file"
            #$ref: "#/definitions/Issue"
        default:
          description: "Unexpected error"
          schema:
            $ref: "#/definitions/Error"
      security:
      - UserSecurity: []

Actual behaviour

ile "/usr/local/lib/python3.5/dist-packages/connexion/app.py", line 149, in add_api
    debug=self.debug)
  File "/usr/local/lib/python3.5/dist-packages/connexion/api.py", line 109, in __init__
    validate_spec(spec)
  File "/usr/local/lib/python3.5/dist-packages/swagger_spec_validator/validator20.py", line 82, in validate_spec
    http_handlers=http_handlers)
  File "/usr/local/lib/python3.5/dist-packages/swagger_spec_validator/common.py", line 22, in wrapper
    sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.5/dist-packages/swagger_spec_validator/common.py", line 17, in wrapper
    return method(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/swagger_spec_validator/validator20.py", line 125, in validate_json
    cls=Draft4Validator)
  File "/usr/local/lib/python3.5/dist-packages/swagger_spec_validator/ref_validators.py", line 34, in validate
    instance_cls(schema, *args, **kwargs).validate(instance)
  File "/usr/local/lib/python3.5/dist-packages/jsonschema/validators.py", line 123, in validate
    raise error
swagger_spec_validator.common.SwaggerValidationError: {'description': 'Download static files', 'schema': {'description': 'binary file', 'type': 'file'}} is not valid under any of the given schemas

Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['get']['properties']['responses']['patternProperties']['^([0-9]{3})$|^(default)$']:
    {'oneOf': [{'$ref': '#/definitions/response'},
               {'$ref': '#/definitions/jsonReference'}]}

On instance['paths']['/download/{filename}']['get']['responses']['200']:
    {'description': 'Download static files',
     'schema': {'description': 'binary file', 'type': 'file'}}

Steps to reproduce

./run.sh 
[2016-10-24 12:40:46 -0200] [8834] [INFO] Starting gunicorn 19.6.0
[2016-10-24 12:40:46 -0200] [8834] [INFO] Listening at: http://0.0.0.0:8080 (8834)
[2016-10-24 12:40:46 -0200] [8834] [INFO] Using worker: gevent
[2016-10-24 12:40:46 -0200] [8837] [INFO] Booting worker with pid: 8837
[2016-10-24 12:40:46 -0200] [8838] [INFO] Booting worker with pid: 8838
[2016-10-24 12:40:46 -0200] [8837] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/swagger_spec_validator/common.py", line 17, in wrapper
    return method(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/swagger_spec_validator/validator20.py", line 125, in validate_json
    cls=Draft4Validator)
  File "/usr/local/lib/python3.5/dist-packages/swagger_spec_validator/ref_validators.py", line 34, in validate
    instance_cls(schema, *args, **kwargs).validate(instance)
  File "/usr/local/lib/python3.5/dist-packages/jsonschema/validators.py", line 123, in validate
    raise error
jsonschema.exceptions.ValidationError: {'description': 'Download static files', 'schema': {'description': 'binary file', 'type': 'file'}} is not valid under any of the given schemas

Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['get']['properties']['responses']['patternProperties']['^([0-9]{3})$|^(default)$']:
    {'oneOf': [{'$ref': '#/definitions/response'},
               {'$ref': '#/definitions/jsonReference'}]}

On instance['paths']['/download/{filename}']['get']['responses']['200']:
    {'description': 'Download static files',
     'schema': {'description': 'binary file', 'type': 'file'}}

During handling of the above exception, another exception occurred:

cat run.sh 
#gunicorn -w 9 -b 0.0.0.0:8080 wsgi -t 3600 -k gevent
gunicorn -w 2 -b 0.0.0.0:8080 wsgi -t 3600 -k gevent
#gunicorn -w 2 -b 0.0.0.0:8080 wsgi -t 3600 -k gevent

#celery -A wsgi worker --loglevel=info


my wsgi.py

if __name__ == "__main__":
    #app_run()
    application.run() #(threaded=True)
    #application.run(host='0.0.0.0',port=8080)


Additional info:

pip3 show connexion | grep "^Version:"
Version: 1.0.129
python3 --version
Python 3.5.2

Output of the commands:

  • python --version
  • pip show connexion | grep "^Version\:"

Receive urlopen error on Windows platform

Works as expected on versions prior to and including 2.1.0. Broken on 2.2.0 and 2.3.0.
Receive the following URLerror exception when validating file with absolute path on Windows system.

"c" being the c:\ in the filename

  File "C:\Users\adelo\venv\lib\site-packages\swagger_spec_validator\validator20.py", line 120, in validate_json
    schema = read_file(schema_path)
  File "C:\Users\adelo\venv\lib\site-packages\swagger_spec_validator\common.py", line 39, in read_file
    return read_url(urljoin('file://', file_path))
  File "C:\Users\adelo\venv\lib\site-packages\swagger_spec_validator\common.py", line 43, in read_url
    with contextlib.closing(urlopen(url, timeout=timeout)) as fh:
  File "C:\Python27\Lib\urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python27\Lib\urllib2.py", line 429, in open
    response = self._open(req, data)
  File "C:\Python27\Lib\urllib2.py", line 452, in _open
    'unknown_open', req)
  File "C:\Python27\Lib\urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "C:\Python27\Lib\urllib2.py", line 1266, in unknown_open
    raise URLError('unknown url type: %s' % type)
SwaggerValidationError: ('<urlopen error unknown url type: c>', URLError(u'unknown url type: c',))

Invalid specs are accepted from swagger spec validator (operation responses cannot contain references)

While working on Yelp/bravado-core#263, @sjaensch noticed that the produces swagger specs were not valid :(
This was caused by the fact that we started from invalid swagger specs and that swagger_spec_validator didn't spot the validation issue.

According to swagger 2.0 specs responses object should not contain references.
Allowed attributes are "default", http status codes, x-vendor attributes.

How to reproduce the described issue

In [1]: import sys

In [2]: sys.platform
Out[2]: 'darwin'

In [3]: sys.version_info
Out[3]: sys.version_info(major=3, minor=6, micro=5, releaselevel='final', serial=0)

In [4]: from swagger_spec_validator.validator20 import validate_json

In [5]: spec_dict = {
   ...:   "swagger": "2.0",
   ...:   "info": {
   ...:     "title": "Test",
   ...:     "version": "1.0"
   ...:   },
   ...:   "responses": {
   ...:     "default": {
   ...:         "description": "any response"
   ...:     }
   ...:   },
   ...:   "paths": {
   ...:     "/endpoint": {
   ...:         "get": {
   ...:             "responses": {
   ...:                 "$ref": "#/responses"
   ...:             }
   ...:         }
   ...:     }
   ...:   }
   ...: }

In [6]: validate_json(spec_dict, 'schemas/v2.0/schema.json')
Out[6]: <jsonschema.validators.RefResolver at 0x10bcde128>

In [7]:
Do you really want to exit ([y]/n)? y

Validation depends on stability of external servers

Validation schema (swagger_spec_validator\schemas\v2.0\schema.json) inside package depends on external resurces like

    "title": {
      "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
    },

If external server doesn't work (For example it respond with 503 at 27 Sep 2016) then REST service can't start due validation error.

Generally this means "not for production" for all swagger+python infrastructure.

Suggested sulution - exclude usage of external resources for validation (inline or copy file locally)

Validate `consumes` contains a valid mime-type for `file` based parameters

Implement this validation in ssv:

def add_file(param, value, request):
    """Add a parameter of type 'file' to the given request.

    :type param: :class;`bravado.mapping.param.Param`
    :param value: The raw content of the file to be uploaded
    :type request: dict
    """
    if request.get('files') is None:
        # support multiple files by default by setting to an empty array
        request['files'] = []

        # The http client should take care of setting the content-type header
        # to 'multipart/form-data'. Just verify that the swagger spec is
        # conformant
        expected_mime_type = 'multipart/form-data'
        if expected_mime_type not in param.op.consumes:
            raise SwaggerMappingError((
                "Mime-type '{0}' not found in list of supported mime-types for "
                "parameter '{1}' on operation '{2}': {3}").format(
                    expected_mime_type,
                    param.name,
                    param.op.operation_id,
                    param.op.consumes
                ))

    file_tuple = ('file', (param.name, value))
    request['files'].append(file_tuple)

[2.0.4] Validation failure with path parameter

Abstract

When I swagger_spec_validator 2.0.4 (actually in my case, it's called from bravado-core) with path parameter, it fails all time.

Reproduce sample

spec.json

{
  "swagger": "2.0",
  "info": {
    "title": "Sample",
    "version": "1.0.0"
  },
  "schemes": [
    "http"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/api/v1/communications/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "type": "string"
        }
      ],
      "get": {
        "tags": [
          "Communications"
        ],
        "operationId": "CommunicationsDetail_read",
        "responses": {
          "200": {
            "description": "success",
            "schema": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}

python code

import json
from swagger_spec_validator import validator20

spec = json.load(open('spec.json'))
validator20.validate_spec(spec)

SwaggerValidationError:

Traceback (most recent call last):
  File "main.py", line 5, in <module>
    validator20.validate_spec(spec)
  File "/Users/takuro/git/swagger-validator-sandbox/venv/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 82, in validate_spec
    http_handlers=http_handlers)
  File "/Users/takuro/git/swagger-validator-sandbox/venv/lib/python3.6/site-packages/swagger_spec_validator/common.py", line 22, in wrapper
    sys.exc_info()[2])
  File "/Users/takuro/git/swagger-validator-sandbox/venv/lib/python3.6/site-packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/Users/takuro/git/swagger-validator-sandbox/venv/lib/python3.6/site-packages/swagger_spec_validator/common.py", line 17, in wrapper
    return method(*args, **kwargs)
  File "/Users/takuro/git/swagger-validator-sandbox/venv/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 125, in validate_json
    cls=Draft4Validator)
  File "/Users/takuro/git/swagger-validator-sandbox/venv/lib/python3.6/site-packages/swagger_spec_validator/ref_validators.py", line 34, in validate
    instance_cls(schema, *args, **kwargs).validate(instance)
  File "/Users/takuro/git/swagger-validator-sandbox/venv/lib/python3.6/site-packages/jsonschema/validators.py", line 130, in validate
    raise error
swagger_spec_validator.common.SwaggerValidationError: {'name': 'id', 'in': 'path', 'type': 'string'} is not valid under any of the given schemas

Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['parameters']['items']:
    {'oneOf': [{'$ref': '#/definitions/parameter'},
               {'$ref': '#/definitions/jsonReference'}]}

On instance['paths']['/api/v1/communications/{id}']['parameters'][0]:
    {'in': 'path', 'name': 'id', 'type': 'string'}

This error occurs with 2.0.4. 2.0.2 does not raise any validation error with this spec.

Conclusion

I think it may be a bug related to 2.0.4. It would be great if you could patch this bug. Or if I can find time, I will send PR.

MIME type with period causes validation to fail

Here is a very simple swagger spec, which I created with the Swagger Editor:

$ cat /tmp/swagger.json 
{
    "swagger": "2.0",
    "info": {
        "title": "example",
        "version": "1.0.0"
    },
    "schemes": [
        "https"
    ],
    "produces": [
        "application/vnd.example+json"
    ],
    "paths": {
        "/products": {
            "get": {
                "summary": "stuff",
                "description": "stuff",
                "responses": {
                    "200": {
                        "description": "array of strings",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "examples": {
                            "application/vnd.example+json": [
                                "foo",
                                "bar"
                            ]
                        }
                    }
                }
            }
        }
    }
}

If I use swagger_spec_validator on this, it fails:

$ python -c 'import swagger_spec_validator as v; v.validate_spec_url("file:///tmp/swagger.json")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/common.py", line 22, in wrapper
    sys.exc_info()[2])
  File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/common.py", line 17, in wrapper
    return method(*args, **kwargs)
  File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/util.py", line 53, in validate_spec_url
    validator.validate_spec(spec_json, spec_url)
  File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/validator20.py", line 82, in validate_spec
    http_handlers=http_handlers)
  File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/common.py", line 22, in wrapper
    sys.exc_info()[2])
  File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/common.py", line 17, in wrapper
    return method(*args, **kwargs)
  File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/validator20.py", line 125, in validate_json
    cls=Draft4Validator)
  File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/swagger_spec_validator/ref_validators.py", line 34, in validate
    instance_cls(schema, *args, **kwargs).validate(instance)
  File "/var/lib/venv/tapi/local/lib/python2.7/site-packages/jsonschema/validators.py", line 123, in validate
    raise error
swagger_spec_validator.common.SwaggerValidationError: {u'examples': {u'application/vnd.example+json': [u'foo', u'bar']}, u'description': u'array of strings', u'schema': {u'items': {u'type': u'string'}, u'type': u'array'}} is not valid under any of the given schemas

Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['get']['properties']['responses']['patternProperties']['^([0-9]{3})$|^(default)$']:
    {'oneOf': [{'$ref': '#/definitions/response'},
               {'$ref': '#/definitions/jsonReference'}]}

On instance['paths'][u'/products']['get']['responses'][u'200']:
    {u'description': u'array of strings',
     u'examples': {u'application/vnd.example+json': [u'foo', u'bar']},
     u'schema': {u'items': {u'type': u'string'}, u'type': u'array'}}

It appears that the reason for the failure is the period in the MIME type used in the examples object. If I remove the period:

--- swagger.json.orig	2017-02-02 11:55:49.539545943 -0500
+++ swagger.json	2017-02-02 11:55:53.799656809 -0500
@@ -25,7 +25,7 @@
                             }
                         },
                         "examples": {
-                            "application/vnd.example+json": [
+                            "application/vndexample+json": [
                                 "foo",
                                 "bar"
                             ]

then validation passes:

$ python -c 'import swagger_spec_validator as v; v.validate_spec_url("file:///tmp/swagger.json")'

No way to define empty array as default value

Hello! We had code working with v2.1.0 that got broken recently.

Our spec had two array params (one CSV, one SSV) that are optional on the client side, with a default in the spec so that the server code (which gets parameters automatically validated / transformed according to the swagger spec) can work with a list (empty or not) without needing type checks or none checks everywhere.

Spec: type: array, collectionFormat: csv, default: ''

This used to be transformed into an empty list automatically. This seemed perfect: clients don’t have to send the param, the lib applies transforms to the default (split on comma or space), the server code always gets a list.

After updating to 2.3.1, default: '' fails because it’s not a list, and default: [] fails because a list does not have a split method. From a quick search, it seems like the default value should be of the specified type (so list and not string), which I think was done in #95, but then it should be allowed to specify an empty list as default.

Thanks!

Parameter Definitions

The current swagger schema for v2.0 doesn't allow for a parameter to be defined as only a reference:
http://swagger.io/specification/#parameterObject

        "parameters": [
          { "$ref": "#/parameters/skipParam" },
          { "$ref": "#/parameters/limitParam" }
        ],

Taken from: https://github.com/OAI/OpenAPI-Specification/blob/master/fixtures/v2.0/json/resources/reusableParameters.json#L36

Only the bodyParameter allows you to specify the schema property (though still needs you to specify name and in). While the nonBodyParameter does not support a mechanism for passing a schema.

It seems like the parameter definition should support the schema definition.

Identified regression on version 2.4.2

swagger_spec_validator==2.4.2 introduced a regression while validating swagger spec split in multiple files.

The regression is caused by dereferencing references without keeping into account the scope (in which file was the reference defined)

Swagger Object-level Parameters Raise an Error

I'm using swagger object-level parameters with swagger 2.0. When I reference them in the path's parameters property as "$ref": "#/parameters/MyParam" I get an error:
swagger_spec_validator.common.SwaggerValidationError: 'name'

As an example the instagram.yaml demo file used in http://editor.swagger.io raises the same error for the "user-id" and "tag-name" parameters.

Both my swagger.json and the demo file mentioned render in Swagger-UI without error.

jsonschema.exceptions.ValidationError in code generated for python-flask

Hi there, I tried to get an issue solved when I was using Swagger Editor and the python-flask code it generated, and I was referred to your project.

One of their people believed that

Okay, I think I see now - looks like the validator you're using is looking at the Swagger 2.0 JSON Schema document.

This seems to be a bug with the swagger_spec_validator project not being able to consume the Swagger schema correctly, not a problem with Swagger Editor not catching something.

I'm going to close this for now, but if you file a bug with that project and they think Swagger Editor is doing something wrong, ping me here and I'd be happy to take another look.

Thanks! 😄

The link to the issue: swagger-api/swagger-editor#1912

Thank you!

I also attached the original post just FYI.

  • OS: Win
  • Browser: Chrome
  • Version: latest
  • Method of installation: docker
  • Swagger-Editor version: 3.6.16
  • Swagger/OpenAPI version:Swagger 2.0,

Content & configuration

Tried to start debugging after installing requirements. Reported error while editor didn't report any.

Swagger/OpenAPI definition:

swagger: "2.0"
info:
  title: ProjectAgora
  description: >-
    Optional multiline or single-line description in
    [CommonMark](http://commonmark.org/help/) or HTML.
  version: 0.0.1
host: 127.0.0.1:5000
basePath: /v1
schemes: 
  - https
consumes: 
  - application/json
produces: 
  - application/json
securityDefinitions:
  APIKeyHeader: 
    type: apiKey
    in: header
    name: api_key
security:
  - APIKeyHeader: []
  
definitions:
  Error:
    description: 错误
    properties:
      code: 
        type: integer
        example: 401
      message: 
        type: string    
  TokenStatus:
    description: Token信息
    properties:
      token:
        type: string
      expireBy:
        type: string
      refreshed:
        type: boolean
  LoginRequest:
    description: 登陆请求
    properties:
      username:
        type: string
      password:
        type: string
  Learner:
    description: 学习者
    properties:
      id:
        description: ID
        type: integer
      name:
        description: 全名
        type: string
      nickname:
        description: 昵称
        type: string
      isMentor:
        description: 是否导师
        type: boolean
      gender:
        description: 性别
        type: string
      status:
        description: 目前状态,包括在读、在读(游学)、在读(试读)、毕业、导师等;考虑是否需要更换成integer
        type: string
      birthday:
        description: 生日
        type: string
      mainPersonalIdType:
        description: 证件类型
        type: string
      mainPersonalId:
        description: 证件号码
        type: string
      age:
        description: 年龄(应当是计算字段)
        type: number
      ethnicity:
        description: 民族
        type: string
      phoneNumber:
        description: 电话号码
        type: string
      dateOfRegistration:
        description: 加入时间
        type: string
      reasonOfRegistration:
        description: 加入原因
        type: string
      previousStatus:
        description: 加入前状态
        type: string
      dateOfLeave:
        description: 离开时间
        type: string
      reasonOfLeave:
        description: 离开原因
        type: string
      destinationOfLeave:
        description: 下阶段目的地
        type: string
      notes:
        description: 备注
        type: array
        items: 
          type: string
      mentorship:
        description: 导师关系 (object类型 - 导师类型 - learnerID), 分有负责导师mentorResponsible,协同导师mentorSupportive, 家校沟通导师mentorCommunicative)
        type: object
      salaryCard:
        description: 工资卡号
        type: string
      custodianInfo:
        description: 监护人信息
        type: object
        properties: 
          name:
            description: 姓名
            type: string
          relationship:
            description: 关系 
            type: string
      emergentContact:
        description: 紧急联系人
        type: array
        items:
          type: object
          properties:
            name: 
              description: 紧急联系人姓名
              type: string
            number:
              description: 紧急联系人电话
              type: string
      weChatContact:
        description: 微信
        type: string
      QQ:
        description: QQ
        type: string
      mailAddress:
        description: 收件地址(用以寄送书面文件)
        type: string
      email:
        description: 电子邮箱
        type: string
      medicalNotes:
        description: 医疗记录
        type: object
        properties:
          generalHealthStatus:
            description: 整体健康状况;0 - 很好(基本不生病,从不住院); 1 - 一般(偶尔生病住院); 2 - 欠佳(每个季度都曾生病住院)
            type: integer
            enum: [0, 1, 2]
          bloodType:
            description: 血型
            type: string
          lastPhysicalExam:
            description: 最近一次体检时间(以年为单位)
            type: number
          previousDiagnosis:
            description: 既往疾病
            type: array
            items:
              type: object
              properties: 
                nameOfDiagnosis:
                  description: 疾病名称
                  type: string
                hospitalOfDiagnosis:
                  description: 诊断医院
                  type: string
          regularMedication:
            description: 长期用药
            type: array
            items:
              type: object
              properties:
                nameOfMedication:
                  description: 药品名
                  type: string
                instructionOfMedication:
                  description: 用药医嘱
                  type: string
          foodAlergy:
            description: 食物过敏
            type: object
            properties:
              lactoseIntolerance: 
                description: 奶类过敏(乳糖不耐受)
                type: boolean
              eggAllergy:
                description: 禽蛋类过敏
                type: boolean
              fishAllergy:
                description: 鱼类过敏
                type: boolean
              shellAllergy:
                description: 甲壳类(虾蟹、贝类水产等)
                type: boolean
              peanutAllergy:
                description: 花生过敏
                type: boolean
              soyBeanAllergy:
                description: 大豆过敏
                type: boolean
              nutAllergy:
                description: 坚果类过敏
                type: boolean
              wheatAllergy:
                description: 小麦过敏
                type: boolean
              otherFoodAllergy:
                description: 其他食物过敏
                type: array
                items:
                  type: string
          medicationAllergy:
            description: 药物过敏
            type: object
            properties:
              antibioticsAllergy:
                description: 抗生素过敏(青霉素、氨基苄青霉素、链霉素、卡那霉素)
                type: boolean
              sulfonamidesAllergy:
                description: 磺胺类药物过敏(磺胺噻唑、磺胺嘧啶、长效磺胺、复方新诺明等)
                type: boolean
              painkillerAllergy:
                description: 解热镇痛药(阿司匹林、去痛片)
                type: boolean
              anestheticAllergy:
                description: 麻醉用药(普鲁卡因)
                type: boolean
              vaccineAllergy:
                description: 疫苗类药物
                type: boolean
              otherMedicationAllergy:
                description: 其他药物过敏
                type: array
                items:
                  type: string
    required:
      - name
      - isMentor
  Project:
    description: 项目
    properties:
      id:
        description: 项目ID
        type: integer
      name: 
        description: 项目名称
        type: string
      createdTime:
        description: 创建时间
        type: string
      createdBy:
        description: 创建人ID
        type: integer
      relatedCourseId:
        description: 关联的课程ID;自由项目的课程ID为0
        type: integer
      content: 
        description: 项目记录的条目
        type: array
        items: 
          type: object
          properties:
            timestamp:
              description: 条目时间戳
              type: string
            instruction:
              description: 课程项目中教师为各条目定义的内容(暂定使用Markdown编码)
              type: string
            record:
              description: 学生记录(暂定使用Markdown编码)
              type: string
    required:
      - name
      - createdTime
      - createdBy
      - relatedCourseId
  Course:
    description: 课程
    properties:
      id:
        description: 课程ID
        type: integer
      name:
        description: 课程名称
        type: string
      createdTime: 
        description: 创建时间 
        type: string
      createdBy:
        description: 创建人ID
        type: integer
paths:
  /login:
    get:
      summary: 获取当前Token信息
      tags: 
        - Authentication
      responses:
        '200':
          description: 获取当前Token信息成功
          schema:
            $ref: '#/definitions/TokenStatus'
        '401':
          description: 无法获取当前Token信息
          headers:
            WWW_Authenticate:
              type: string
    post:
      summary: 尝试登陆
      tags: 
        - Authentication
      parameters:
        - in: body
          name: login
          required: true
          schema:
            $ref: '#/definitions/LoginRequest'
      responses:
        '200':
          description: 登陆成功
          schema:
              $ref: '#/definitions/TokenStatus'
        '401':
          description: 登陆失败
          schema:
                $ref: "#/responses/UnauthorizedError"
  /learner:
    head:
      summary: 返回所有Learner的关键信息
      tags: 
        - Learner
      responses:
        '200':
          description: 成功
          schema:
              type: object
              properties:
                id:
                  type: integer
                  example: 1
                name:
                  type: string
                  example: John Appleseed
        '401':
          description: 登陆失败
          schema:
            $ref: "#/responses/UnauthorizedError"
    get:
      summary: 返回所有的Leaner详细信息
      tags: 
        - Learner
      description: 返回所有的Leaner详细信息
      responses:
        '200':
          description: A JSON array of user names
          schema:
              $ref: '#/definitions/Learner'
        '401':
          $ref: "#/responses/UnauthorizedError"
    post:
      summary: 创建一个Learner
      tags: 
        - Learner
      parameters:
        - in: body
          name: login
          required: true
          schema:
              $ref: '#/definitions/Learner'
      responses:
        '201':
          description: 创建成功
          schema:
            description: 成功创建的Learner的ID
            type: object
            properties:
              id:
                type: integer
        '401':
          $ref: "#/responses/UnauthorizedError"  
  '/learner/{learnerId}':
    get:
      summary: 返回一个Learner的详细信息
      tags: 
        - Learner
      parameters:
        - in: path
          name: learnerId
          required: true
          type: integer
          format: int64
          minimum: 1
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/Learner'
        '401':
          $ref: "#/responses/UnauthorizedError"


responses:
  UnauthorizedError:
    description: API key is missing or invalid
    headers:
      WWW_Authenticate:
        type: string
            

Error information:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\swagger_spec_validator\common.py", line 17, in wrapper
    return method(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\swagger_spec_validator\validator20.py", line 125, in validate_json
    cls=Draft4Validator)
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\swagger_spec_validator\ref_validators.py", line 34, in validate
    instance_cls(schema, *args, **kwargs).validate(instance)
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\jsonschema\validators.py", line 130, in validate
    raise error
jsonschema.exceptions.ValidationError: {'description': '登陆失败', 'schema': {'$ref': '#/responses/UnauthorizedError', 'x-scope': ['']}} is not valid under any of the given schemas

Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['post']['properties']['responses']['patternProperties']['^([0-9]{3})$|^(default)$']:
    {'oneOf': [{'$ref': '#/definitions/response'},
               {'$ref': '#/definitions/jsonReference'}]}

On instance['paths']['/login']['post']['responses']['401']:
    {'description': '登陆失败',
     'schema': {'$ref': '#/responses/UnauthorizedError', 'x-scope': ['']}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\xct24\Documents\Git-AgoraAcademy\ProjectAgora\server\swagger_server\__main__.py", line 16, in <module>
    main()
  File "C:\Users\xct24\Documents\Git-AgoraAcademy\ProjectAgora\server\swagger_server\__main__.py", line 11, in main
    app.add_api('swagger.yaml', arguments={'title': 'ProjectAgora'})
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\connexion\apps\flask_app.py", line 54, in add_api
    api = super(FlaskApp, self).add_api(specification, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\connexion\apps\abstract.py", line 159, in add_api
    options=api_options.as_dict())
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\connexion\apis\abstract.py", line 92, in __init__
    validate_spec(spec)
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\swagger_spec_validator\validator20.py", line 82, in validate_spec
    http_handlers=http_handlers)
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\swagger_spec_validator\common.py", line 22, in wrapper
    sys.exc_info()[2])
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\six.py", line 692, in reraise
    raise value.with_traceback(tb)
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\swagger_spec_validator\common.py", line 17, in wrapper
    return method(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\swagger_spec_validator\validator20.py", line 125, in validate_json
    cls=Draft4Validator)
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\swagger_spec_validator\ref_validators.py", line 34, in validate
    instance_cls(schema, *args, **kwargs).validate(instance)
  File "C:\ProgramData\Anaconda3\envs\ProjectAgora\lib\site-packages\jsonschema\validators.py", line 130, in validate
    raise error
swagger_spec_validator.common.SwaggerValidationError: {'description': '登陆失败', 'schema': {'$ref': '#/responses/UnauthorizedError', 'x-scope': ['']}} is not valid under any of the given schemas

Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['post']['properties']['responses']['patternProperties']['^([0-9]{3})$|^(default)$']:
    {'oneOf': [{'$ref': '#/definitions/response'},
               {'$ref': '#/definitions/jsonReference'}]}

On instance['paths']['/login']['post']['responses']['401']:
    {'description': '登陆失败',
     'schema': {'$ref': '#/responses/UnauthorizedError', 'x-scope': ['']}}

I can't find clues of what went wrong as I did follow the docs step by step. Thank you very much!

Object composition with allOf and required

I have found an issue with object composition where swagger-spec-validator works one way and openapi-spec-validator (--schema 2.0) works a different way, and I'm not entirely sure which one is "wrong".

If I compose an object like this:

NameObject:
  properties:
    name:
      type: string

NameRequiredObject:
    allOf:
    - $ref: '#/definitions/NameObject'
    - properties:
        id:
          minLength: 1
          type: string
      type: object
    required:
    - id
    - name

it validates fine in swagger-spec-validator but openapi-spec-validator complains that it cannot find the required field 'name'.

If I change the definition of NameRequiredObject to:

NameRequiredObject:
    allOf:
    - $ref: '#/definitions/NameObject'
    - properties:
        id:
          minLength: 1
          type: string
      type: object
      required:
       - id
       - name

so that required is now part of the allOf object composition, swagger-spec-validator fails because it cannot find the name field, but openapi-spec-validator passes.

It's not clear from the Swagger2.0 spec whether the required attribute should be a property of the NameRequiredObject, or if it should be included in the allOf object composition, and clearly the two projects have implemented it differently.

I'm looking for a reference that will "decide" which format is "correct", and thus which tool is "correct". so my specs will pass validation by both tools.

Thanks,

Bob

Spec validation will not fail if items is not present and type is array

The following specs are not valid according to Swagger 2.0 Specs, editor.swagger.io and according to swagger-tools npm package.

swagger: '2.0'
info:
  title: Example
produces:
- application/json
paths:
  /test:
    get:
      responses:
        '200':
          description: HTTP200
          schema:
            type: array

Error reported by editor.swagger.io
https://image.ibb.co/ghkioJ/5186391944200192.png

Error reported by npm

API Errors:

  #/paths/~1test/get/responses/200/schema: Missing required property: items

1 error and 0 warnings

Responses object schema rejects file type

The following swagger spec json is deemed invalid (by the latest master):

{
    "swagger": "2.0",
    "info": {
        "version": "0.1",
        "title": "Avatar Downloader API"
    },
    "consumes": [
        "application/json"
    ],
    "produces": [
        "application/json"
    ],
    "paths": {
        "/avatars/{avatar_id}": {
            "get": {
                "summary": "Get an avatar",
                "operationId": "mycontroller.get_avatar",
                "produces": [
                    "application/octet-stream"
                ],
                "parameters": [
                    {
                        "name": "avatar_id",
                        "in": "path",
                        "description": "Avatar's unique identifier",
                        "required": true,
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9-_]+$"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Avatar file",
                        "schema": {
                            "type": "file"
                        }
                    },
                    "404": {
                        "description": "Avatar does not exist"
                    }
                }
            }
        }
    }
}

This is due to the "file" type in the response schema:

swagger_spec_validator.common.SwaggerValidationError: {u'description': u'Avatar file', u'schema': {u'type': u'file'}} is not valid under any of the given schemas

Failed validating u'oneOf' in schema[u'properties'][u'paths'][u'patternProperties'][u'^/'][u'properties'][u'get'][u'properties'][u'responses'][u'patternProperties'][u'^([0-9]{3})$|^(default)$']:
    {u'oneOf': [{u'$ref': u'#/definitions/response'},
                {u'$ref': u'#/definitions/jsonReference'}]}

On instance[u'paths'][u'/avatars/{avatar_id}'][u'get'][u'responses'][u'200']:
    {u'description': u'Avatar file', u'schema': {u'type': u'file'}}

I think this is wrong because http://editor.swagger.io/ deems it valid, and the spec http://swagger.io/specification/#responseObject seems to say this is allowed.

Regression for Swagger 1.2 schemas in release 2.0.1

Swagger 1.2 and 2.0 schemas both call the same common.validate_json(..) method . In release 2.0.1, this method was updated to support recursive $refs and no longer supports unqualified refererences to models. This change should only apply to Swagger 2.0 schemas. Passing in a 1.2 schema with unqualified $refs is broken.

Spec validation does not validate inline models

swagger-spec-validator has custom methods to validate definitions and apis.

We have mis-alignment between validation of schema objects:

  • defined in definitions (ie. #/definitions/definition_1)
  • defined inline in definitions (ie. #/definitions/definition_2/properties/prop)
  • defined inline in apis (ie. #/paths//endpoint/get/responses/200/schema)

It's reproducible with the following test case

SCHEMA_OBJECT = {
    'type': 'object',
    'properties': {'prop': {'type': 'string', 'default': 1}},
}


@pytest.mark.parametrize(
    'swagger_dict_override',
    (
        {
            'definitions': {'definition_1': SCHEMA_OBJECT},
        },
        {
            'definitions': {'definition_2': {
                'type': 'object',
                'properties': {'prop': SCHEMA_OBJECT},
            }},
        },
        {
            'paths': {
                '/endpoint': {
                    'get': {
                        'responses': {
                            '200': {'description': 'desc', 'schema': SCHEMA_OBJECT},
                        },
                    },
                },
            },
        },
    )
)
def test_highlight_inconsistent_schema_object_validation(swagger_dict_override):
    minimal_swagger_dict = {
        'swagger': '2.0',
        'info': {'title': 'Test', 'version': '1.0'},
        'paths': {},
        'definitions': {},
    }
    minimal_swagger_dict.update(swagger_dict_override)
    with pytest.raises(SwaggerValidationError):
        validate_spec(minimal_swagger_dict)

For the same invalid SCHEMA_OBJECT, validate_spec raises SwaggerValidationError if the object is defined in definitions but does not raise if in an inline definition

Multiple old versions at pypi.python.org

There are multiple versions of this library at https://pypi.python.org/pypi :

Both contain almost the same, old version of the code, namely this one:
https://github.com/Yelp/swagger_spec_validator/tree/v2.1.0

I am not sure whether it is intentional, but it seems like a mistake. I would assume that there should be a newer version available somewhere, which would be similar to the current master branch.

Test suite can fail on some hosts

I ran the test suite on my desktop, and ran into 3 test failures:

tests/util/validate_spec_url_test.py:10: test_raise_SwaggerValidationError_on_urlopen_error
tests/validator12/validate_spec_url_test.py:50: test_raise_SwaggerValidationError_on_urlopen_error
tests/validator20/validate_spec_url_test.py:20: test_raise_SwaggerValidationError_on_urlopen_error

They all fail with:

assert '<urlopen error [Errno -2] Name or service not known>' in '<urlopen error [Errno -5] No address associated with hostname>'

It seems like the test suite assumes a specific error about the bogus url that is not always true. These assertions should probably be a little more generic.

Timeout of 1 second is too rigid

It would be helpful if we could specify a timeout rather than being locked to 1 second.
swagger_spec_validator/swagger_spec_validator/common.py

provide more traceback information about location of error in spec when swagger spec does not validate

When validating swagger, it's difficult to know which line of the swagger that is causing the issue. For example, my swagger spec had a type field with a list instead of a string. This was difficult to track in my swagger spec as there was only an error without any clues as to what the surrounding lines might look like. it would be helpful to print out part of the object that causes the error.

below is an example traceback:

...
  File "/opt/venvs/swagger-tools/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 171, in validate_spec
    validate_definitions(definitions, bound_deref)
  File "/opt/venvs/swagger-tools/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 530, in validate_definitions
    visited_definitions_ids=visited_definitions_ids,
  File "/opt/venvs/swagger-tools/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 501, in validate_definition
    visited_definitions_ids=visited_definitions_ids,
  File "/opt/venvs/swagger-tools/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 501, in validate_definition
    visited_definitions_ids=visited_definitions_ids,
  File "/opt/venvs/swagger-tools/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 501, in validate_definition
    visited_definitions_ids=visited_definitions_ids,
  File "/opt/venvs/swagger-tools/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 472, in validate_definition
    raise SwaggerValidationError('type must be a string; lists are not allowed (%s)' % swagger_type)
swagger_spec_validator.common.SwaggerValidationError: type must be a string; lists are not allowed (['string', 'null'])

Validator does not check uniqueness of operation ids

According to the Swagger spec, the operationId of an operation object is:

Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions.

The validator does not currently check that operationIds are unique across the API. This would be a helpful feature because some codegen tools fail if this constraint is not met.

Validate spec failed on validating response code without quote

I found that validate_spec will fail on validating response codes when it is not wrapped with single quote. But on swagger website, response codes are not quoted: http://editor.swagger.io/#/

On OpenAPI doc, example response codes are wrapped with quotes.

I am confused which way is the correct and valid way to write response code in spec yaml. Can you make both type of response codes pass validation? Or is response code without quote not valid?

Check for required `type` field.

Here's an example response model that's missing a type field for time_created:

  TokenResponse:
    additionalProperties: false
    properties:
      is_foo:
        type: boolean
      time_created:
        description: The creation time of the access token in ISO8601 format.
        # type: string
    required:
    - is_foo
    type: object

While the time_created field isn't required, when you use that field the Bravado client fails due to lack of the type: string field. This spec currently passes the Swagger validator.

retrieve list of errors instead of raising errors

Except if I am missing some option, validate_spec will raise an exception as soon as it find an error.
It would be useful to be able to retrieve all errors from validation instead of raising exceptions.
I want to use the validate_spec to validate a swagger uploaded by users and return to them the list of errors instead of returning only the first error.

Validation should fail when default does not match type

According to the specification for param default:

Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. Unlike JSON Schema this value MUST conform to the defined type for this parameter.

This is not checked currently, and a spec with a param default of a different type (e.g. int when type is string, or non-array for array) will pass validation.

Validation fails if definition has `required` but uses `allOf`

I'm trying to use connexion which wraps and adds functionality over swagger-spec-validator, but the schema definition I'm trying to use fails to validate. I've narrowed the problem to a specific scenario. Whenever a definition has a required list but defines its properties nested in allOf instead on the peer-level properties, schema validation raises a SwaggerValidationError.

For example, using this schema:

{
    "swagger": "2.0",
    "info": {
        "version": "1.0.0",
        "title": "test"
    },
    "paths": {},
    "definitions": {
        "User": {
            "type": "object",
            "required": [
                "id"
            ],
            "allOf": [
                {
                    "$ref": "#/definitions/CommonBaseType"
                },
                {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "string"
                        },
                        "name": {
                            "type": "string"
                        }
                    }
                }
            ]
        },
        "CommonBaseType": {
            "type": "object",
            "properties": {
                "commonBaseThing": {
                    "type": "string"
                }
            }
        }
    }
}

I get SwaggerValidationError: Required list has properties not defined: [u'id'].

The schema appears to be valid (it was actually generated by another swagger framework in an unrelated system). Or am I misunderstanding something about the expected behavior?

I think I've fixed it in #65, but I'm not intimately familiar with the internals of this particular module and would gladly welcome some feedback.

External refs are not validated

common.validate_json(json_doc, schema_path) doesn't catch errors in external refs referenced by json_doc.

Workaround is to de-ref json_doc before validating it.

missing dependency: setuptools

Both validators import pkg_resources which is part of setuptools, however it is not listed as explicit dependency in the setup.py.

I know this doesn't cause a problem for most people as one technically needs setuptools to install things using a setup.py. In my case I install the library in a specific directory (using the --target flag with pip) and then want to use it with a different (sand-boxed) python, which doesn't have setuptools. Consequentially I get

File "[...]\lib\swagger_spec_validator\validator12.py", line 20, in <module>
from pkg_resources import resource_filename
ImportError: No module named pkg_resources

Would it be worth it adding setuptools to the list of dependencies? As a second thought, setuptools is a big dependency. Is it necessary? (I don't know the code base)

pypi version 2.1.0 has been tampered with

My build suddenly (after the holidays) started to fail because the hash of swagger-spec-validator==2.1.0 changed. Is this a legitimate change, or has someone tampered with the published version?

Virtualenv location:/--redacted--/.venv
Installing dependencies from Pipfile.lock (3ec315)…
An error occurred while installing swagger-spec-validator==2.1.0! Will try again.
...
Installing initially–failed dependencies…
Collecting swagger-spec-validator==2.1.0  — 00:00:00
  Using cached swagger_spec_validator-2.1.0-py2.py3-none-any.whl

THESE PACKAGES DO NOT MATCH THE HASHES FROM Pipfile.lock!. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    swagger-spec-validator==2.1.0 from https://pypi.python.org/packages/44/02/bcc0122d561d9727b8ca476058f2c57a37a1c86d0f7c9aec5543f3219cd0/swagger_spec_validator-2.1.0-py2.py3-none-any.whl#md5=bc8fb6e9f29bc36dc050330f7ac184db (from -r /var/folders/12/vzps3jhs0pz8z_phldh9pz180000gn/T/pipenv-qfwotfvp-requirement.txt (line 1)):
        Expected sha256 dc9219c6572ce0def6e1c160ca253c0e7fcde75812628f0c0199334f85bd138e
             Got        aedacb6c6b475026a1b5ac218fb590382d08064e227da254eb961d17cfd2b7c1

This is the change in my Pipfile:

diff --git a/Pipfile.lock b/Pipfile.lock
index 2eea162..cc4ef43 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,18 +1,18 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "03f991c8243036005ea82f4af6c7bf75ef3ba6285370a8ef022c8ea686cd7f17"
+            "sha256": "a814905b3818590dc2fb345a0cb0f203cc8511ca2fac063e3a73c098593ec315"
         },
         "host-environment-markers": {
             "implementation_name": "cpython",
-            "implementation_version": "3.6.3",
+            "implementation_version": "3.6.4",
             "os_name": "posix",
             "platform_machine": "x86_64",
             "platform_python_implementation": "CPython",
-            "platform_release": "17.2.0",
+            "platform_release": "17.3.0",
             "platform_system": "Darwin",
-            "platform_version": "Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64",
-            "python_full_version": "3.6.3",
+            "platform_version": "Darwin Kernel Version 17.3.0: Thu Nov  9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64",
+            "python_full_version": "3.6.4",
             "python_version": "3.6",
             "sys_platform": "darwin"
         },
@@ -22,6 +22,7 @@
         },
         "sources": [
             {
+                "name": "pypi",
                 "url": "https://pypi.python.org/simple",
                 "verify_ssl": true
             }
@@ -38,30 +39,30 @@
         },
         "aiohttp": {
             "hashes": [
-                "sha256:6fbafb8883fd943c253b17416cf564a82fd71f161ff700383b09879ba3cce622",
-                "sha256:588fb25786bb006166f35e75e7dcfb096278f99f458c3e09400ed42f021a2c09",
-                "sha256:22599849201671588ad62d536591e95d4052806c7c14d7c9ab7a23b2e8bc071f",
-                "sha256:07446d6bb192a0fb42ab6204f34741cb269714abce64643cf649efd543e12960",
-                "sha256:cbfe5c509aaa2eff789c4fee436e3c1920a94392b60f2e80c74af762c7479b07",
-                "sha256:0580759823133cd4656a76239328363a8c12be26e9579ed75691b5aa46c61dc2",
-                "sha256:83bc52dae14d43db1bfad1c1e1d47eab2d096fef0b5008850e30a71b736e8f40",
-                "sha256:df827287fa962de0b3bbe8ea74fa3aa440dd7e1625743b247c0eaf9b9be3d647",
-                "sha256:689c30f5de00798ce412b8624fe9fd243c1689a50b614a5b9ffa31dba87aa7e9",
-                "sha256:e0aff15e4fa97c249290dc5fe8d784eeedf3f04a94a0125e6ca61dc14f8096a4",
-                "sha256:59945743837ced78e3354e443718db2fd99ff0b7e0269f324ef9a3c942121352",
-                "sha256:5507e614110a1a4ebed82d389ea50c2b4d98b24ec6b500503533081cf1892462",
-                "sha256:d551a3ec5aee881677bf952f5e4ae75146f9bd71bbeae06c814ca00fb1cd2f41",
-                "sha256:03848a3961fe7a5ba32fa9f40cfd5ecf139d6e85b59868412fed47d5835f098c",
-                "sha256:764426debf452eb0a479717d68abbc88d0a707da58761784d4b532afd518027c",
-                "sha256:0543261f22b7e635abeba354c9f975f877d471615b4e42c730d6894ddf008bf2",
-                "sha256:df52fc09085f4a7b0952a8f2aef3aa0b15a16dd789e0bce8703043fdbd038f9d",
-                "sha256:315c2e0dd2ef657b9142cb00cb77ff240192ce0b2e45e1b6e8f3a1d0dae24b66",
-                "sha256:ba2b7d24425fe519f0fb6c9a11e192c47993e5a30943247b45d73f79764f1667",
-                "sha256:52086829c4d7d6aac0a98455489c42296435d9ac1b607e27a4fbb1490a012a20",
-                "sha256:4a7d2221e6d3a8bb8d510e6aa254fd8e165efecc42af5b699e1492ed9cad51e7",
-                "sha256:044e4d610a5ab6bd46a04f431f000d0b5074f1aa38df5e326cff031635af6ad7"
-            ],
-            "version": "==2.3.5"
+                "sha256:1d3659809cc3cf16007a43df3c3af34a9ad8d7594bfcd651ef2d29ff21d015e3",
+                "sha256:18c93827f604e3830535423f22bfaa180d7ba10baa5959a2077f2e29b320138d",
+                "sha256:080c82112d93fe117a2f605d5a102191ae7fc52349c53cf6676efbfb8bd2d369",
+                "sha256:a1c29fdc56e040c3c67a9fa6da7e05382d5216d1ead9ae8a4fb772a1abb0452a",
+                "sha256:d8f546159ae453572c3b87d88652705c4516dfee1ade8673b47f544b2bf1b33d",
+                "sha256:03085220b503bb2cf2d288e1b36cf6dcbf84fcfed550e7c73bad429a6e528084",
+                "sha256:00e40b1261bdb6a1e2b986e610be8a2bb0699ce5a261f78c88d761c726e0af10",
+                "sha256:fcec0a4878c27f04bf62de4b76d51f9583d45031317dd020088d2e258210fcc2",
+                "sha256:52b180767e1b75ff071f316a52946fb311ba4183cb6981201fa7843611cf42e4",
+                "sha256:1fbc4701639ca383dc103840fb478ce726b84c51de8d575c02b740bcb2f60262",
+                "sha256:9d2e10768bca6ff8392df596754adbffee39ab4243d2536f955f9db145685cbe",
+                "sha256:3ee498748106c2f8ce937ea27c05d8862118ce055ee3d074b383e927572b51b6",
+                "sha256:dc922785064187c45c71eda21d7eb87c7a0b2d867e0d7c9ffc2ea2a37dcca608",
+                "sha256:0415ca37ca047d4b5c2938da024abe4893fe54227b7ad36f98fb169fff4767a3",
+                "sha256:08715cc8d0ae00679b7c131804ae92aacc31fd0078dd0d78c309c043a4f8aa57",
+                "sha256:ed8fb8c9b16459895c6949215592df6119961a9999ade84b66594456883d2215",
+                "sha256:6b2c62e6d54a08c7e4b8b00251d3c877bdf10ceec22c7ecc5d94de64d75fe699",
+                "sha256:f81850cf4707a2d3d85fcb9c85c091a0df66bf4a67197530c5a4f454b8d1d950",
+                "sha256:5a1c7c890ac13dd05763e3617261f528fedf3255d72ba8c41e97f7de72f3d8b6",
+                "sha256:65d623d32a40826be88ecafe5a49fd0af3092b2bf7e1171aec1d3e7868c969c1",
+                "sha256:222634adcdcfda1aefafff198415df77946384d10696619f1b163cb36d03bc82",
+                "sha256:fe294df38e9c67374263d783a7a29c79372030f5962bd5734fa51c6f4bbfee3b"
+            ],
+            "version": "==2.3.7"
         },
         "altgraph": {
             "hashes": [
@@ -79,10 +80,10 @@
         },
         "astroid": {
             "hashes": [
-                "sha256:39a21dd2b5d81a6731dc0ac2884fa419532dffd465cdd43ea6c168d36b76efb3",
-                "sha256:492c2a2044adbf6a84a671b7522e9295ad2f6a7c781b899014308db25312dd35"
+                "sha256:badf6917ef7eb0ade0ea6eae347aed1e3f8f4c9375a02916f5cc450b3c8a64c0",
+                "sha256:71dadba2110008e2c03f9fde662ddd2053db3c0489d0e03c94e828a0399edd4f"
             ],
-            "version": "==1.5.3"
+            "version": "==1.6.0"
         },
         "async-timeout": {
             "hashes": [
@@ -93,10 +94,10 @@
         },
         "bravado-core": {
             "hashes": [
-                "sha256:072847bca20096d0c4caac1d60afc54df21f14b2945f747ee3852cca6f967569",
-                "sha256:4c31aaf71e6fd039845cd326399cf8f519dec764a37a97b16f01ad9b23821fa2"
+                "sha256:3a816b05b2f4505ec6b139ceaaad4df227f63376e3fd751b8d994898b4d257d3",
+                "sha256:2397da418c09335fafde00462fa02deba50b174f59a8f706a2744221ffc3918c"
             ],
-            "version": "==4.11.0"
+            "version": "==4.11.1"
         },
         "certifi": {
             "hashes": [
@@ -203,9 +204,9 @@
         },
         "httptools": {
             "hashes": [
-                "sha256:f47f9870f19e3488e8def0898c46f87d36e5d59e90eb77d01453a6747cdab9f8"
+                "sha256:f50dcb27178416c3a4113e9e1b392be5d1ff56ae1e474fe80869ed8530505e4c"
             ],
-            "version": "==0.0.9"
+            "version": "==0.0.10"
         },
         "idna": {
             "hashes": [
@@ -291,9 +292,9 @@
         },
         "markdown": {
             "hashes": [
-                "sha256:73af797238b95768b3a9b6fe6270e250e5c09d988b8e5b223fd5efa4e06faf81"
+                "sha256:cfa536d1ee8984007fcecc5a38a493ff05c174cb74cb2341dafd175e6bc30851"
             ],
-            "version": "==2.6.9"
+            "version": "==2.6.10"
         },
         "markupsafe": {
             "hashes": [
@@ -315,6 +316,22 @@
             ],
             "version": "==0.17.2"
         },
+        "msgpack-python": {
+            "hashes": [
+                "sha256:637b012c9ea021de7a7a75d6ff5e82cfef6694babd7e14bb9a3adcb2a5bd52f0",
+                "sha256:658c1cd5dcf7786e0e7a6d523cd0c5b33f92e139e224bd73cb3a23ada618d2dc",
+                "sha256:920bbbaee07ad048a4d2b4160901b19775c61ef9439f856c74509e763a326249",
+                "sha256:e165006f7e3d2612f1bffe2f6f042ca317d8df724d8b72a39b14c2e46c67eaae",
+                "sha256:95d70edd50e3d2f6ea1189f77190e4a0172626e7405ddd1689f3f64814447cba",
+                "sha256:7e1b12ea0134460052fabcfaa0f488ec0fc21deb14832d66236fd2870757d8f1",
+                "sha256:8f36890251f20d96267618cf64735759d7ef7e91bc0b86b9480547d2d1397a68",
+                "sha256:1e68a277e4180baa7789be36f27f0891660205f6209f78a32282d3c422873d78",
+                "sha256:f52d9f96df952369fe4adcb0506e10c1c92d47f653f601a66da2a26a7e7141ea",
+                "sha256:58c9c1d7891a35bddc6ee5dbec10d347a7ae4983169c24fc5fc8a57ae792ca76",
+                "sha256:1a2b19df0f03519ec7f19f826afb935b202d8979b0856c6fb3dc28955799f886"
+            ],
+            "version": "==0.4.8"
+        },
         "multidict": {
             "hashes": [
                 "sha256:d12dfcff45b5c0eb3d586289cbf928012e75f93f10f4b9d7af903acb07b3c226",
@@ -394,16 +411,16 @@
         },
         "pyinstaller": {
             "hashes": [
-                "sha256:b6c95cdbb45ac78a44723fa2992b58e14637cbefecafc22d3790af262a7fad6f"
+                "sha256:715f81f24b1ef0e5fe3b3c71e7540551838e46e9de30882aa7c0a521147fd1ce"
             ],
-            "version": "==3.3"
+            "version": "==3.3.1"
         },
         "pylint": {
             "hashes": [
-                "sha256:948679535a28afc54afb9210dabc6973305409042ece8e5768ca1409910c1ed8",
-                "sha256:1f65b3815c3bf7524b845711d54c4242e4057dd93826586620239ecdfe591fb1"
+                "sha256:c8e59da0f2f9990eb00aad1c1de16cd7809315842ebccc3f65ca9df46213df3b",
+                "sha256:3035e44e37cd09919e9edad5573af01d7c6b9c52a0ebb4781185ae7ab690458b"
             ],
-            "version": "==1.7.4"
+            "version": "==1.8.1"
         },
         "pytest": {
             "hashes": [
@@ -461,10 +478,10 @@
         },
         "pytest-xdist": {
             "hashes": [
-                "sha256:997ed2d6ed487fc41e16b5a0d00b944574a2f635375ee7fbea6a1d6b3876e2cd",
-                "sha256:433e82f9b34986a4e4b2be38c60e82cca3ac64b7e1b38f4d8e3e118292939712"
+                "sha256:74b18cc78abb334bfaaac223d82565be1ebcecf85c66a3cabe3ede8f86e16943",
+                "sha256:0b8622435e3c0650a8d5a07b73a7f9c4f79b52d7ed060536a6041f0da423ba8e"
             ],
-            "version": "==1.20.1"
+            "version": "==1.21.0"
         },
         "python-dateutil": {
             "hashes": [
@@ -612,10 +629,10 @@
         },
         "tqdm": {
             "hashes": [
-                "sha256:733ce813ab83e17a03da34043c6265e29f6731e3cbbbe305b12694ced0af6770",
-                "sha256:7ca803c2ea268c6bdb541e2dac74a3af23cf4bf7b4132a6a78926d255f8c8df1"
+                "sha256:4c041f8019f7be65b8028ddde9a836f7ccc51c4637f1ff2ba9b5813d38d19d5a",
+                "sha256:df32e6f127dc0ccbc675eadb33f749abbcb8f174c5cb9ec49c0cdb73aa737377"
             ],
-            "version": "==4.19.4"
+            "version": "==4.19.5"
         },
         "twine": {
             "hashes": [
@@ -624,13 +641,6 @@
             ],
             "version": "==1.9.1"
         },
-        "u-msgpack-python": {
-            "hashes": [
-                "sha256:4b509782648fc563f85cef03887389c7fba3b077a47920a13d3d4ea78652ffd2",
-                "sha256:2f31fc1b6dd8632c230ea7012470e40f77119f20999274dda6f1afa9c305e590"
-            ],
-            "version": "==2.4.1"
-        },
         "ujson": {
             "hashes": [
                 "sha256:f66073e5506e91d204ab0c614a148d5aa938bdbf104751be66f8ad7a222f5f86"
@@ -706,21 +716,21 @@
         },
         "yarl": {
             "hashes": [
-                "sha256:bd2155dc2fec1c4703404387376863fd13cf5e080950b2ad2aa1145bcd65aa6a",
-                "sha256:a4fa02a86aa753a7ae08525c76a5ea099fe246ec645b252a353c4e5c4e38fae5",
-                "sha256:a2f7dbbfa3f360adced0116e600e24b0fbef4ff1a11235309818ac8c2aabddac",
-                "sha256:e0157aca55a555bff824c2dc2d30c2a8adfa768e0ca8168f2b614920475522a0",
-                "sha256:b2df0dd3db8b39a51e5a7856a3969166a140f7f316e05deea0c696f58a4472da",
-                "sha256:fc5598d6bde4a2333109e9b90d246a61ef4a73e201329de0f0bcd7271d71b2dc",
-                "sha256:366c2021db3ed548c4cebb2e1ff7cd7e22975e3bf31519464c11c257e80e056f",
-                "sha256:58aba6b30e015f2731847eb608d0c38435a26a7c7eb8ca4111a39bd36b393bd0",
-                "sha256:5bd238a100be1438a3797fe2e793001b641adcd239b033d73e680bd5d7e07520",
-                "sha256:aac9baad9bc9a428d3abc1737862b2bfe818a6a3ccc6b8341dc62eb3b7f2b134",
-                "sha256:2aa32de85de42407c1c949c5c0b998d3805ffd4531a9a3b2dc81c5b6a8174b91",
-                "sha256:aa9db9e3bf718ea0c0905fa8076e07486b3357688181cb430674bf26f2ce0acd",
-                "sha256:06b3a0d00aebf64b269a3410ec079386f5091e7603796da6644dff08f427737a"
-            ],
-            "version": "==0.15.0"
+                "sha256:05d7453ea302b67a5891cf9c940574bd5db15c476ecfbfcb165e95e79e0ec0b8",
+                "sha256:9bd33929a3cbbe28886f9345f5e29a438d8ec199a11cf988ef7a609eb8221c31",
+                "sha256:65bf0c1fded20f70692a3989bd099e5a795d7f2b44dff1a3735d4b80babf170d",
+                "sha256:e668662fa266c7109ebf37765cbcf305008d7767d34ee5e6ce3bd856bf58c757",
+                "sha256:d6030efee9533812cfda2198dcb916b863e1b4849ce69a00f979e16418473d16",
+                "sha256:2644e5ed81f2d82059d27718482d313bff7797fb684b74b9a540830fd017592a",
+                "sha256:222d60fcc8d108ef4af1ec6f0bdf923f24eeaf9dbfbb95676e8e2ef319479a1b",
+                "sha256:b03542089cee33e160e7af6a1d2adac014e81374192d4d69cc8fc69c39a13b5f",
+                "sha256:f8fcaf4eb76234c60e4ec9961b0980ffafe57c9a2475fa2077f2e065dbb26490",
+                "sha256:37f7fe43131f74e41aa77f304fbbd9185efc82323a88e1f67afec93761e9e13a",
+                "sha256:0a51e1bc70a9dea39fb474cab73987de6051788945f06b9dcc263c7b600d2607",
+                "sha256:1d40f4066b92f86b8dabdee19d82493bc97a760b46a17c2839f71ba7589129a0",
+                "sha256:2e4e1aec650ad80e73e7063941cd8aadb48e72487ec680a093ad364cc61efe64"
+            ],
+            "version": "==0.17.0"
         }
     }
 }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.