OpenAPI.NET.OData icon indicating copy to clipboard operation
OpenAPI.NET.OData copied to clipboard

Enum return value schema is wrong

Open sherlock1982 opened this issue 1 year ago • 0 comments

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

sherlock1982 avatar Mar 21 '25 12:03 sherlock1982