Azure / azure-webjobs-sdk

Azure WebJobs SDK
MIT License
732 stars 356 forks source link

Allow explicit binding a parameter to binding data. #1498

Open MikeStall opened 6 years ago

MikeStall commented 6 years ago

If a parameter does not have a binding attribute, WebJobs will implicitly bind it to binding data. However, that's not available to non-C# languages. Allow explicitly binding to a binding data value.

This can then show up in Function.json and enables several things:

  1. For HTTP, this can allow user functions to skip request parsing and bind directly to structured parameters. Swagger generation can also then use this to generate stronger wrappers.

  2. Allow other languages to get access to binding data. (ie, https://social.msdn.microsoft.com/Forums/en-US/f2cead5e-bcdd-4222-b957-ce836da1b58a/python-azure-function-get-name-of-the-triggered-blob?forum=AzureFunctions )

  3. This can provide direct access to system parameters in the system data (https://github.com/Azure/azure-webjobs-sdk/blob/86cb51ff269bfcab802c061ae8131174f0848f5c/src/Microsoft.Azure.WebJobs.Host/Bindings/SystemBindingData.cs )

MikeStall commented 6 years ago

We already implement this in our tests: https://github.com/Azure/azure-webjobs-sdk/blob/3696dd28df66996b1adcc0697f0d0f88f865cb64/test/Microsoft.Azure.WebJobs.Host.UnitTests/Common/BindingPathAttribute.cs This means making that public.

mathewc commented 6 years ago

Related to https://github.com/Azure/azure-webjobs-sdk-script/issues/1339