Repository navigation
Ensure customers do not have to replicate stored proc parameters in the config. - #1847
Conversation
|
Changes look good, but I did not see a negative case to provide test coverage for the cases you mention in the description about validation failing in the config validation tests or in the sp builder tests. Can you double check if we have a test of this, and if not add an issue to track adding if not adding to this PR itself? |
Sean Leonard (seantleonard)
left a comment
There was a problem hiding this comment.
Need tests to validate scenario that you are trying to accommodate.
- If input parameter in db schema has a default value and 1) none is supplied in request 2) no default value defined in runtime config -> what is the expected outcome?
What kind of test do you think could validate your failure case proposal:
The customer does not provide input in the query and there is no backing default in the config. (ideally if there was a default on the db stored proc we should have detected it but it seems very hard for sql). As a workaround, customer can just define that default in the config if they want.
|
Ideally, I think these cases make sense to me:
For doing this, we would need the metadata about whether a param has default value in the SP definition or not. |
…com/Azure/data-api-builder into rohkhann/storedprocdefaultparameter
For doing this, we would need the metadata about whether a param has default value in the SP definition or not. Looks like the problem is SP definition cannot reliably provide us information whether the parameter has a default or not + we dont know what the value would be. |
|
LGTM. Thanks for fixing this! Would be nice if we can have a follow up for checking SP metadata using sys.sql_modules or OBJECT_DEFINITION as the docs suggest for finding if the parameter has default or not. |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Sean Leonard (seantleonard)
left a comment
There was a problem hiding this comment.
Pending response to Abhishek's comment.
|
Azure Pipelines successfully started running 6 pipeline(s). |
Stored procedure today, is trying to validate that number of params in config == number of params in sp definition. this makes it difficult for customer as they have to respecify all the parameters in the sp in the config again. Our validation should only ever fail in two scenarios:
Difficulties in determining whether a stored procedure parameter has default values:
We can try the SQL DOM approach but the focus on this pr is to ensure that irrespective of whether there is or is not a default parameter customers can query their endpoint. If there is no query parameter provided and nothing specified in config we error out (even if for now they have a default defined in the db.)