How to access OpenApiConfigurationOptions from within the TypeVisitors
For #451 , I want to be able to access the OpenApiConfigurationOptions from within the TypeVisitors. What's the best way to do that? The only way forward I can currently see is to rewire the Activator.CreateInstance calls: https://github.com/Azure/azure-functions-openapi-extension/blob/982ad226abd7f744c424a366fb93bb05d17edba6/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Visitors/VisitorCollection.cs#L53
to pass OpenApiConfigurationOptions as a constructor param.
Should I just do that?
There are two places you need to inject the IOpenApiConfigurationOptions:
https://github.com/Azure/azure-functions-openapi-extension/blob/4e81588f399f642236e354f00f64de99dccb859a/src/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/OpenApiHttpTriggerContext.cs#L173-L178
https://github.com/Azure/azure-functions-openapi-extension/blob/4e81588f399f642236e354f00f64de99dccb859a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi/OpenApiHttpTriggerContext.cs#L172-L177
The IOpenApiConfigurationOptions instance already exists as a private field in there.
However, there are two other places as well:
https://github.com/Azure/azure-functions-openapi-extension/blob/4e81588f399f642236e354f00f64de99dccb859a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/OpenApiParameterAttributeExtensions.cs#L37-L40
https://github.com/Azure/azure-functions-openapi-extension/blob/4e81588f399f642236e354f00f64de99dccb859a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/OpenApiPayloadAttributeExtensions.cs#L37-L40
The first two xxxContext instances look fine, but the latter two looks complicated. Can we do this for v2.0.0 release, rather than the current v1.x release?