Fix REST behavior for Stored Procedures when methods property is absent in the config file #1548
Conversation
Finding missing types Refactoring some type names Simplifying the GraphQL naming by doing that when building the config, rather than on demand
Added implementation of JsonConverter.Write methods to generate an initial pass on the config file using CLI
Removed some tests that weren't testing the CLI but dependencies (such as CommandLineParser or ILogger)
…them simpler and clearer with the new object structure
Moved logic for Entities defaults to RuntimeEntities rather than deserialiser, as that is a more logical place. We always pass that type around, so we can assume the ctor ran, but we aren't always assuming the deserialiser ran (such as what happens with tests)
…ds-unspecified-scenario
…ds-unspecified-scenario
…ds-unspecified-scenario
Aniruddh25
left a comment
There was a problem hiding this comment.
Thank you for the extensive manual testing, looking forward to more optimal way to have automated test.
…ds-unspecified-scenario
…ied-scenario' of https://github.com/Azure/data-api-builder into dev/shyamsundarj/bugfix-sp-handle-rest-methods-unspecified-scenario
seantleonard
left a comment
There was a problem hiding this comment.
Few questions. Would be worth identifying path forward based on Ani's comment: not using hard coded string config file values. Now that we have the new config system, you can create configs programmatically and in your case, only change the entity under test.
I considered using a) This bug was identified by constructing the config file by hand and not through CLI. Considering the way this particular bug was identified; to have an exact representation of that scenario in the tests - hard coding the config file would be the way to go IMHO. There was scope to remove some duplication by re-using the common parts of the hard coded string across all the scenarios - I have incorporated this. |
Aniruddh25
left a comment
There was a problem hiding this comment.
LGTM, thanks for removing as much duplication as possible, yet preserving to test the bug scenario.
Why make this change?
restobject in an entity, remove the default value for the "method" property #1504methodsfield of therestsection is absent in the config file, POST requests fail.What is this change?
EntityRestOptions:DEFAULT_SUPPORTED_VERBS_FOR_SPis added to represent the default HTTP methods supported for stored proceduresEntityRestOptionsConverter: Logic is modified to always populate the REST Methods as an empty array when absent in the config file. This is because, at this point, the converter cannot be aware of the entity type and hence, cannot populate different default values for tables/views vs stored procedures. The right values are populated later during the deserialization process.RuntimeEntities:ProcessRestDefaultsmethod is modified to populate the right set of supported HTTP methods based on the entity type.TestSPRestDefaultsForManuallyConstructedConfigs: Integration tests for validating the REST API behavior for stored procedures for various scenarios are added.How was this tested?
Manual Tests:
enabledfield: Trueenabledfield : Falsepathelementmethodselementmethodsandpathelement