Skip to content

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

@andrueastman

Description

@andrueastman

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions