azure-sdk-for-cpp icon indicating copy to clipboard operation
azure-sdk-for-cpp copied to clipboard

@override issues

Open gearama opened this issue 1 year ago • 0 comments

given the following operation definition : /**

  • Restores a backed up secret, and all its versions, to a vault. This operation
  • requires the secrets/restore permission. / #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Foundations.Operation is necessary for Key Vault" @summary("Restores a backed up secret to a vault.") @route("/secrets/restore") @post op restoreSecret is Azure.Core.Foundations.Operation< { /*
    • The parameters to restore the secret. */ #suppress "deprecated" "Property flattening is supported for legacy scenarios like Key Vault's" @body @flattenProperty parameters: SecretRestoreParameters; }, SecretBundle

;

the generated code is

Azure::Response<KeyVaultSecret> RestoreSecret(std::string const& apiVersion, SecretRestoreParameters const& parameters, Azure::Core::Context const& context = {}) ;

which is as expected

Adding the following defintion to the client.tsp : @override(KeyVault.restoreSecret,"cpp") /**

  • Restores a backed up secret, and all its versions, to a vault. This operation
  • requires the secrets/restore permission. / #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Foundations.Operation is necessary for Key Vault" @summary("Restores a backed up secret to a vault.") @post op restoreSecretCustomized is Azure.Core.Foundations.Operation< { /*
    • The parameters to restore the secret. */ #suppress "deprecated" "Property flattening is supported for legacy scenarios like Key Vault's" @body @flattenProperty parameters: SecretRestoreParameters; }, BackupSecretResult

; the following code gets emitted

Azure::Response<KeyVaultSecret> RestoreSecret(std::string const& apiVersion, SecretRestoreParameters const& parameters, Azure::Core::Context const& context = {}) ;

Azure::Response<KeyVaultSecret> RestoreSecret(std::string const& apiVersion, SecretRestoreParameters const& parameters, Azure::Core::Context const& context = {}) ;

two methods with the same signature

i would expect one with the return type of BackupSecretResult not two with KeyVaultSecret or at least one with the right definition

at least that is my understanding based on https://azure.github.io/typespec-azure/docs/libraries/typespec-client-generator-core/reference/decorators#@Azure.ClientGenerator.Core.override Decorators | TypeSpec Azure Azure.ClientGenerator.Core

gearama avatar Oct 21 '24 22:10 gearama