Skip to content

Chat postMessage argument error only if both attachments and text are missing#11

Closed
rorhug wants to merge 1 commit intoslack-ruby:masterfrom
rorhug:master
Closed

Chat postMessage argument error only if both attachments and text are missing#11
rorhug wants to merge 1 commit intoslack-ruby:masterfrom
rorhug:master

Conversation

@rorhug
Copy link
Copy Markdown

@rorhug rorhug commented Aug 20, 2015

The slack chat http api allows you to send no text field if you do provide attachments. This change will stop the local validation from blocking that use case.

@dblock
Copy link
Copy Markdown
Collaborator

dblock commented Aug 20, 2015

This file is generated by a rake task and will be overwritten next time Slack updates their web API. So we need a solution that fixes this during generation.

@dblock
Copy link
Copy Markdown
Collaborator

dblock commented Aug 20, 2015

I think the problem is that https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.postMessage.json says that text is required, which you're saying is not true if attachments are there. You should at the very least open a bug in https://github.com/slackhq/slack-api-docs.

@rorhug
Copy link
Copy Markdown
Author

rorhug commented Aug 20, 2015

Ah I see, thanks for the explanation, I'll do that now.

@rorhug rorhug closed this Aug 20, 2015
@dblock
Copy link
Copy Markdown
Collaborator

dblock commented Aug 20, 2015

I am open for a way to fix this here with a work-around. Generally slack API docs are not complete or often miss things. Maybe we can have a patches folder that applies diffs to the generated files or something like that? I suspect it will take a long time for Slack to figure out how to express "one of these two parameters is required" in JSON :)

@rorhug
Copy link
Copy Markdown
Author

rorhug commented Aug 20, 2015

All true.

I'll open the issue anyway and hopefully get around building some kind of a system like what you described.

@dblock
Copy link
Copy Markdown
Collaborator

dblock commented Aug 20, 2015

@rorhug
Copy link
Copy Markdown
Author

rorhug commented Aug 20, 2015

Thanks! I'll open one their api-docs too though

@rorhug
Copy link
Copy Markdown
Author

rorhug commented Aug 20, 2015

@dblock
Copy link
Copy Markdown
Collaborator

dblock commented Aug 27, 2015

@RoryDH Slack said they will not be updating that repo until they hire someone. We don't have to wait. I've pulled JSON files from https://github.com/slackhq/slack-api-docs into https://github.com/dblock/slack-api-ref, which I intend to maintain and kept JSON files only.

Could you please help with this issue? Maybe we can update the JSON schema to support "one of these parameters is required" and fix slack-ruby-client?

@dblock dblock reopened this Aug 27, 2015
@dblock
Copy link
Copy Markdown
Collaborator

dblock commented Nov 8, 2015

I've opened a ticket with Slack on fixing the documentation, https://artsy.slack.com/help/requests/610828.

dblock added a commit that referenced this pull request Nov 8, 2015
@dblock
Copy link
Copy Markdown
Collaborator

dblock commented Nov 8, 2015

Implemented as patches in dblock@84416a9.

@dblock dblock closed this Nov 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants