Azure / Azure/azure-functions-openapi-extension
ObjectTypeVisitor - cast to OpenApiSchemaAcceptor instead of IOpenApiSchemaAcceptor
- Dominant language
- C#
- Stars
- 388
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the issue**
[azure-functions-openapi-extension](https://github.com/Azure/azure-functions-openapi-extension/tree/main)/[src](https://github.com/Azure/azure-functions-openapi-extension/tree/main/src)/[Microsoft.Azure.WebJobs.Extensions.OpenApi.Core](https://github.com/Azure/azure-functions-openapi-extension/tree/main/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core)/[Visitors](https://github.com/Azure/azure-functions-openapi-extension/tree/main/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Visitors)
/ObjectTypeVisitor.cs
Line ~110 ish, there is a line that reads var instance = acceptor as OpenApiSchemaAcceptor;. When testing with a custom
IOpenApiSchemaAcceptor, this was not processing, its because we cast to the concrete implementation type instead of the interface type. This stumped us recently, debugging attribute errors with duplicate keys.
**Expected behavior**
I think this should be var instance = acceptor as IOpenApiSchemaAcceptor
**Screenshots**
If applicable, add screenshots to help explain your issue.

Contributor guide
Research direction
Open src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Visitors/ObjectTypeVisitor.cs around line 110 and inspect how the acceptor is cast and processed. Reproduce or review the custom IOpenApiSchemaAcceptor scenario described in the issue, then verify that interface-based acceptors are processed and the duplicate-key attribute behavior is corrected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100