-
Notifications
You must be signed in to change notification settings - Fork 40
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
Azure Core: Enable no-enum
rule by default in all
ruleset
#467
Azure Core: Enable no-enum
rule by default in all
ruleset
#467
Conversation
no-enum
rule by default in all
ruleset
All changed packages have been documented. |
You can try these changes at https://cadlplayground.z22.web.core.windows.net/typespec-azure/prs/467/ Check the website changes at https://tspwebsitepr.z22.web.core.windows.net/typespec-azure/prs/467/ |
@@ -46,6 +47,27 @@ describe("typespec-azure-core: no-enum rule", () => { | |||
.toBeValid(); | |||
}); | |||
|
|||
it("emit warning about other enums in versioned service", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering why we have this warning in azure scope?
Looking at the swagger, there are a lot of cases where "modelAsString": false
in enum extensible and I think they would be taken as fixed.
https://github.com/Azure/azure-rest-api-specs/blob/feature/health-lro/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/preview/2020-10-01-preview/cloudService.json#L1483-L1492
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being an azure scope is the entire point of this linting rule. Actual enums cannot deal with new values being added so azure policy is you shouldn’t use them. There is of course always exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this guideline: https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#enums--sdks-client-libraries, is it from there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
No description provided.