You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
Here's another example. Perhaps consider allowing the word current as singleton as well: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.HybridCompute/networkConfigurations/current
The regex used by
EvenSegmentedPathForPutOperation
requires the last path segment to be wrapped in curly braces:azure-openapi-validator/packages/rulesets/src/spectral/az-arm.ts
Line 556 in 2873e67
This fails to match the OpenAPI generated by TypeSpec
@singletons
:But it does match the OpenAPI generated by TypeSpec when not using
@singleton
:Should
EvenSegmentedPathForPutOperation
be adjusted to make optional the curly braces around the last path segment? Or even allow only the stringdefault
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 specifyx-ms-pageable
, which I believe should not apply to thedefault
path generated from TypeSpec@singleton
.azure-openapi-validator/packages/rulesets/src/spectral/az-arm.ts
Line 385 in 2873e67
The text was updated successfully, but these errors were encountered: