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

Rsh/flagged enums for java snippets #1764

Merged
merged 5 commits into from
Oct 3, 2023

Conversation

ramsessanchez
Copy link
Contributor

@ramsessanchez ramsessanchez commented Sep 29, 2023

Flagged Enum support for Java Snippets.

//Previously setting a flagged enum property would be generated as:
setProperty(EnumClass.Enum1, EnumClass.Enum2);
//This fix ensures that flagged enums are handled as sets so we generate the following instead:
setProperty(EnumSet.of(EnumClass.Enum1, EnumClass.Enum2));

Added a isFlagsEnum boolean property to the CodeProperty class in order to aid in generation. This also adds a check in the SnippetCodeGraph class in order to set this boolean in the CodeProperty instance it creates.

Also fixes a bug where sub-namespaces of models would be incorrectly generated on return types. Sub-namespaces need to be fully qualified to disambiguate.

//In the prior snippets return types of models, under the security namespace for example, would be shown as:
security.Alert result = graphClient.something().get();
//The fix ensures that model subnamespaces are fully qualified so now we generate:
com.microsoft.graph.models.security.Alert result = graphClient.something().get();

Latest raptor run shows 94% pass rate:
https://microsoftgraph.visualstudio.com/Graph%20Developer%20Experiences/_build/results?buildId=125851&view=ms.vss-test-web.build-test-results-tab

Microsoft Reviewers: Open in CodeFlow

@ramsessanchez ramsessanchez requested a review from a team as a code owner September 29, 2023 22:32
@sonarcloud
Copy link

sonarcloud bot commented Oct 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

90.7% 90.7% Coverage
0.0% 0.0% Duplication

@ramsessanchez ramsessanchez requested review from andrueastman and a team October 2, 2023 18:11
Copy link
Member

@andrueastman andrueastman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@ramsessanchez ramsessanchez merged commit 26baafa into dev Oct 3, 2023
11 checks passed
@ramsessanchez ramsessanchez deleted the rsh/flaggedEnumsForJavaSnippets branch October 3, 2023 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants