Closed link2xt closed 1 year ago
MuteDuration
is even worse, it has this type:
[{'enum': ['NotMuted', 'Forever'], 'type': 'string'},
{'additionalProperties': False,
'properties': {'Until': {'format': 'int64', 'type': 'integer'}},
'required': ['Until'],
'type': 'object'}]
So it is either a sting "NotMuted", string "Forever" or an object {"Until": 1234}
. I would suggest that we add a tag to it as well.
I have started to write a generator for Python bindings using OpenRPC specification as a source and hit the problem of parsing
oneOf
types.Some
oneOf
types likeSystemMessageType
are simple enumerations, I convert them to this:But other enums are more complex and use various tags.
MessageLoadResult
has a tag "variant",MessageQuote
uses tag "kind" andAccount
uses tag "type". I can detect all of them in a general way by looking for a single string field common to all variands, but would be nice to converge to something even at the cost of breaking the API. From a quick search it seems that the most common convention is usingkind
as a tag.cc @Simon-Laux