Skip to content

Allow multi-segment runtime REST/GraphQL paths (e.g. /api/v2)#3684

Merged
souvikghosh04 merged 4 commits into
mainfrom
copilot/fix-multi-segment-paths
Jul 3, 2026
Merged

Allow multi-segment runtime REST/GraphQL paths (e.g. /api/v2)#3684
souvikghosh04 merged 4 commits into
mainfrom
copilot/fix-multi-segment-paths

Conversation

Copilot AI commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Why make this change?

  • Closes [Bug]: dab configure --runtime.rest.path rejects multi-segment paths #3336
  • dab configure --runtime.rest.path "/api/v2" (and the GraphQL equivalent) failed with contains one or more reserved characters. The path validator stripped the leading / and then rejected the whole remainder using a regex where / is itself reserved, so any multi-segment path was rejected even though routing supports them.

What is this change?

  • Segment-aware validation: Added RuntimeConfigValidatorUtil.DoesUriPathContainReservedChars, which splits the path (after the leading /) into /-separated segments and validates each one. / is now permitted as a separator; empty segments (leading/consecutive/trailing slashes) and reserved characters are still rejected. The root path / stays valid.
  • Shared validator updated: TryValidateUriComponent now uses the helper, so REST, GraphQL, MCP, and base-route all accept multi-segment paths while preserving existing error messages for genuinely invalid input.
  • CLI parity: IsURIComponentValid (used by dab init) now uses the same segment-aware check.
  • Tests: Updated existing E2E rows that asserted multi-segment paths fail; added positive /api/v2 cases and empty-segment/trailing-slash failure cases across configure, init, and config-validation tests.

How was this tested?

  • Integration Tests
  • Unit Tests

Sample Request(s)

# Previously rejected, now accepted
dab configure --runtime.rest.path "/api/v2" --config test.json
dab configure --runtime.graphql.path "/api/v2" --config test.json

# Still rejected
dab configure --runtime.rest.path "/api//v2"  --config test.json   # empty segment
dab configure --runtime.rest.path "/api/"      --config test.json   # trailing slash

Copilot AI changed the title [WIP] Fix dab configure to accept multi-segment rest paths Allow multi-segment runtime REST/GraphQL paths (e.g. /api/v2) Jun 26, 2026
Copilot AI requested a review from souvikghosh04 June 26, 2026 08:24
@souvikghosh04 souvikghosh04 moved this from Todo to In Progress in Data API builder Jun 26, 2026
@souvikghosh04 souvikghosh04 marked this pull request as ready for review June 26, 2026 09:57
Copilot AI review requested due to automatic review settings June 26, 2026 09:57
@souvikghosh04 souvikghosh04 moved this from In Progress to Review In Progress in Data API builder Jun 26, 2026
@souvikghosh04 souvikghosh04 moved this from Review In Progress to In Progress in Data API builder Jun 26, 2026
@souvikghosh04 souvikghosh04 added this to the June 2026 milestone Jun 26, 2026
@souvikghosh04 souvikghosh04 marked this pull request as draft June 26, 2026 10:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes runtime path validation so multi-segment REST/GraphQL paths (e.g. /api/v2) are accepted while still rejecting empty segments and reserved characters, aligning CLI behavior (dab configure, dab init) with runtime routing capabilities.

Changes:

  • Added segment-aware runtime path validation (DoesUriPathContainReservedChars) and wired it into TryValidateUriComponent.
  • Updated CLI validation (IsURIComponentValid) to use the same segment-aware check for parity.
  • Updated/added tests to cover multi-segment success cases and empty-segment/trailing-slash failure cases.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Core/Configurations/RuntimeConfigValidatorUtil.cs Implements segment-aware runtime path validation and updates shared runtime validation to allow / as a segment separator.
src/Cli/Utils.cs Aligns CLI URI component validation with the new segment-aware runtime validator.
src/Service.Tests/UnitTests/ConfigValidationUnitTests.cs Adds positive and negative unit test cases for multi-segment runtime paths and empty-segment/trailing-slash scenarios.
src/Cli.Tests/EndToEndTests.cs Updates E2E CLI tests to validate multi-segment paths succeed and empty segments fail.
src/Cli.Tests/ConfigureOptionsTests.cs Adds configure-option test coverage for multi-segment REST paths.

Comment thread src/Core/Configurations/RuntimeConfigValidatorUtil.cs
souvikghosh04 and others added 2 commits June 30, 2026 11:18
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@RubenCerna2079 RubenCerna2079 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Approved assuming comments will be addressed.

Comment thread src/Cli.Tests/EndToEndTests.cs
Comment thread src/Cli.Tests/EndToEndTests.cs
Comment thread src/Service.Tests/UnitTests/ConfigValidationUnitTests.cs
@souvikghosh04 souvikghosh04 enabled auto-merge (squash) July 2, 2026 10:24
@souvikghosh04

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 6 pipeline(s).

@souvikghosh04 souvikghosh04 merged commit b2cf224 into main Jul 3, 2026
12 checks passed
@souvikghosh04 souvikghosh04 deleted the copilot/fix-multi-segment-paths branch July 3, 2026 10:56
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Data API builder Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: dab configure --runtime.rest.path rejects multi-segment paths

5 participants