Skip to main content

Generate C++ for an AsyncAPI Specification

Project description

AsyncAPI Codegen

This 3rd-party open source tool creates C++ interfaces according to AsyncAPI specifications. Currently, only MQTT is supported.

Python Generator

The Python3 generator interprets a AsyncAPI specification and uses jinja2 templates to create a number of C++ sources and headers.

The AsyncAPI must be format-decoded first, using a JSON or YAML parser. The resulting parsed structure is then passed to the generator.

The generator interprets the specification directly. For example, if the specification defines a publish operation, the generator creates code for publishing.

Output files

The generator creates the following types of output files:

  • client interface. This is the main interface for publishing or subscribing to messages.
  • servers. Represents a connection to a server. Currently, only unauthenticated MQTT connections are supported. A server object is provided to a client interface to establish the connection to the broker/server.
  • parameters. These are just schema objects.
  • messages. Currently, these are just schema objects. However, in the future these objects will also take protocol-specific message bindings.
  • schemas. These are structures that always enforce schema compliance and provide (de-)serialization methods to rapidjson Value objects (which can thus be used to create JSON strings).

Generated code files should be annotated for doxygen document generation, or at least that is the goal.

Installation

pip3 install asyncapi-codegen

Python requirements for running code generator

See also requirements.txt

  • python 3.7
  • jinja2
  • stringcase
  • json-schema-codegen
  • pyyaml

C++ requirements for generated code

  • boost (boost::optional and boost::variant among others)
  • rapidjson
  • C++11

License

GPLv2

Project details


Release history Release notifications

Download files

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

Files for asyncapi-codegen, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size asyncapi_codegen-0.0.4-py3-none-any.whl (28.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size asyncapi-codegen-0.0.4.tar.gz (7.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page