Azure / Azure/azure-functions-openapi-extension

Interfaces don't inform properties of base interfaces

Open
#544 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
388
Forks
202
PR merge metrics
No merged PRs in 30d

Description

**Describe the issue**
When implementing from another interface, the openapi specification doesn't inform the user of the interfaces base properties.

The following interface `IPersonWithAccess` as shown in the figure below implements `IPersonWithId` which implements `IPersonWithoutId`.
![image](https://user-images.githubusercontent.com/73258913/214011641-b9880892-6eaa-47b7-a0e2-ceb4a39d35e1.png)

When we have the following record class in our project...
```csharp
public record PersonsWithAccessBook
{
public PersonWithAccess BookOwner { get; set; }
public IEnumerable PersonsWithAccess
{
get;
set;
}
}
```

one would expect `IPersonWithAccess` to inform the user in the specification of it's base properties as well. But right now this isn't the case.
![image](https://user-images.githubusercontent.com/73258913/214013573-71666193-d69b-4021-82b7-4e4daa9c8a47.png)

An example repo can be found [here](https://github.com/sinantutan/openapi-extension-interfaces-base-symbols-bug).

**To Reproduce**
Steps to reproduce the behavior:
1. Create two or more interfaces and implement them hierarchically.
2. In another class create a property as a collection of the interface which implements.
3. Create an openapi example class and add it to your openapi function.
4. See error in the swagger ui.

**Expected behavior**
Interfaces inform user of their base properties in the openapi specification.

**Environment:**
- OS: Windows 11 Enterprise (10.0, Build 22621)
- Browser: Microsoft Edge, Version 109.0.1518.55 (Official build) (64-bit)
- Microsoft.Azure.WebJobs.Extensions.OpenApi (1.5.0)
- Microsoft.NET.Sdk.Functions (4.1.3)

Contributor guide

Open the contributing guide

Research direction

Start with the linked example repository and reproduce the issue using the documented interface hierarchy, collection property, and OpenAPI example class. Inspect the generated specification in Swagger UI and compare it with the inherited properties described in the issue. Done means the specification exposes the base properties for hierarchically implemented interfaces.

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.