Skip to main content

Swagger parser giving useful informations about your swagger files

Project description

Travis status Code issues Join the chat at https://gitter.im/Trax-air/swagger-parser Dependency Status https://img.shields.io/pypi/v/swagger-parser.svg https://img.shields.io/pypi/dw/swagger-parser.svg

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.

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.

History

0.1.7 (2016-4-1)

  • Support UTF-8 in swagger.yaml.

0.1.6 (2016-3-16)

  • Add support for path-level parameters.

0.1.5 (2016-2-17)

  • Add support for parameters references in path specs.

0.1.4 (2016-2-10)

  • Handle string as status_code.

0.1.3 (2016-2-3)

  • Fix a bug in get_response_example with schema only containing a type field.

0.1.2 (2016-2-3)

  • Support schema with only a type field.

0.1.1 (2016-1-31)

  • Change license to MIT.

0.1 (2016-1-28)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

swagger_parser-0.1.7-py2.py3-none-any.whl (10.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file swagger_parser-0.1.7-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for swagger_parser-0.1.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4128d2077adb88ff78411cc56c06e87863c686929f27bae0174cd3edb7862580
MD5 7891b1ce6f830bf18e04974f8e12d3af
BLAKE2b-256 508ccea606b084fb9a3b2a9488a6559381b7bbfd9c2f67450796fd3f312dbe8a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page