zserio icon indicating copy to clipboard operation
zserio copied to clipboard

Implement parameterized topics in pubsub types

Open mikir opened this issue 5 years ago • 0 comments

Currently, the topic strings in pubsub types are hardcoded:

pubsub Client
{
    publish("pubsub/request") Int32Value request;
    subscribe("pubsub/powerOfTwo") UInt64Value powerOfTwo;
    subscribe("pubsub/boolean/#") BoolValue booleanResponse;
};

However, user might want to have parameterized topics. Therefore, consider to implement the following pubsub syntax:

  publish("pubsub/{id}/request/", int32 id) Int32Value request;

This will generate publish method which will accept additional argument id. This argument will be converted to string and used to format topic string according to the specified formatting string.

Please don't forget that user might want to influence the formatting. Like to use hex numbers. Besides of that, consider to forbid some parameter types like double.

mikir avatar Feb 27 '20 13:02 mikir