slack-rs / slack-rs-api

Rust interface for the Slack Web API
Apache License 2.0
110 stars 67 forks source link

`slack_api::usergroups::list` uses incorrect schema #98

Open nikclayton-dfinity opened 4 years ago

nikclayton-dfinity commented 4 years ago

Trying to call usergroups::list returns a MalformedResponse error.

In my case this is because the value for the user_count field is an int, not a string.

I assume the schema in https://github.com/slack-rs/slack-api-schemas/blob/master/objects/usergroup.json is incorrect.

In addition, I see in the output (at the same level as the user_count field) a channel_count field which is also an int, and appears to be missing from the schema.

dten commented 4 years ago

this is where slack's docs are a bit of a pain with types, their example shows user_count as a string https://api.slack.com/methods/usergroups.list

even their schema shows a string in their example https://raw.githubusercontent.com/slackapi/slack-api-specs/master/web-api/slack_web_openapi_v2.json

but it says it returns objs_subteam objects, which say

                "user_count": {
                    "type": "integer"
                },

the schema we have was scraped from their examples before they started work on their own schema

last i checked it was missing loads of information which made generating functions from it not possible. but it does look a lot better now.

I think some syncing is over due

dten commented 4 years ago

I also started adding some tests that actually call the apis, but that obviously requires a slack workspace to connect to. or a really good fake, and I haven't seen any easy fakes