Azure / Azure/azure-functions-dotnet-worker
GeneratedFunctionMetadataProvider emitting binding data without "dataType" attribute
- Dominant language
- C#
- Stars
- 466
- Forks
- 215
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 7
Description
### Description
GeneratedFunctionMetadataProvider emitting binding data without "dataType" attribute for MultiResponse output binding use case. Note that, this is happening in the non-asp net integration case. (Using HttpResponseData and HttpRequestData)
### Steps to reproduce
Use latest stable packages. I used worker.sdk 1.17.2. Create an HttpTrigger which returns a multi response POCO.
```csharp
[Function("WriteToEventHub")]
public HelloHttpResponse WriteToEventHub([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestData req)
{
var message = $"WI-{Guid.NewGuid().ToString()[..4]}";
var httpResponse = req.CreateResponse(System.Net.HttpStatusCode.OK);
httpResponse.WriteStringAsync($"Message '{message}' written to Event Hub.");
return new HelloHttpResponse
{
HttpResponse = httpResponse,
Message = message
};
}
public sealed class HelloHttpResponse
{
public HttpResponseData HttpResponse { get; set; }
[CosmosDBOutput("my-db", "my-container", Connection = "CosmosConnection", PartitionKey ="/TenantId")]
public string? Message { get; set; }
}
```
Check the generated `GeneratedFunctionMetadataProvider` type. The binding entry for "Message" is missing the `dataType` property.
Below is the JSON generated when using legacy generator. This version includes ` "dataType": "String",`
```json
"bindings": [
{
"name": "req",
"direction": "In",
"type": "httpTrigger",
"authLevel": "Anonymous",
"methods": [
"get",
"post"
],
"properties": {}
},
{
"name": "HttpResponse",
"type": "http",
"direction": "Out"
},
{
"name": "Message",
"direction": "Out",
"type": "cosmosDB",
"dataType": "String",
"databaseName": "my-db",
"containerName": "my-container",
"connection": "CosmosConnection",
"partitionKey": "/TenantId",
"properties": {}
}
]
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the GeneratedFunctionMetadataProvider and trace metadata generation for the supplied HttpTrigger returning a multi-response POCO. Compare its binding output with the legacy-generator JSON shown in the issue, focusing on the Message binding. Done means the generated binding includes the expected dataType value for this non-ASP.NET integration case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100