Azure / azure-functions-openapi-extension

This extension provides an Azure Functions app with Open API capability for better discoverability to consuming parties

Home Page:https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot Generate Open API swagger.json file if inheriting from ITableEntity From Azure.Data.Tables

danielmoerland opened this issue · comments

Describe the issue

We recently have run into an issue where after upgrading our Azure Storage SDK to support managed identity we can no longer generate the swagger.json file. The error we receive is:

Method 'get_ETag' in type '' from assembly ', Version=X, Culture=neutral, PublicKeyToken=null' does not have an implementation.

at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, RuntimeType type, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, RuntimeType type, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder1 derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)
at System.Reflection.RuntimeMethodInfo.GetCustomAttributes(Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Type attributeType, Boolean inherit)
at Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.DocumentHelper.GetOpenApiResponses(MethodInfo element, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version)
at Microsoft.Azure.WebJobs.Extensions.OpenApi.Document.Build(Assembly assembly, OpenApiVersionType version)
at Microsoft.Azure.WebJobs.Extensions.OpenApi.OpenApiTriggerFunctions.RenderSwaggerDocument(OpenApiHttpTriggerContext openApiContext, HttpRequest req, String extension, ExecutionContext ctx, ILogger log)

To Reproduce

  1. Create an Http Trigger
  2. Ensure you are running Azure.Data.Tables version 12.8.1
  3. Have the Request Body Type include a class that inherits from ITableEntity
  4. Attempt to Generate swagger.json file by visiting URL upon building

Expected behavior

We can generate the swagger.json file when using native Microsoft Libraries.

Additional context

I did some initial investigation and this seems related to feature request #327 where we either need to added the allowance of custom visitors or include E_Tag in the core code. For now I've created Tags that exclude the affected endpoints so I can compile the Open API spec. Any additional help would be greatly appreciated.