Skip to content

Fix text/markdown_text mutual exclusion patch source (persist required: false) - #86

Merged
dblock merged 1 commit into
slack-ruby:masterfrom
dblock:fix-chat-mutual-exclusion-patch-source
Aug 12, 2026
Merged

Fix text/markdown_text mutual exclusion patch source (persist required: false)#86
dblock merged 1 commit into
slack-ruby:masterfrom
dblock:fix-chat-mutual-exclusion-patch-source

Conversation

@dblock

@dblock dblock commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Problem

#84 fixed the [text, markdown_text] mutually_exclusive arg_group in chat.postEphemeral, chat.postMessage, chat.scheduleMessage and chat.update by adding "required": false directly to the merged output files in methods/chat/*.json. Without it, downstream consumers (e.g. slack-ruby-client) treat a missing required flag on a mutually_exclusive group as "exactly one is required" (XOR), when in fact text/markdown_text can both be omitted as long as another required arg (e.g. attachments or blocks) is present.

That fix only touched the generated output (methods/chat/*.json), not the methods/_patches/chat/*.json source files that rake api:methods:update merges on top of freshly scraped docs (see process_method in tasks/lib/slack_api/methods_generator.rb, which does result.merge!(patch)). The very next doc scrape (634d664, 2026/08/10) regenerated the merged files from docs + the still-unfixed patches, silently dropping required: false again. This surfaced downstream in slack-ruby/slack-ruby-client#590, where CI failed because chat_postMessage/chat_postEphemeral/etc. once again raised ArgumentError, 'Exactly one of :text, :markdown_text is required' when only text (or only markdown_text) was passed.

Fix

Add "required": false to the [text, markdown_text] arg_group in the four methods/_patches/chat/*.json source files, so the fix persists across future doc re-scrapes, and regenerate the merged methods/chat/*.json files (via rake api:methods:update) to match.

Verified with rake api:methods:update (regenerates only the intended 4 merged files, no other diffs) and rake api:methods:validate (passes).

Commit 868b621 previously added required: false directly to the
merged methods/chat/*.json output files (chat.postEphemeral,
chat.postMessage, chat.scheduleMessage, chat.update) to mark the
[text, markdown_text] mutually_exclusive arg_group as at-most-one
instead of exactly-one. However, that fix only touched the generated
output, not the methods/_patches/chat/*.json source files that
api:methods:update merges on top of freshly scraped docs. The next
doc scrape regenerated the merged files from the docs plus the
(still-unfixed) patches, silently dropping the required: false flag
again.

This adds required: false to the patch source files instead, so the
fix survives future `rake api:methods:update` runs, and regenerates
the merged methods/chat/*.json files to match.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dblock
dblock merged commit 07ae43b into slack-ruby:master Aug 12, 2026
2 checks passed
@dblock
dblock deleted the fix-chat-mutual-exclusion-patch-source branch August 12, 2026 00:24
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.

1 participant