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

Fix Cyclic Dependencies in Go #5467

Merged
merged 13 commits into from
Oct 7, 2024
Merged

Fix Cyclic Dependencies in Go #5467

merged 13 commits into from
Oct 7, 2024

Conversation

rkodev
Copy link
Contributor

@rkodev rkodev commented Sep 25, 2024

Resolves #2834

Fixes cyclic dependencies by flattening models affected by cyclic depndecies i.e when a cyclic depedency is detected the affected packages will be flattened and migrated to the rot models package.

For example
models -> submodule1 -> submodule2 -> submodule3 -> submodule2
will be flattened by migrating everything under submodule2 to the root models package

Testing:

  1. Enabled suppressed integrated tests
  2. Added unit tests

@rkodev rkodev changed the title Fix Cyclic Fix Cyclic Dependencies in Go Sep 25, 2024
@rkodev rkodev force-pushed the fix/go-cyclic-dependencies branch from 2c930e1 to a7c858c Compare September 26, 2024 05:56
@rkodev rkodev marked this pull request as ready for review September 26, 2024 06:00
@rkodev rkodev requested a review from a team as a code owner September 26, 2024 06:00
@andrueastman
Copy link
Member

Just checking first,
Aren't the changes proposed for #2834 breaking and proposed for the next major version of Kiota? Or does the approach here avoid breaking existing generations?

@rkodev
Copy link
Contributor Author

rkodev commented Sep 26, 2024

@andrueastman so this will not break the existing code releases as it only flattens the models when it detects a circular reference. The issue was suggesting flattening the entire package but in this case the solution only flattens packages that have a circular reference https://github.com/microsoft/kiota/blob/fix/go-cyclic-dependencies/src/Kiota.Builder/Refiners/GoRefiner.cs#L289

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.

Great initial work!

src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/GoRefiner.cs Show resolved Hide resolved
src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
@rkodev rkodev force-pushed the fix/go-cyclic-dependencies branch from 92b94e5 to 6d02976 Compare October 3, 2024 10:07
src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
baywet
baywet previously approved these changes Oct 4, 2024
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.

Thank you for making the changes!

@rkodev rkodev enabled auto-merge (squash) October 7, 2024 06:49
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.

Just a couple of comments. Otherwise, this looks good to me.

src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Refiners/GoRefiner.cs Outdated Show resolved Hide resolved
Copy link

sonarqubecloud bot commented Oct 7, 2024

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.

👍🏼

@rkodev rkodev merged commit 01710c8 into main Oct 7, 2024
209 checks passed
@rkodev rkodev deleted the fix/go-cyclic-dependencies branch October 7, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

flatten models packages in Go to avoid unsupported circular references
3 participants