chore: update Postman client example in python folder.#1498
Conversation
…re working properly
|
WalkthroughThis pull request modifies the Python WebSocket client template and its associated test and documentation files. The test suite is updated to generate and store outputs for both the Postman and Hoppscotch client types in separate directories, using consistent filenames. The README instructions are revised to reflect the new import paths and usage for the Postman client. The example Python script is updated to use the new import path and to explicitly invoke the main function. Additionally, a minor formatting change is made in a JavaScript integration test file. Changes
Sequence Diagram(s)sequenceDiagram
participant TestRunner
participant Generator
participant FileSystem
TestRunner->>Generator: Generate Postman client (writes to /client_postman)
Generator->>FileSystem: Write client.py, requirements.txt to /client_postman
TestRunner->>Generator: Generate Hoppscotch client (writes to /client_hoppscotch)
Generator->>FileSystem: Write client.py, requirements.txt to /client_hoppscotch
TestRunner->>FileSystem: Read generated files for both clients
TestRunner->>TestRunner: Compare outputs to snapshots
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
🪧 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.
Actionable comments posted: 2
🧹 Nitpick comments (5)
packages/templates/clients/websocket/javascript/README.md (1)
9-9: Fix grammar and punctuation in the documentation.The instruction line has several minor grammar and punctuation issues that should be fixed for better readability.
- > By default this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change first line to `const WSClient = require('./test/temp/snapshotTestResult/postman-client/client-postman.js');` again. You will see example still works but now it is using a different API. This is possible since both AsyncAPI documents define the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API. + > By default, this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change the first line to `const WSClient = require('./test/temp/snapshotTestResult/postman-client/client-postman.js');` again. You will see the example still works but now it is using a different API. This is possible since both AsyncAPI documents define the same name of operation for sending messages: `sendEchoMessage`, so each client generated has the same API.🧰 Tools
🪛 LanguageTool
[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test:node example.js> By default this is testing against Postman echo se...(BY_DEFAULT_COMMA)
[uncategorized] ~9-~9: You might be missing the article “the” here.
Context: ...ocket/javascript/example.jsand change first line toconst WSClient = require('./te...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
[uncategorized] ~9-~9: Possible missing article found.
Context: ...ient-postman.js');` again. You will see example still works but now it is using a diffe...(AI_HYDRA_LEO_MISSING_THE)
[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... again. You will see example still works but now it is using a different API. This i...(COMMA_COMPOUND_SENTENCE)
packages/templates/clients/websocket/javascript/example.js (1)
10-10: Trailing whitespace detected.There is a trailing whitespace at the end of line 10 that should be removed.
-} +}packages/templates/clients/websocket/python/README.md (1)
11-11: Fix grammar issues and a typo in the documentation.There are several grammar issues and a typo ("agains" instead of "against") in this instruction line.
- > By default this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/python/example.py` and change first line to `from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient` and line 16 `client = PostmanEchoWebSocketClient()` and run `python example.py` again. You will see example still works but agains different API. This is possible as both AsyncAPI documents have the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API. + > By default, this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/python/example.py` and change the first line to `from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient` and line 16 to `client = PostmanEchoWebSocketClient()` and run `python example.py` again. You will see the example still works but against a different API. This is possible as both AsyncAPI documents have the same name of operation for sending messages: `sendEchoMessage`, so each client generated has the same API.🧰 Tools
🪛 LanguageTool
[uncategorized] ~11-~11: Did you mean: “By default,”?
Context: ...ted by the test:python example.py> By default this is testing against Postman echo se...(BY_DEFAULT_COMMA)
[uncategorized] ~11-~11: You might be missing the article “the” here.
Context: ...python example.pyagain. You will see example still works but agains different API. T...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
packages/templates/clients/websocket/javascript/test/integration.test.js (2)
22-22: Clean up unnecessary whitespaceThere's an empty line at line 32 that could be removed for consistency.
await generator.generateFromFile(asyncapi_v3_path_postman); - const client = await readFile(path.join(testResultPathPostman, testOutputFile), 'utf8');Also applies to: 32-33
57-57: Clean up unnecessary whitespaceThere's an empty line at line 66 that could be removed for consistency.
await generator.generateFromFile(asyncapi_v3_path_hoppscotch); - const clientOutputFile = path.join(testResultPathClient, defaultOutputFile);Also applies to: 66-67
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
apps/generator/lib/generator.js(1 hunks)packages/templates/clients/websocket/javascript/README.md(1 hunks)packages/templates/clients/websocket/javascript/example.js(2 hunks)packages/templates/clients/websocket/javascript/test/integration.test.js(6 hunks)packages/templates/clients/websocket/python/README.md(1 hunks)packages/templates/clients/websocket/python/test/example.py(3 hunks)packages/templates/clients/websocket/python/test/integration.test.js(3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/templates/clients/websocket/python/test/integration.test.js (1)
packages/templates/clients/websocket/javascript/test/integration.test.js (6)
testResultPathPostman(11-11)path(5-5)testResultPath(10-10)testResultPathHoppscotch(12-12)template(14-14)Generator(7-7)
🪛 LanguageTool
packages/templates/clients/websocket/javascript/README.md
[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: node example.js > By default this is testing against Postman echo se...
(BY_DEFAULT_COMMA)
[uncategorized] ~9-~9: You might be missing the article “the” here.
Context: ...ocket/javascript/example.jsand change first line toconst WSClient = require('./te...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
[uncategorized] ~9-~9: Possible missing article found.
Context: ...ient-postman.js');` again. You will see example still works but now it is using a diffe...
(AI_HYDRA_LEO_MISSING_THE)
[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... again. You will see example still works but now it is using a different API. This i...
(COMMA_COMPOUND_SENTENCE)
packages/templates/clients/websocket/python/README.md
[uncategorized] ~11-~11: Did you mean: “By default,”?
Context: ...ted by the test: python example.py > By default this is testing against Postman echo se...
(BY_DEFAULT_COMMA)
[uncategorized] ~11-~11: You might be missing the article “the” here.
Context: ...python example.py again. You will see example still works but agains different API. T...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
🪛 Ruff (0.8.2)
packages/templates/clients/websocket/python/test/example.py
1-1: temp.snapshotTestResult.client_postman.client.PostmanEchoWebSocketClientClient imported but unused
Remove unused import: temp.snapshotTestResult.client_postman.client.PostmanEchoWebSocketClientClient
(F401)
16-16: Undefined name PostmanEchoWebSocketClient
(F821)
🔇 Additional comments (9)
apps/generator/lib/generator.js (1)
12-13: Good defensive programming approach.The change adds a safeguard against
requireg.resolve('npm')potentially returning undefined or null, which prevents runtime errors that would occur when calling.replace()on an undefined value.packages/templates/clients/websocket/javascript/example.js (1)
1-1: Path update to align with new directory structure.The import path for the
WSClientmodule has been updated to reflect the new directory structure where client outputs are isolated by client type, improving organization.packages/templates/clients/websocket/javascript/test/integration.test.js (3)
11-13: LGTM - Directory structure reorganizationGood job separating the test output directories by client type. This organization makes the test outputs clearer and prevents potential file conflicts.
40-40: LGTM - Updated generator path for HoppscotchThe generator now correctly writes to the dedicated Hoppscotch directory.
Also applies to: 50-50
77-77: LGTM - Consistent test setupThe error test correctly uses the same directory structure as the success tests.
packages/templates/clients/websocket/python/test/example.py (1)
35-36: LGTM - Added proper Python entry point guardAdding the
if __name__ == "__main__":guard is a good Python practice that prevents the code from running when imported as a module.packages/templates/clients/websocket/python/test/integration.test.js (3)
11-12: LGTM - Separate output directories for different clientsGood job separating the test output directories by client type. Note that the directory naming convention differs slightly from the JavaScript template (
client_postmanvspostman-client), but it's consistent within this Python template.
19-21: LGTM - Consistent file naming and path updatesGood standardization of output file names and correct path updates for reading the generated files. This makes the test more maintainable.
Also applies to: 32-33
40-42: LGTM - Parallel implementation for Hoppscotch clientThe implementation for the Hoppscotch client mirrors the Postman client approach, which ensures consistency across different client types.
Also applies to: 53-54
| 6. Start example script that uses a client library generated by the test: `python example.py` | ||
|
|
||
| > By default this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/python/example.py` and change first line to `from temp.snapshotTestResult.client_hoppscotch import HoppscotchEchoWebSocketClient` and line 16 `client = HoppscotchEchoWebSocketClient()` and run `python example.py` again. You will see example still works but agains different API. This is possible as both AsyncAPI documents have the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API. No newline at end of file | ||
| > By default this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/python/example.py` and change first line to `from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient` and line 16 `client = PostmanEchoWebSocketClient()` and run `python example.py` again. You will see example still works but agains different API. This is possible as both AsyncAPI documents have the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API. No newline at end of file |
There was a problem hiding this comment.
Fix inconsistent class name in import statement.
There's an inconsistency in the class name - PostmanEchoWebSocketClientClient in the import statement, but PostmanEchoWebSocketClient when instantiating. The import statement appears to have an extra "Client" at the end.
- from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient
+ from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClient📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| > By default this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/python/example.py` and change first line to `from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient` and line 16 `client = PostmanEchoWebSocketClient()` and run `python example.py` again. You will see example still works but agains different API. This is possible as both AsyncAPI documents have the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API. | |
| > By default this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/python/example.py` and change first line to `from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClient` and line 16 `client = PostmanEchoWebSocketClient()` and run `python example.py` again. You will see example still works but agans different API. This is possible as both AsyncAPI documents have the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API. |
🧰 Tools
🪛 LanguageTool
[uncategorized] ~11-~11: Did you mean: “By default,”?
Context: ...ted by the test: python example.py > By default this is testing against Postman echo se...
(BY_DEFAULT_COMMA)
[uncategorized] ~11-~11: You might be missing the article “the” here.
Context: ...python example.py again. You will see example still works but agains different API. T...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
| @@ -1,4 +1,4 @@ | |||
| from temp.snapshotTestResult.client_postman import PostmanEchoWebSocketClientClient | |||
| from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient | |||
There was a problem hiding this comment.
Fix import/instantiation mismatch
There's a mismatch between the imported class and the instantiated class. The import statement imports PostmanEchoWebSocketClientClient but the code tries to instantiate PostmanEchoWebSocketClient.
-from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient
+from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClient
def custom_message_handler(message):
print(f"\033[94mCustom processing of received message\033[0m: {message}")
def custom_error_handler(error):
print(f"Custom error handling: {error}")
def outgoing_message_processor(message):
# Modify message before sending (e.g., add a timestamp)
print(f"\033[92mCustom processing of outgoing message\033[0m: {message}")
return {"Processed outgoing message": message, "timestamp": "2025-03-13T12:00:00Z"}
def main():
client = PostmanEchoWebSocketClient()Also applies to: 16-16
🧰 Tools
🪛 Ruff (0.8.2)
1-1: temp.snapshotTestResult.client_postman.client.PostmanEchoWebSocketClientClient imported but unused
Remove unused import: temp.snapshotTestResult.client_postman.client.PostmanEchoWebSocketClientClient
(F401)
derberg
left a comment
There was a problem hiding this comment.
seems like some duplication of work from another PR
| const Config = require('@npmcli/config'); | ||
| const requireg = require('requireg'); | ||
| const npmPath = requireg.resolve('npm').replace('index.js',''); | ||
| const npmResolvedPath = requireg.resolve('npm') || ''; |
There was a problem hiding this comment.
not related to the task, please revert
de7fd63 to
b2b8515
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
packages/templates/clients/websocket/python/example.py (3)
1-1: Import path seems specific to test environmentThe import path
temp.snapshotTestResult.client_postman.clientappears to be specific to a testing context, which might be confusing for developers trying to use this example in their actual projects. Consider providing a comment explaining this is a demo path or showing the expected production import path.-from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient +# Note: In your actual project, the import path will depend on your project structure +# This path is specific to the generator test environment +from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient
11-13: Use dynamic timestamp instead of hardcoded valueThe outgoing message processor uses a hardcoded timestamp ("2025-03-13T12:00:00Z") which doesn't demonstrate real-world usage where you'd typically want the current time.
def outgoing_message_processor(message): # Modify message before sending (e.g., add a timestamp) print(f"\033[92mCustom processing of outgoing message\033[0m: {message}") - return {"Processed outgoing message": message, "timestamp": "2025-03-13T12:00:00Z"} + from datetime import datetime + current_time = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ") + return {"Processed outgoing message": message, "timestamp": current_time}
4-34: Add more explanatory commentsThe example would benefit from more detailed comments explaining the purpose and expected behavior of each section, especially for developers new to WebSocket clients.
Consider adding more descriptive comments that explain:
- The purpose of each handler function
- What to expect in the console output
- The flow of the WebSocket connection process
- The expected server responses
For example:
def custom_message_handler(message): + # This handler is called whenever a message is received from the server + # The blue color helps distinguish incoming messages in the console print(f"\033[94mCustom processing of received message\033[0m: {message}")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/templates/clients/websocket/python/example.py(1 hunks)
🔇 Additional comments (1)
packages/templates/clients/websocket/python/example.py (1)
1-37: LGTM overall with suggestions for improvementThe example effectively demonstrates the basic usage of the WebSocket client with custom handlers. The code structure is clear and includes the essential components: connection establishment, message sending, and handler registration. With the suggested improvements for error handling, dynamic timestamps, and better documentation, this will be an excellent reference for users.
| def main(): | ||
| client = PostmanEchoWebSocketClientClient() | ||
| client.register_message_handler(custom_message_handler) | ||
| client.register_error_handler(custom_error_handler) | ||
| client.register_outgoing_processor(outgoing_message_processor) | ||
|
|
||
| client.connect() | ||
|
|
||
| # Give some time for the connection to establish | ||
| time.sleep(2) | ||
|
|
||
| # Send multiple messages to test stream handling | ||
| for i in range(5): | ||
| message = f'Hello, Echo Yo! {i}' | ||
| client.send_message(message) | ||
| time.sleep(2) # Wait for a response | ||
|
|
||
| # Keep program alive for a while to allow message processing | ||
| time.sleep(10) |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Add proper connection error handling and cleanup
The example lacks error handling for connection issues and doesn't demonstrate how to properly close the WebSocket connection, which is important for resource management in real applications.
def main():
client = PostmanEchoWebSocketClientClient()
client.register_message_handler(custom_message_handler)
client.register_error_handler(custom_error_handler)
client.register_outgoing_processor(outgoing_message_processor)
- client.connect()
-
- # Give some time for the connection to establish
- time.sleep(2)
+ try:
+ # Connect to the WebSocket server
+ client.connect()
+
+ # Give some time for the connection to establish
+ time.sleep(2)
- # Send multiple messages to test stream handling
- for i in range(5):
- message = f'Hello, Echo Yo! {i}'
- client.send_message(message)
- time.sleep(2) # Wait for a response
+ # Send multiple messages to test stream handling
+ for i in range(5):
+ message = f'Hello, Echo Yo! {i}'
+ client.send_message(message)
+ time.sleep(2) # Wait for a response
- # Keep program alive for a while to allow message processing
- time.sleep(10)
+ # Keep program alive for a while to allow message processing
+ time.sleep(10)
+ except Exception as e:
+ print(f"Error occurred: {e}")
+ finally:
+ # Always close the connection when done
+ print("Closing connection...")
+ client.disconnect() # Assuming the client has a disconnect method📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| def main(): | |
| client = PostmanEchoWebSocketClientClient() | |
| client.register_message_handler(custom_message_handler) | |
| client.register_error_handler(custom_error_handler) | |
| client.register_outgoing_processor(outgoing_message_processor) | |
| client.connect() | |
| # Give some time for the connection to establish | |
| time.sleep(2) | |
| # Send multiple messages to test stream handling | |
| for i in range(5): | |
| message = f'Hello, Echo Yo! {i}' | |
| client.send_message(message) | |
| time.sleep(2) # Wait for a response | |
| # Keep program alive for a while to allow message processing | |
| time.sleep(10) | |
| def main(): | |
| client = PostmanEchoWebSocketClientClient() | |
| client.register_message_handler(custom_message_handler) | |
| client.register_error_handler(custom_error_handler) | |
| client.register_outgoing_processor(outgoing_message_processor) | |
| try: | |
| # Connect to the WebSocket server | |
| client.connect() | |
| # Give some time for the connection to establish | |
| time.sleep(2) | |
| # Send multiple messages to test stream handling | |
| for i in range(5): | |
| message = f'Hello, Echo Yo! {i}' | |
| client.send_message(message) | |
| time.sleep(2) # Wait for a response | |
| # Keep program alive for a while to allow message processing | |
| time.sleep(10) | |
| except Exception as e: | |
| print(f"Error occurred: {e}") | |
| finally: | |
| # Always close the connection when done | |
| print("Closing connection...") | |
| client.disconnect() # Assuming the client has a disconnect method |
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
packages/templates/clients/websocket/python/README.md (1)
10-10:⚠️ Potential issueFix inconsistent class name in import and instantiation.
There's an inconsistency in the class name: the import statement uses
PostmanEchoWebSocketClientClient, but the instantiation should match this name. The correct class name is likelyPostmanEchoWebSocketClient. Please update both the import and instantiation to use the same, correct class name.- from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient + from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClient ... - client = PostmanEchoWebSocketClientClient() + client = PostmanEchoWebSocketClient()🧰 Tools
🪛 LanguageTool
[uncategorized] ~10-~10: Did you mean: “By default,”?
Context: ...ted by the test:python example.py> By default this is testing against Postman echo se...(BY_DEFAULT_COMMA)
[uncategorized] ~10-~10: You might be missing the article “the” here.
Context: ...python example.pyagain. You will see example still works but agains different API. T...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
🧹 Nitpick comments (1)
packages/templates/clients/websocket/python/README.md (1)
10-10: Correct grammar and typos for clarity.
- Add a comma after "By default".
- Change "agains" to "against".
- Consider adding "the" before "example" for clarity.
- > By default this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/python/example.py` and change first line to `from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient` and line 16 `client = PostmanEchoWebSocketClientClient()` and run `python example.py` again. You will see example still works but agains different API. This is possible as both AsyncAPI documents have the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API. + > By default, this is testing against the Postman echo service. You can modify `packages/templates/clients/websocket/python/example.py` and change the first line to `from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClient` and line 16 to `client = PostmanEchoWebSocketClient()`, then run `python example.py` again. You will see the example still works but against a different API. This is possible as both AsyncAPI documents have the same name of operation for sending messages: `sendEchoMessage`, so each client generated has the same API.🧰 Tools
🪛 LanguageTool
[uncategorized] ~10-~10: Did you mean: “By default,”?
Context: ...ted by the test:python example.py> By default this is testing against Postman echo se...(BY_DEFAULT_COMMA)
[uncategorized] ~10-~10: You might be missing the article “the” here.
Context: ...python example.pyagain. You will see example still works but agains different API. T...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/templates/clients/websocket/python/README.md(1 hunks)packages/templates/clients/websocket/python/example.py(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/templates/clients/websocket/python/example.py
🧰 Additional context used
🪛 LanguageTool
packages/templates/clients/websocket/python/README.md
[uncategorized] ~10-~10: Did you mean: “By default,”?
Context: ...ted by the test: python example.py > By default this is testing against Postman echo se...
(BY_DEFAULT_COMMA)
[uncategorized] ~10-~10: You might be missing the article “the” here.
Context: ...python example.py again. You will see example still works but agains different API. T...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
|
there are some old snapshot tests, run locally |
hey Lukas, and after making those changes in Any suggestions ??? I just listed my observation, for this PR i will not add |
eb28241 to
4bc549c
Compare
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/templates/clients/websocket/python/README.md (2)
8-10: Refine grammar and clarity for preparatory steps.These lines are missing articles and can be made more consistent and readable. For example:
- 4. Go to test folder with `cd test` + 4. Go to the test folder with `cd test` - 5. Install dependencies of the generated client: `pip install -r temp/snapshotTestResult/requirements.txt` + 5. Install the dependencies of the generated client: `pip install -r temp/snapshotTestResult/requirements.txt` - 6. Start example script that uses a client library generated by the test: `python example.py` + 6. Start the example script that uses the generated client library: `python example.py`🧰 Tools
🪛 LanguageTool
[uncategorized] ~8-~8: You might be missing the article “the” here.
Context: ...d run test withnpm run test4. Go to test folder withcd test5. Install depend...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
[uncategorized] ~10-~10: You might be missing the article “an” here.
Context: ...otTestResult/requirements.txt` 6. Start example script that uses a client library gener...(AI_EN_LECTOR_MISSING_DETERMINER_AN)
12-12: Correct typo and improve readability of default testing note.Line 12 has several minor issues: missing comma after “By default”, missing article “the”, and a typo in “agains”. Suggested diff:
- > By default this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/python/example.py` and change first line to `from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient` and line 16 `client = PostmanEchoWebSocketClientClient()` and run `python example.py` again. You will see example still works but agains different API. This is possible as both AsyncAPI documents have the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API. + > By default, this is testing against the Postman echo service. You can modify `packages/templates/clients/websocket/python/example.py`: + > - Change the import on the first line to: + > `from temp.snapshotTestResult.client_postman.client import PostmanEchoWebSocketClientClient` + > - Update line 16 to: + > `client = PostmanEchoWebSocketClientClient()` + > - Run `python example.py` again. You will see the example still works but against a different API. This is possible because both AsyncAPI documents use the same operation name (`sendEchoMessage`), so each generated client has an identical interface.🧰 Tools
🪛 LanguageTool
[uncategorized] ~12-~12: Did you mean: “By default,”?
Context: ...ted by the test:python example.py> By default this is testing against Postman echo se...(BY_DEFAULT_COMMA)
[uncategorized] ~12-~12: You might be missing the article “the” here.
Context: ...python example.pyagain. You will see example still works but agains different API. T...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
packages/templates/clients/websocket/python/test/__snapshots__/integration.test.js.snapis excluded by!**/*.snap
📒 Files selected for processing (4)
packages/templates/clients/websocket/javascript/test/integration.test.js(1 hunks)packages/templates/clients/websocket/python/README.md(1 hunks)packages/templates/clients/websocket/python/example.py(2 hunks)packages/templates/clients/websocket/python/test/integration.test.js(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/templates/clients/websocket/python/example.py
- packages/templates/clients/websocket/python/test/integration.test.js
- packages/templates/clients/websocket/javascript/test/integration.test.js
🧰 Additional context used
🪛 LanguageTool
packages/templates/clients/websocket/python/README.md
[uncategorized] ~8-~8: You might be missing the article “the” here.
Context: ...d run test with npm run test 4. Go to test folder with cd test 5. Install depend...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
[uncategorized] ~10-~10: You might be missing the article “an” here.
Context: ...otTestResult/requirements.txt` 6. Start example script that uses a client library gener...
(AI_EN_LECTOR_MISSING_DETERMINER_AN)
[uncategorized] ~12-~12: Did you mean: “By default,”?
Context: ...ted by the test: python example.py > By default this is testing against Postman echo se...
(BY_DEFAULT_COMMA)
[uncategorized] ~12-~12: You might be missing the article “the” here.
Context: ...python example.py again. You will see example still works but agains different API. T...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
🔇 Additional comments (1)
packages/templates/clients/websocket/python/README.md (1)
12-12: Verify client class name in import and instantiation.The class name
PostmanEchoWebSocketClientClientappears to include “Client” twice. Please confirm that this matches the actual class defined in the generated code. If the class is namedPostmanEchoWebSocketClient, adjust the import and instantiation accordingly to avoid confusion.🧰 Tools
🪛 LanguageTool
[uncategorized] ~12-~12: Did you mean: “By default,”?
Context: ...ted by the test:python example.py> By default this is testing against Postman echo se...(BY_DEFAULT_COMMA)
[uncategorized] ~12-~12: You might be missing the article “the” here.
Context: ...python example.pyagain. You will see example still works but agains different API. T...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
|
/rtm |
|
@allcontributors please add @Light13008 for test,review |
|
I've put up a pull request to add @Light13008! 🎉 |





Description
-Only updated for python.
-
client-postmanandclient-hoppscotchwere added with respectiveREADME.mdand 'example.py'-To work on echo we first need to adapt to the new file structure.
Fixes #1373
Related issue(s)
Fixes #1373 for Python filesSummary by CodeRabbit
Documentation
Tests
Style