Skip to content
Give useful informations about your swagger files
Python Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
swagger_parser Merge pull request #61 from rwincewicz/Add-allOf-support Jun 29, 2018
tests Removed references to unnecessary test yaml Jun 29, 2018
.checkignore
.editorconfig First release Jan 28, 2016
.gitignore First release Jan 28, 2016
.travis.yml Removed reference to py33 in the Travis config Jun 27, 2018
AUTHORS.rst
CONTRIBUTING.rst
HISTORY.rst Bump version: 0.1.11 → 1.0.0 Jun 15, 2017
LICENSE
MANIFEST.in
Makefile
README.rst
requirements.txt
requirements_dev.txt
setup.cfg
setup.py
tox.ini
travis_pypi_setup.py

README.rst

Travis status Join the chat at https://gitter.im/Trax-air/swagger-parser

swagger-parser

Swagger-parser is a python module giving you access to some interesting data about your swagger file. Like getting a dictionary example from a definition name, get the definition of a dictionary, and more.

Related Libraries

You may find related libraries to this one:

Example Usage

from swagger_parser import SwaggerParser

parser = SwaggerParser(swagger_path='swagger_path')  # Init with file
parser = SwaggerParser(swagger_dict={})  # Init with dictionary

# Get an example of dict for the definition Foo
parser.definitions_example.get('Foo')

# Get the definition of a dictionary
test = {
  'foo': 'bar'
}
parser.get_dict_definition(test)

# Validate the definition of a dict
parser.validate_definition('Foo', test)

# Validate that the given data match a path specification
parser.validate_request('/foo', 'post', body=test, query={'foo': 'bar'})

# Get the possible return value of a path
# It will return a dictionary with keys as status_code
# and value as example of return value.
parser.get_request_data('/foo', 'post', body=test)

# Get an example of a correct body for a path
parser.get_send_request_correct_body('/foo', 'post')

Documentation

More documentation is available at https://swagger-parser.readthedocs.org/en/latest/.

Setup

make install or pip install swagger-parser

License

swagger-parser is licensed under http://opensource.org/licenses/MIT.

You can’t perform that action at this time.