-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Enabling GraphQL endpoint to support special characters in column names #1860
Comments
For option 2, do we plan to do the following? If yes, why do we need it if the name is already as per convention?
Also, if we will be applying this for both REST and GraphQL, the name for the config option should reflect that. Perhaps, just name as |
Option 2 originally seeks to apply the naming convention only if characters are invalid for GraphQL naming. This means that if the names are valid (e.g. _myType) but not necessarily following the convention (recommends camcelcase and no underscore), there would be no sanitization applied. The alternate proposal was to always sanitize the field names if not following convention. I dont suggest we do this although some may prefer that
|
Is #654 covered within this scope? |
Good point. If the names are non-English characters, that may cause an impact to name sanitization.
|
The word
|
fair point - updated proposal to change config option name |
Problem statement
A table or a view in SQL may have special characters such as space for column names. If the developer does not provide explicit fieldmappings under the entity in config, then the field names are derived as is from column names. However special characters such as spaces are not supported in GraphQL names(acceptable characters per spec) and while DAB starts up fine, the GraphQL calls fail due to invalid schema. Specifying fieldmappings for applicable entities may be cumbersome process if numerous table names have special characters. Note that the issue does not impact REST endpoint/swagger as special characters for entity fields are escaped and accepted.
See related discussion on #1528, #692 and #1479.
There are several ways we can look to address the issue for GraphQL involved if no field mappings provided.
1. Throw error upfront
2. Introduce config option
sanitize-fields-for-graphql
standardize-fieldnames
with boolean type defaulting to false.This approach looks to sanitize the field names only when invalid and avoid impacting REST by default.
3. Sanitize column names to field names whenever invalid characters present with no config option
I propose we go with Option 2 to avoid breaking changes for customers who have REST enabled. The documentation can clarify the impact of enabling this option.
Looking forward to feedback and alternative proposals if any.
The text was updated successfully, but these errors were encountered: