Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for enum flags #258

Closed
andrueastman opened this issue Jul 21, 2022 · 3 comments · Fixed by #417
Closed

Support for enum flags #258

andrueastman opened this issue Jul 21, 2022 · 3 comments · Fixed by #417
Assignees
Labels
status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close

Comments

@andrueastman
Copy link
Member

andrueastman commented Jul 21, 2022

Taking a look at the metadata for the SourceType enum in the graph metadata, there exists the IsFlags property which is set to true.

      <EnumType Name="sourceType" IsFlags="true">
        <Member Name="mailbox" Value="1" />
        <Member Name="site" Value="2" />
      </EnumType>

The flags attribute is not propagated to the converted openApi description in any way at the moment and also information on the values is also lost in the conversion process.

    microsoft.graph.security.sourceType:
      title: sourceType
      enum:
        - mailbox
        - site
        - unknownFutureValue
      type: string

This poses a challenge to Kiota at the moment as there is no signal for the generator to generate an appropriate Flag property.

Notes

Related to microsoftgraph/msgraph-beta-sdk-dotnet#496

cc @baywet @darrelmiller

@baywet
Copy link
Member

baywet commented Jul 22, 2022

We're using the x-ms-enum extension when Aliasing the code symbol and the serialized value.
It'd be great if we could pr their specification to add the information there instead of coming up with our own.
Also we should check whether oai 3.1 or Json schema has something to support that notion which arguably is very dotnetty.

@darrelmiller
Copy link
Member

darrelmiller commented Aug 18, 2022

I think doing a PR to the x-ms-enum would be the right thing. If we add "isFlagEnum" and set the modelAsString to true then that would cover all cases.

@andrueastman Could you create a PR for this change? You could reach out to Mike Kistler to help you get eyes on the issue.

@darrelmiller darrelmiller self-assigned this Aug 18, 2022
@irvinesunday irvinesunday added the status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close label Mar 29, 2023
@irvinesunday irvinesunday added this to the OData: Blocked milestone Mar 29, 2023
@moh-hassan
Copy link

Is there any Update to this issue.
Adding x-ms-enum extension is enough as described in AutoRest.
I set the property AddEnumDescriptionExtension=true in the setting , but it has no effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants