Skip to content

Commit 4f6f69e

Browse files
committed
update agents.md
1 parent 6cdcd5d commit 4f6f69e

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

slack_sdk/models/AGENTS.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# AGENTS.md — Block Kit Models
22

3+
The `slack_sdk/models/` package provides Python classes for building [Block Kit](https://api.slack.com/block-kit) UI layouts. Each class serializes to/from the JSON payloads that the Slack API expects, with helper methods for parsing nested composition objects.
4+
35
## Adding a New Block Kit Type
46

57
Block Kit models live in `slack_sdk/models/blocks/` across three files:
@@ -44,10 +46,6 @@ Choose the base class that matches the type you're adding.
4446
show_unknown_key_warning(self, others)
4547
self.text = TextObject.parse(text, default_type=PlainTextObject.type)
4648
self.optional_field = optional_field
47-
48-
@JsonValidator("text must be provided")
49-
def _validate_text(self):
50-
return self.text is not None
5149
```
5250

5351
Key conventions:
@@ -56,7 +54,6 @@ Choose the base class that matches the type you're adding.
5654
- Call `super().__init__()` with `type=self.type`
5755
- Call `show_unknown_key_warning(self, others)` to log unexpected kwargs
5856
- Use `TextObject.parse()`, `ConfirmObject.parse()`, and `BlockElement.parse()` for nested composition objects
59-
- Use `@EnumValidator` for fields restricted to a set of values
6057

6158
2. **Register for deserialization:**
6259
- **Elements:** Automatic — `BlockElement.parse()` discovers subclasses at runtime via `__subclasses__()`. No manual step needed.
@@ -66,7 +63,5 @@ Choose the base class that matches the type you're adding.
6663

6764
4. **Add tests** in `tests/slack_sdk/models/test_blocks.py`. Cover:
6865
- Round-trip: `input_dict == MyNewBlock(**input_dict).to_dict()`
69-
- Validation: required fields raise `SlackObjectFormationError` when missing
70-
- Constraints: max lengths, enum values, format patterns
7166

7267
5. **Validate:** `./scripts/run_validation.sh`

0 commit comments

Comments
 (0)