Remove whitespaces from autoentity-generated names to prevent invalid REST paths and GraphQL singular/plural tables for SQL objects with spaces#3609
Open
Copilot wants to merge 16 commits into
Conversation
Agent-Logs-Url: https://github.com/Azure/data-api-builder/sessions/2051de6a-3432-4bd6-901c-3a3d6a8cc114 Co-authored-by: RubenCerna2079 <32799214+RubenCerna2079@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix invalid REST paths generated for tables with spaces
Sanitize autoentity-generated names to prevent invalid REST paths for SQL objects with spaces
May 19, 2026
anushakolan
requested changes
Jun 9, 2026
… collision message, split whitespace test
Contributor
|
LGTM! |
anushakolan
approved these changes
Jun 16, 2026
souvikghosh04
approved these changes
Jul 1, 2026
souvikghosh04
left a comment
Contributor
There was a problem hiding this comment.
Thanks for addressing the comments. Approved.
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?
Tables with whitespace in names (for example,
Order Items) were being auto-generated into entity names likedbo_Order Items, which then produced invalid REST paths as well as invalid GraphQL names for singular/plural tables which failed config validation. This change ensures autoentity name generation does not pass whitespace through to REST path and GraphQL singular/plural tables defaults.{schema}/{object}verbatim; whitespace in object names breaksdab validate.What is this change?
RemoveWhitespaceAddCamelCaseinSqlMetadataProviderand applied it to generatedentity_namebefore entity creation. The method name is intentionally specific to clarify it only removes whitespace (not other invalid characters).dbo_Order Items→dbo_OrderItems.TryAddfails because two database objects normalize to the same entity name (e.g."Order Item"and"OrderItem"both yield"OrderItem"), the exception message includes the pre-normalization name and schema to make the collision diagnosable.TestAutoentitiesGeneratedWithSpacesInObjectNametest method that explicitly asserts the sanitized entity namedbo_OrderItems(viaconst string EXPECTED_ENTITY_NAME) and validates end-to-end REST and GraphQL access with that name.TestAutoentitiesGeneratedWithUnusualElementsfor better readability and maintainability.How was this tested?
Sample Request(s)
dab auto-config add mydef --patterns.include "dbo.Order Items" --patterns.name "{schema}_{object}"dab validatedbo.[Order Items]dbo_OrderItems(no whitespace)