Skip to content

Enum return value schema is wrong #674

@sherlock1982

Description

@sherlock1982

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions