-
Notifications
You must be signed in to change notification settings - Fork 348
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
[v0] Add integration test for a complex URL as an endpoint for JSON Schema handler #8393
Conversation
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis pull request introduces a new JSON Schema configuration in the Changes
Sequence Diagram(s)sequenceDiagram
participant T as Test Suite
participant M as Mesh Instance
participant S as HTTP Server
participant A as Assets (getData.json)
T->>M: Invoke GetData Query with parameter (some_arg)
M->>S: Forward GET request with query parameters
S->>S: Process request (apply auth, extract URL)
S-->>M: Return JSON response with authorization and URL
M-->>T: Relay GetDataResponse
Suggested reviewers
Poem
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
examples/json-schema-complex-url/src/index.tsOops! Something went wrong! :( ESLint: 9.20.1 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by examples/json-schema-complex-url/tests/json-schema-complex-url.test.tsOops! Something went wrong! :( ESLint: 9.20.1 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
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 (
|
a9f75af
to
f989c74
Compare
examples/json-schema-complex-url/tests/json-schema-complex-url.test.ts
Dismissed
Show dismissed
Hide dismissed
Apollo Federation Subgraph Compatibility Results
Learn more: |
🚀 Snapshot Release (
|
Package | Version | Info |
---|---|---|
@graphql-mesh/apollo-link |
0.105.19-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/cli |
0.98.24-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/config |
0.106.24-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/http |
0.105.19-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/migrate-config-cli |
1.4.16-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/runtime |
0.105.19-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/urql-exchange |
0.105.19-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-live-query |
0.103.18-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-newrelic |
0.103.18-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-operation-field-permissions |
0.103.18-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-rate-limit |
0.103.18-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-response-cache |
0.103.20-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-statsd |
0.103.18-alpha-20250219081133-b77842b3ba576c07c73a0e351199c422278d2494 |
npm ↗︎ unpkg ↗︎ |
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: 2
🧹 Nitpick comments (2)
examples/json-schema-complex-url/src/index.ts (2)
3-11
: Add error handling for edge cases.The server implementation should handle potential errors:
- Request parsing errors
- JSON serialization errors
export default createServer((req, res) => { + try { res.writeHead(200, { 'Content-Type': 'application/json' }); res.end( JSON.stringify({ authorization: req.headers.authorization, url: req.url, }), ); + } catch (error) { + console.error('Error processing request:', error); + res.writeHead(500, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ error: 'Internal server error' })); + } }).listen(8515, () => {
11-13
: Consider making the port number configurable.The port number is hard-coded. Consider making it configurable through environment variables for better flexibility.
+const PORT = process.env.PORT || 8515; -}).listen(8515, () => { +}).listen(PORT, () => { - console.log('Server is running on http://localhost:8515'); + console.log(`Server is running on http://localhost:${PORT}`);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (7)
examples/json-schema-complex-url/.meshrc.yml
(1 hunks)examples/json-schema-complex-url/assets/getData.json
(1 hunks)examples/json-schema-complex-url/package.json
(1 hunks)examples/json-schema-complex-url/sandbox.config.json
(1 hunks)examples/json-schema-complex-url/src/index.ts
(1 hunks)examples/json-schema-complex-url/tests/json-schema-complex-url.test.ts
(1 hunks)package.json
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- examples/json-schema-complex-url/sandbox.config.json
- examples/json-schema-complex-url/assets/getData.json
- examples/json-schema-complex-url/package.json
🧰 Additional context used
🪛 GitHub Check: CodeQL
examples/json-schema-complex-url/tests/json-schema-complex-url.test.ts
[failure] 40-40: Hard-coded credentials
The hard-coded value "Basic dXNlcm5hbWU6cGFzc3dvcmQ=" is used as authorization header.
⏰ Context from checks skipped due to timeout of 90000ms (12)
- GitHub Check: e2e / node v22
- GitHub Check: e2e / node v18
- GitHub Check: check
- GitHub Check: integration / node 22
- GitHub Check: unit / node 22
- GitHub Check: integration / node 20
- GitHub Check: apollo-federation-compatibility
- GitHub Check: unit / node 20
- GitHub Check: integration / node 18
- GitHub Check: unit / node 18
- GitHub Check: release / snapshot
- GitHub Check: deployment
🔇 Additional comments (3)
examples/json-schema-complex-url/tests/json-schema-complex-url.test.ts (1)
5-46
: Well-structured test implementation!The test suite effectively:
- Initializes and cleans up resources properly
- Tests the complex URL handling with query parameters
- Verifies the authorization header and URL construction
🧰 Tools
🪛 GitHub Check: CodeQL
[failure] 40-40: Hard-coded credentials
The hard-coded value "Basic dXNlcm5hbWU6cGFzc3dvcmQ=" is used as authorization header.examples/json-schema-complex-url/.meshrc.yml (1)
1-15
: Well-structured Mesh configuration!The configuration effectively:
- Defines the JSON Schema handler
- Configures the complex URL endpoint
- Specifies the query operation with proper argument mapping
package.json (1)
39-39
: LGTM!The build script is correctly updated to include the new workspace.
💻 Website PreviewThe latest changes are available as preview in: https://c831a395.graphql-mesh.pages.dev |
f989c74
to
b77842b
Compare
Tests if a complex URL is handled correctly by JSON Schema handler;
This complex URL contains;
/pathname
❌username:password@domain
✅localhost:PORT
✅?queryparam=value
✅Summary by CodeRabbit
New Features
Tests
Chores