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

PowershellFormatter can create duplicate operationIds when singularizing is enabled. #2255

Open
andrueastman opened this issue Nov 20, 2024 · 0 comments
Assignees

Comments

@andrueastman
Copy link
Member

Ref at

private static string SingularizeAndDeduplicateOperationId(string operationId)

Related to microsoft/OpenAPI.NET.OData#604

Given
Path 1 as /users/{user-id}/calendars/{calendar-id}/microsoft.graph.getSchedule with operationId as users.user.calendars.calendar.getSchedule
Path 2 as /users/{user-id}/calendar/microsoft.graph.getSchedule with operationId as users.user.calendar.getSchedule

The current PowershellFormatter will result in the generation of duplicate operationIds on slicing as the singularization logic will singularize
Operation Id 1 to user.user.calendar.calendar.getSchedule
Operation Id 2 to user.user.calendar.getSchedule

Then duplicate segments that follow each other will be dropped to have both paths having the same operation id as user.calendar.getSchedule`.

This would be invalid and cause issues with generation in Powershell in the event such a path existed in the same document.

The PowershellFormatter would an update do have some form of deduplication logic to ensure that singuralization looks up existing operationIds to prevent duplicate ids.

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

No branches or pull requests

2 participants