Skip to content

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

Open
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-multi-segment-paths
Open

Allow multi-segment runtime REST/GraphQL paths (e.g. /api/v2)#3684
Copilot wants to merge 2 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 on lines +73 to +77
/// Each segment is validated to ensure it is non-empty and free of reserved characters.
/// An empty input (representing the root path '/') is considered valid.
/// </summary>
/// <param name="uriPath">Path prefix for rest/graphql apis with the leading '/' already removed.</param>
/// <returns>true if any segment is empty or contains reserved characters, false otherwise.</returns>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Review In Progress

Development

Successfully merging this pull request may close these issues.

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

5 participants