-
Notifications
You must be signed in to change notification settings - Fork 46
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
[Bug]: typespec-autorest - readonly is wrong added to some enum #2042
Comments
This is due to the requirement for status enums to be read-only for RPaaS validation, behavior is controlled by this setting: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/codesigning/CodeSigning.Management/tspconfig.yaml#L8 Closing as by design |
Hi @markcowl, Are you suggesting that the status enums are not actually read-only and that we include them only to bypass RPaaS validation? Otherwise, we should mark them as read-only in the TypeSpec definition. Is that correct? By the way, since this setting is only applied to the typespec-autorest emitter, it causes inconsistency between SDK/PowerShell modules generated from Swagger and those generated from typespec. |
Not exactly. In cases where this occurs, all references to the enum type are through readOnly properties. If autorest is used, properties are allowed to have I am not sure I understand how this could impact PowerShell commands - if every property referencing the enum is readOnly, how would generation of an enumeration be changed? |
@markcowl Here is how the inconsistency happens. When using autorest.powershell to generate the module from swagger, status will be generated as the read-only property, since RevocationStatus is a read-only enum. While using typespec-autorest to generate the module from typespec, we will generate status as read-write property, since neither the union RevocationStatus nor the property is marked as read-only in typespec. So if I understand correctly, we should add |
Describe the bug
When generating swagger from tsp, the property readonly is wrong added to some enums.
Following is an example.
For union RevocationStatus, we add the readonly property.
But for the unions in the same tsp files like SkuName, we do not add readonly.
Reproduction
An example has been provided above
Checklist
The text was updated successfully, but these errors were encountered: