Expected
When autoentities discovers a table with a space in its name (e.g., Order Items), the generated entity name should be sanitized to produce a valid GraphQL identifier — or dab auto-config should warn the user before generating the config.
Actual
dab validate fails with:
fail: Entity dbo_Order Items contains characters disallowed by GraphQL.
fail: Config is invalid.
The {schema}_{object} name pattern passes the space through verbatim. GraphQL identifiers must match [_A-Za-z][_0-9A-Za-z]*, so dbo_Order Items is rejected. The user must manually add an exclude pattern to work around this.
Suggestion
Remember you have Humanizer you can use! It's already a referenced library and how the CLI works.
Use Humanizer (already a project dependency) to PascalCase the interpolated entity name. This strips spaces, handles edge cases, and produces identifiers that are valid for both REST paths and GraphQL in a single call.
using Humanizer;
static string SanitizeEntityName(string name)
{
return name.Pascalize();
}
"dbo_Order Items" → "Dbo_order_items" — not ideal. Pascalize() works on snake_case, not mixed input. Better approach:
using Humanizer;
static string SanitizeEntityName(string schema, string objectName)
{
string sanitizedObject = objectName.Dehumanize();
return $"{schema}_{sanitizedObject}";
}
("dbo", "Order Items") → "dbo_OrderItems"
Apply this during name-pattern interpolation — before {schema} and {object} are substituted into the pattern, run Dehumanize() on the object name. Dehumanize() converts a human-readable string to PascalCase, stripping spaces and producing a valid GraphQL/REST identifier in one call.
Expected
When
autoentitiesdiscovers a table with a space in its name (e.g.,Order Items), the generated entity name should be sanitized to produce a valid GraphQL identifier — ordab auto-configshould warn the user before generating the config.Actual
dab validatefails with:The
{schema}_{object}name pattern passes the space through verbatim. GraphQL identifiers must match[_A-Za-z][_0-9A-Za-z]*, sodbo_Order Itemsis rejected. The user must manually add anexcludepattern to work around this.Suggestion
Use Humanizer (already a project dependency) to PascalCase the interpolated entity name. This strips spaces, handles edge cases, and produces identifiers that are valid for both REST paths and GraphQL in a single call.
"dbo_Order Items"→"Dbo_order_items"— not ideal.Pascalize()works on snake_case, not mixed input. Better approach:("dbo", "Order Items")→"dbo_OrderItems"Apply this during name-pattern interpolation — before
{schema}and{object}are substituted into the pattern, runDehumanize()on the object name.Dehumanize()converts a human-readable string to PascalCase, stripping spaces and producing a valid GraphQL/REST identifier in one call.