Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable rich_text_* elements to have an empty 'elements' property #1576

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

seratch
Copy link
Member

@seratch seratch commented Oct 28, 2024

Summary

This pull request resolves a bug where a few rich_text block element representation in slack_sdk.models package does not an empty value for "element" property. An empty array must be allowed for the property while most other properties in Block Kid do not allow empty arrays.

Category

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /docs (Documents)
  • /tutorial (PythOnBoardingBot tutorial)
  • tests/integration_tests (Automated tests for this library)

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes.

@seratch seratch added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented web-client Version: 3x labels Oct 28, 2024
@seratch seratch added this to the 3.33.3 milestone Oct 28, 2024
@seratch seratch self-assigned this Oct 28, 2024
Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.87%. Comparing base (5c8f595) to head (e6548d3).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1576   +/-   ##
=======================================
  Coverage   84.87%   84.87%           
=======================================
  Files         113      113           
  Lines       12599    12604    +5     
=======================================
+ Hits        10693    10698    +5     
  Misses       1906     1906           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@seratch seratch requested a review from filmaj October 28, 2024 00:29
@seratch seratch changed the title Enable rich_text_section element to have an empty 'elements' property Enable rich_text_* element to have an empty 'elements' property Oct 28, 2024
@seratch seratch changed the title Enable rich_text_* element to have an empty 'elements' property Enable rich_text_* elements to have an empty 'elements' property Oct 28, 2024
Copy link
Contributor

@filmaj filmaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are empty element arrays allowed for these blocks? Indeed the backend schema places no restriction on the number of items (either minimum or maximum) for the elements array, but what prompted this PR?

@seratch
Copy link
Member Author

seratch commented Oct 28, 2024

@filmaj currently this model class drops an empty array from these rich text block elements and that results in invalid block error when sending it to chat.postMessage API. We received an internal report on this. You can check a thread in the SDK triage channel for more details.

@seratch seratch merged commit 39d9704 into slackapi:main Oct 30, 2024
12 checks passed
@seratch seratch deleted the rich-text-model branch October 30, 2024 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented Version: 3x web-client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants