From 45004619f8beb016a1f44d32742816f9bfc9c4ef Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Thu, 16 May 2024 11:39:00 -0700 Subject: [PATCH] Create troubleshooting doc on versioning_operation_template_changes.md (#847) --- .../versioning_operation_template_changes.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docs/troubleshoot/versioning_operation_template_changes.md diff --git a/docs/troubleshoot/versioning_operation_template_changes.md b/docs/troubleshoot/versioning_operation_template_changes.md new file mode 100644 index 0000000000..c1f08bc022 --- /dev/null +++ b/docs/troubleshoot/versioning_operation_template_changes.md @@ -0,0 +1,23 @@ +# How can I change the operation template of an operation in newer versions + +## Symtoms + +If you are switching to a different operation template in a new version, you may run into compilation errors if you only leverage `@added` and `@removed` versioning decorators. + +## Workaround + +In the example below, you are switch from an old deprecated operation template to the new one. Note the uses of `@sharedRoute` and `renamedFrom` to avoid name and route conflict errors. + +```typespec + #suppress "deprecated" "back compat" + @removed(Versions.`2024-10-01-preview`) + @sharedRoute + @renamedFrom(Versions.`2024-10-01-preview`, "delete") + deleteOld is ArmResourceDeleteAsync; + + @added(Versions.`2024-10-01-preview`) + @sharedRoute + delete is ArmResourceDeleteWithoutOkAsync; +``` + +**Please note**: In the `delete is ArmResourceDeleteAsync` example above, if you are RPSaaS service, you CAN do a direct replacement with `delete is ArmResourceDeleteWithoutOkAsync`. This is because RPSaaS will never send `200 OK`. Update in-place is just an API spec bug fix.