skip auto-parsing of text frames when no body schema is defined#1912
skip auto-parsing of text frames when no body schema is defined#1912harsha-cpp wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughWebSocket message parsing now conditions automatic JSON coercion on schema presence. The parser factory accepts a ChangesSchema-aware WebSocket Message Parsing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/adapter/bun/index.tsOops! Something went wrong! :( ESLint: 9.39.4 Error: ESLint configuration in --config » plugin:sonarjs/recommended is invalid:
Referenced from: /.eslintrc.json ... [truncated 291 characters] ... /node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2952:16) src/ws/index.tsOops! Something went wrong! :( ESLint: 9.39.4 Error: ESLint configuration in --config » plugin:sonarjs/recommended is invalid:
Referenced from: /.eslintrc.json ... [truncated 291 characters] ... /node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2952:16) test/ws/message.test.tsOops! Something went wrong! :( ESLint: 9.39.4 Error: ESLint configuration in --config » plugin:sonarjs/recommended is invalid:
Referenced from: /.eslintrc.json ... [truncated 291 characters] ... /node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2952:16) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
fixes #1911.
problem:
createWSMessageParserunconditionally parses any text frame starting with",/,[, or{as JSON — so sending["ping"]delivers an array to the handler instead of the raw string. this happens even when nobodyschema is defined and the user never asked for parsing.fix: added a
hasSchemaparameter tocreateWSMessageParser(defaults tofalse). the auto-parse block only runs whenhasSchemais true. the bun adapter passes!!messageValidator, so coercion only fires when abodyschema is actually present. existing tests that relied on auto-parsing without a schema now includebody: t.Any().Summary by CodeRabbit