rockneurotiko/ex_gram

Some complex types are incorrect

a3kov opened this issue · 3 comments

a3kov commented

In the Bot API spec there are types such as "integer or string", that are treated incorrectly in ex_gram.
Example (chat_id is a string or an integer)

model(
  BotCommandScopeChat,
  [{:type, :string}, {:chat_id, :integer}],
  "Represents the scope of bot commands, covering a specific chat."
)

It's probably not an issue for somebody who is only using integers, but if somebody wants to use this spec for parsing the API JSON, it can be a big deal.

🤔 Until now models didn't have union types, so this wasn't contemplated. I'll take a look, thanks for opening the issue!

a3kov commented

I've checked, it's mostly about chat_id in different places.

Yeah, I just changed the extractor and re-generated the models on #111
I'll merge and release soon