asyncapi-python-parser

An AsyncAPI python parser, that supports all versions

Downloads
157
Stars
1
Committers
2

Python AsyncAPI Parser

Parsing options

These are the options that can be provided when parsing AsyncAPI documents;

Reference resolvement

By default, all references are resolved when the document is parsed, however, if wanted you can turn this off by providing the option resolve_references when parsing a document.

parse(data, ParserOptions({'resolve_references': True}))

Validating input

By default, the input is validated against the official AsyncAPI JSON Schema documents, however, if wanted you can turn this off by providing the option validate_input when parsing a document.

parse(data, ParserOptions({'validate_input': True}))

Applying traits

By default, traits are applied when parsed, however, if wanted you can turn this off by providing the option apply_traits.

parse(data, ParserOptions({'apply_traits': True}))

Serializing parsed documents

All parts of the parsed AsyncAPI document can be serialized back into JSON.

document = {}
parsedDocument = parse(data)
serializedDocument = parsedDocument.json()

NOTICE: If traits or references have been applied, document and serializedDocument will never be the same.

Creating new AsyncAPI documents

Through the AsyncAPI Python models, you can create AsyncAPI documents directly in your code instead of parsing existing documents.

document = AsyncApi2Dot0Dot0SchemaDot({'asyncapi': '3.0.0', 'info': {'title': 'smartylighting', 'version': '1.0.0'}})

Reading and Overwriting values

You can also overwrite existing functions

document = AsyncApi2Dot0Dot0SchemaDot({'asyncapi': '3.0.0', 'info': {'title': 'smartylighting', 'version': '1.0.0'}})
document.id('urn:example:com:smartylighting:streetlights:server')

Restrictions

These are the current known restrictions;

  • Private reference
Package Rankings
Top 35.87% on Pypi.org