Skip to content

feat: add validation for sw_url#41

Merged
wu-sheng merged 2 commits intoapache:mainfrom
Fine0830:feat/validation
Apr 1, 2026
Merged

feat: add validation for sw_url#41
wu-sheng merged 2 commits intoapache:mainfrom
Fine0830:feat/validation

Conversation

@Fine0830
Copy link
Copy Markdown
Member

@Fine0830 Fine0830 commented Apr 1, 2026

No description provided.

@Fine0830 Fine0830 requested a review from Copilot April 1, 2026 08:20
@Fine0830 Fine0830 added this to the 0.2.0 milestone Apr 1, 2026
@Fine0830 Fine0830 added the enhancement New feature or request label Apr 1, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds centralized SkyWalking OAP URL normalization/validation and enforces it at transport command startup to fail fast on unsupported URL schemes.

Changes:

  • Introduces tools.NormalizeOAPURL() to finalize the GraphQL endpoint and validate allowed URL schemes.
  • Adds validateConfiguredSkyWalkingURL() and calls it from stdio, sse, and streamable command entrypoints.
  • Adds unit tests covering URL normalization and invalid scheme rejection across transports.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/tools/common.go Adds NormalizeOAPURL wrapper to finalize URL and validate scheme.
internal/tools/common_test.go Adds tests for NormalizeOAPURL including unsupported scheme coverage.
internal/swmcp/server.go Uses NormalizeOAPURL for configured URL + adds shared validation helper.
internal/swmcp/stdio.go Fails fast on invalid configured SkyWalking URL before starting stdio server.
internal/swmcp/sse.go Fails fast on invalid configured SkyWalking URL before starting SSE server.
internal/swmcp/streamable.go Fails fast on invalid configured SkyWalking URL before starting Streamable server.
internal/swmcp/server_test.go Adds tests ensuring invalid schemes are rejected by validation and transport commands.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Fine0830 Fine0830 requested a review from wu-sheng April 1, 2026 08:46
@wu-sheng wu-sheng merged commit 76027e3 into apache:main Apr 1, 2026
3 checks passed
@Fine0830 Fine0830 deleted the feat/validation branch April 1, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants