Azure / Azure/azure-functions-openapi-extension

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

Open
#633 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
388
Forks
202
PR merge metrics
No merged PRs in 30d

Description

**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(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 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.

Contributor guide

Open the contributing guide

Research direction

Reproduce with Azure.Data.Tables 12.8.1 using an Http Trigger whose request body includes a class implementing ITableEntity, then generate swagger.json. Start at DocumentHelper.GetOpenApiResponses and follow the calls through Document.Build and RenderSwaggerDocument. Done means the swagger document generates without the get_ETag reflection error while preserving the affected endpoint schemas.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, openapi
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.