Skip to main content

Swagger parser giving useful informations about your swagger files

Project description

Travis status

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…

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.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 Distribution

swagger_parser-0.1.3.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swagger_parser-0.1.3-py2.py3-none-any.whl (9.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file swagger_parser-0.1.3.tar.gz.

File metadata

File hashes

Hashes for swagger_parser-0.1.3.tar.gz
Algorithm Hash digest
SHA256 703fc11a9fc2c28b676f1bf6f5c7bb6f2e02b302da7375c5b6dc8fbb965c2585
MD5 a3aafed56c1f0a1bafc35fe38a9a7a39
BLAKE2b-256 e66f156849cf207006120b7d4600a20ccb1b2129de4460ddbef317eaf4582768

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for swagger_parser-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 15a7436916bf697bd8cca69a84a1ed4b2f89f197a2cf5858d730457f0a41230b
MD5 408966a2b2d7885d7f57b958ea1bb5d8
BLAKE2b-256 6c78f8d4a501e50192d6d9ed567d92a888e4b14d2d90d86fdf57a44a74440d7b

See more details on using hashes here.

Supported by

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