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

[Dotnet] Fix for imports/usings reserved names replacement #1804

Merged
merged 4 commits into from
Aug 31, 2022

Conversation

andrueastman
Copy link
Member

This PR closes #1799

It resolves compile issues after the introduction of the Microsoft.Graph.IdentityGovernance namespace to the beta metadata.
As the namespace introduces a task navigation property, it results to conflict between the generated namespace name and generated Types.

Changes include: -

  • Fixes an issue where if namespaces are renamed, the corresponding using statements referencing the namespaces were not renamed
  • Adds the ReplaceReservedNamespaceTypeNames function to allow for namespaces to replaced with a different format than models as a namespace Microsoft.Graph.IdentitityGovernance.TaskObject conflict with trying to reference a type called TaskObject as the compiler would not know whether to reference the type or the Namespace.

Generation run - https://dev.azure.com/microsoftgraph/Graph%20Developer%20Experiences/_build/results?buildId=84434&view=results
V1 changes - microsoftgraph/msgraph-sdk-dotnet@e317dda
Beta changes - microsoftgraph/msgraph-beta-sdk-dotnet@0cdc5cb

src/Kiota.Builder/Refiners/CSharpRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/ShellRefiner.cs Outdated Show resolved Hide resolved
Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

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

Thanks for taking this on!

@baywet baywet added Csharp Pull requests that update .net code CLI Work to support generating CLIs with Kiota labels Aug 31, 2022
@sonarcloud
Copy link

sonarcloud bot commented Aug 31, 2022

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 0 Code Smells

80.0% 80.0% Coverage
0.0% 0.0% Duplication

@andrueastman andrueastman merged commit 57ad7e4 into main Aug 31, 2022
@andrueastman andrueastman deleted the namespacesFix branch August 31, 2022 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Work to support generating CLIs with Kiota Csharp Pull requests that update .net code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[dotnet] Imported usings/namespaces are not replaced with reserved names provider
2 participants