-
Notifications
You must be signed in to change notification settings - Fork 27
Allow a string value to be passed to Capability constructor
#586
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
Conversation
|
Warning Rate limit exceeded@VeskeR has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 37 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (4)
WalkthroughThe changes update method signatures and capability parsing. In the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
ably/types/capability.py (1)
21-21: Fix whitespace in blank line.Remove the whitespace characters from the blank line to resolve the linting warning.
- +🧰 Tools
🪛 GitHub Actions: Linting check
[warning] 21-21: blank line contains whitespace
test/ably/rest/restcapability_test.py (1)
244-254: LGTM! Comprehensive test coverage for string capabilities.The test verifies both double and single-quoted JSON string inputs, ensuring compatibility with dictionary-based capabilities.
Follow Python naming conventions by using snake_case for variable names:
- capabilityFromStr = Capability('{"cansubscribe":["subscribe"]}') - capabilityFromStrSingleQuote = Capability('{\'cansubscribe\':[\'subscribe\']}') - capabilityFromDict = Capability({ + capability_from_str = Capability('{"cansubscribe":["subscribe"]}') + capability_from_str_single_quote = Capability('{\'cansubscribe\':[\'subscribe\']}') + capability_from_dict = Capability({🧰 Tools
🪛 GitHub Actions: Linting check
[warning] 246-246: variable in function should be lowercase
[warning] 247-247: variable in function should be lowercase
[warning] 249-249: variable in function should be lowercase
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
ably/rest/auth.py(1 hunks)ably/types/capability.py(2 hunks)ably/types/tokendetails.py(1 hunks)test/ably/rest/restcapability_test.py(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Linting check
test/ably/rest/restcapability_test.py
[warning] 246-246: variable in function should be lowercase
[warning] 247-247: variable in function should be lowercase
[warning] 249-249: variable in function should be lowercase
ably/types/capability.py
[warning] 21-21: blank line contains whitespace
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: check (3.13)
- GitHub Check: check (3.12)
- GitHub Check: check (3.11)
- GitHub Check: check (3.10)
🔇 Additional comments (3)
ably/types/tokendetails.py (1)
23-23: LGTM! Code simplification improves maintainability.The simplified initialization of
__capabilityleverages the enhancedCapabilityconstructor, reducing code complexity while maintaining functionality.ably/types/capability.py (1)
11-18: LGTM! Robust implementation of string capability parsing.The implementation correctly handles both double and single-quoted JSON strings, with proper error handling and type hints.
ably/rest/auth.py (1)
232-232: LGTM! Method signature updated to support string input.The type annotation correctly reflects the RSA9f specification requirement to accept JSON text for token parameters while maintaining backward compatibility.
00278d7 to
a6faf1d
Compare
ttypic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
a6faf1d to
c8af383
Compare
c8af383 to
2d004f3
Compare
2d004f3 to
e14e447
Compare
This implements RSA9f [1] and TK2b [2], where a capability JSON text can be provided for a `Auth#createTokenRequest` function and when passing `TokenParams` object Resolves #579 [1] https://sdk.ably.com/builds/ably/specification/main/features/#RSA9f [2] https://sdk.ably.com/builds/ably/specification/main/features/#TK2b
e14e447 to
9213854
Compare
This implements RSA9f and TK2b, where a capability JSON text can be provided for a
Auth#createTokenRequestfunction and when passingTokenParamsobjectResolves #579
Summary by CodeRabbit
New Features
Capabilityobjects from JSON strings, enhancing test coverage.Refactor