asyncapi-python icon indicating copy to clipboard operation
asyncapi-python copied to clipboard

Support of `oneOf` in messages block

Open moaddib666 opened this issue 4 years ago • 0 comments

Hi, want to say thank you for the wonderful lib !!!

I'd use it for Auto generation of the technical documentation (code first principal) for my SocketIO application (back:python/front:vuejs) but I've faced with the issue that I can't just create a kind of topic which can publish/subscribe on to different messages.

For example: In code, we create several messages:

@subscribe
@produce
class Foo:
    bar: str
    baz: Optional[str] = None
    tmp: Optional[int] = None

@produce
class UserUpdatePayload:
    id: str
    name: Optional[str] = None
    age: Optional[int] = None

And in Spec I'd expected to see the following:

        "message": {
          "oneOf": [
            {
              "$ref": "#/components/messages/foo"
            },
            {
              "$ref": "#/components/messages/userUpdatePayload"
            }
          ]

So that I've created a POC of oneOf messages datatype and simple handling of it, please have a look https://github.com/moaddib666/asyncapi-python

Are there any plans for implement something similar ?

moaddib666 avatar Jan 31 '21 12:01 moaddib666