-
Notifications
You must be signed in to change notification settings - Fork 304
REST Support for null column values in request body added #324
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
Conversation
seantleonard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments about breaking out Nullable Tests into their own test methods.
DataGateway.Service/Resolvers/Sql Query Structures/SqlUpsertQueryStructure.cs
Show resolved
Hide resolved
…re/hawaii-gql into dev/agarwalayush/feature-146
Aniruddh25
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting on making function arguments nullable
DataGateway.Service/Resolvers/Sql Query Structures/SqlInsertQueryStructure.cs
Show resolved
Hide resolved
DataGateway.Service/Resolvers/Sql Query Structures/SqlUpsertQueryStructure.cs
Show resolved
Hide resolved
Aniruddh25
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please resolve all comments. If you think you have resolved them, mark them as such - so reviewers can verify and close.
|
We should be careful with using They should be switched to null checks. |
So empty string i.e. "" is a valid value ? I thought its invalid. |
Good point @gledis69, empty or white space are VALID inputs to string columns. |
|
@gledis69 , your concern has been addressed. |
Aniruddh25
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need test cases for empty string
| { | ||
| if (upsertRequestCtx.FieldValuePairsInBody[column.Key] == null || | ||
| string.IsNullOrWhiteSpace(upsertRequestCtx.FieldValuePairsInBody[column.Key].ToString())) | ||
| if (upsertRequestCtx.FieldValuePairsInBody[column.Key] == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a test case for the null or white space field value? If not, could you please add one, if not added already...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do have for null values. Want me to add for white space field value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, white space or empty string please.
Aniruddh25
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after resolving merge conflicts and adding test for empty string.
Why is this change being made?
The code changes are meant to add support for assigning NULL value to columns for REST operations like POST,PUT,PATCH.
What changed?
Added checks which prevent assignment of NULL value to non-nullable columns in different REST operations.2.
Removed the code which used to throw an error whenever a NULL value was assigned to a column in the request body irrespective of whether the column was nullable or not.
How was this validated?
Added positive test cases for INSERT/PUT/PATCH operations having NULL value assigned to the columns that were nullable.
Added negative test cases for INSERT/PUT/PATCH operations having NULL value assigned to the columns that were non-nullable.