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

[TypeSpec False Positives] EvenSegmentedPathForPutOperation and XmsPageableForListCalls with @singleton #646

Open
mikeharder opened this issue Jan 18, 2024 · 0 comments
Assignees

Comments

@mikeharder
Copy link
Member

mikeharder commented Jan 18, 2024

The regex used by EvenSegmentedPathForPutOperation requires the last path segment to be wrapped in curly braces:

match: ".*/providers/\\w+.\\w+(/\\w+/{\\w+})+$",

This fails to match the OpenAPI generated by TypeSpec @singletons:

@singleton
model Employee is TrackedResource<EmployeeProperties>

.../providers/Microsoft.ContosoProviderHub/employees/default

But it does match the OpenAPI generated by TypeSpec when not using @singleton:

model Employee is TrackedResource<EmployeeProperties> {

.../providers/Microsoft.ContosoProviderHub/employees/{employeeName}

Should EvenSegmentedPathForPutOperation be adjusted to make optional the curly braces around the last path segment? Or even allow only the string default for TypeSpec singletons?

Rule XmsPageableForListCalls has a similar bug but in the opposite direction. It assumes if a path does not end with }, it must specify x-ms-pageable, which I believe should not apply to the default path generated from TypeSpec @singleton.

given: "$[paths,'x-ms-paths'][?([email protected]('}'))].get",

@mikeharder mikeharder changed the title [TypeSpec False Positive] EvenSegmentedPathForPutOperation fails if last path segment not wrapped in curly braces [TypeSpec False Positives] EvenSegmentedPathForPutOperation and XmsPageableForListCalls with @singleton Jan 18, 2024
@mikeharder mikeharder assigned mikeharder and unassigned mikeharder May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants