Skip to main content
Travis status Join the chat at https://gitter.im/Trax-air/swagger-parser https://img.shields.io/pypi/v/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

1.0.0 (2017-6-11)

0.1.11 (2016-9-25)

  • Support additionalProperties.

0.1.10 (2016-8-25)

  • Don’t choke if there are no definitions

  • Generate operations without operationId

  • Generate example from properties

0.1.9 (2016-7-28)

  • Support array definitions.

0.1.8 (2016-5-11)

  • Support type field to be an array.

  • Use base path to validate request.

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.

Release files for swagger-parser 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swagger-parser 1.0.2
File Size Uploaded
swagger_parser-1.0.2.tar.gz 31.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for swagger-parser 1.0.2
File Interpreter ABI Platform
swagger_parser-1.0.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 44.4 kB

Release files / swagger_parser-1.0.2.tar.gz

Download URL swagger_parser-1.0.2.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9b37c3e23bdadc90716f4b0bae0e7943c1900ae2aed7735b228d65a6485cd17b
BLAKE2b-256 checksum
How to use checksums
9e46b7212e55c01cfc950d50a975858ee04193f796ad3e9911dfebc83848949a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0.post20201221 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.7

Release files / swagger_parser-1.0.2-py2.py3-none-any.whl

Download URL swagger_parser-1.0.2-py2.py3-none-any.whl
Size 13.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
251b5f9c54932ec140ba340afac66d75a72f8ed9185c4d35750949d689ec5860
BLAKE2b-256 checksum
How to use checksums
3b46eb9c040886178ba2cfaa19bf6e7daa238cfaeffa48cf6b6c20173a24301b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0.post20201221 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.7

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

1 release file

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page