Fix text/markdown_text mutual exclusion in chat methods#588
Merged
dblock merged 3 commits intoJul 5, 2026
Conversation
The arg_groups patch introduced a `mutually_exclusive: true` group for [text, markdown_text] meaning "use either but not both" (at-most-one). However the template treated all `mutually_exclusive: true` groups as "exactly one required" (XOR), raising an error when only attachments or blocks were provided. - Add `"required": false` to the [text, markdown_text] arg_groups in the 4 chat method JSON files to mark them as at-most-one instead of exactly-one. - Update method.erb to emit a "mutually exclusive" guard (at-most-one) vs the existing "Exactly one of" (XOR) based on required: false. - Update method_spec.erb to generate "does not allow both" tests for at-most-one groups and skip raise expectations for single-arg combos that would violate those groups in the broader at-least-one test. - Update custom chat_spec.rb error message patterns to include :markdown_text, which was added to the at-least-one group. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Danger ReportNo issues found. |
998b24a to
9496e5d
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9496e5d to
f8b12a5
Compare
Coverage Report for CI Build 28745839451Coverage increased (+0.07%) to 91.075%Details
Uncovered Changes
Coverage Regressions6 previously-covered lines in 4 files lost coverage.
Coverage Stats
💛 - Coveralls |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The submodule patch (
b1be09b0) addedmarkdown_textto the chat method arg_groups with a second group markedmutually_exclusive: true— meaning "use either but not both" (at-most-one). However the code generation template treated allmutually_exclusive: truegroups as "exactly one required" (XOR), so calls likechat_update(attachments: ..., channel: ..., ts: ...)raised:This broke
rspec ./spec/slack/web/api/endpoints/chat_spec.rb:302(and the equivalent tests for postMessage, postEphemeral, scheduleMessage).Fix (commit 1)
"required": falseto the[text, markdown_text]arg_group in the 4 chat method JSON files in slack-api-ref to distinguish "at most one" from "exactly one required".method.erb: whenmutually_exclusive: true && required: false, emit a"mutually exclusive"guard instead of XOR. Existingviews.open-style "exactly one" behaviour is preserved.method_spec.erb: generate'does not allow both X and Y'tests for at-most-one groups; skip raise expectations for combinations that violate at-most-one constraints in the broader at-least-one test.spec/slack/web/api/endpoints/custom/chat_spec.rberror patterns to include:markdown_text.Regeneration (commit 2)
Full regeneration of endpoints, specs, and commands from the updated templates and JSON, bringing in all other pending API changes from slack-api-ref@38cb2f40.