Allow multi-segment runtime REST/GraphQL paths (e.g. /api/v2)#3684
Open
Copilot wants to merge 2 commits into
Open
Allow multi-segment runtime REST/GraphQL paths (e.g. /api/v2)#3684Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
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
Contributor
There was a problem hiding this comment.
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 intoTryValidateUriComponent. - 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why make this change?
dab configure --runtime.rest.path "/api/v2"(and the GraphQL equivalent) failed withcontains 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?
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.TryValidateUriComponentnow uses the helper, so REST, GraphQL, MCP, and base-route all accept multi-segment paths while preserving existing error messages for genuinely invalid input.IsURIComponentValid(used bydab init) now uses the same segment-aware check./api/v2cases and empty-segment/trailing-slash failure cases across configure, init, and config-validation tests.How was this tested?
Sample Request(s)