microsoft / microsoft/OpenAPI.NET.OData
Enum return value schema is wrong
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 240
- Forks
- 70
- Avg merge
- 7h 59m
- Merged PRs (30d)
- 13
Description
If a function returns Enum resulting schema is not wrapped but instead represented as enum itself.
Assemblies affected
Microsoft.OpenApi.OData 1.7.4
Steps to reproduce
I have a function that returns enum. It goes like this:
<Function Name="GetRemoteAccessStatus" IsBound="true">
<ReturnType Type="RemoteAccessStatus" Nullable="false"/>
</Function>
<EnumType Name="RemoteAccessStatus">
<Member Name="None" Value="0"/>
<Member Name="Requested" Value="1"/>
<Member Name="Active" Value="2"/>
</EnumType>
Expected result
In the resulting schema I want to see something like this:
schema:
type: object
properties:
value:
anyOf:
- $ref: '#/components/schemas/RemoteAccessStatus'
Actual result
Actually I get (skipped value):
schema:
$ref: '#/components/schemas/Pbx.RemoteAccessStatus'
Additional information
I thinks the issue is in OpenApiResponseGenerator.cs where for collection and primitive types it wraps the responses but not for Enum
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in OpenApiResponseGenerator.cs and reproduce the function response using the provided OData CSDL. Compare how collection and primitive return types are wrapped with the enum path, then verify that the generated schema uses an object with a value property referencing RemoteAccessStatus.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100