Skip to content
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

Problem with Autorest directives for dynamic argument completion #5070

Open
amirhosseinmirmohammad opened this issue Feb 8, 2025 · 0 comments
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@amirhosseinmirmohammad
Copy link

I’m using Autorest to generate PowerShell cmdlets and I want to implement argument completion for a parameter dynamically using another cmdlet (e.g., Get-BsnOsmCliNSinstance).

I’ve read about using directives in Autorest and tried setting a completer like this in my configuration.yaml:

This is my script :

input-file: osm-openapi.yaml

directive:
  - where:
      verb: Get
      subject: BsnOsmCliNsi
      parameter-name: NetsliceInstanceId
    set:
      completer:
        name: NetsliceInstanceId Completer
        description: Dynamically retrieves NetsliceInstanceIds from Get-BsnOsmCliNSinstance for tab completion.
        script: "(Get-BsnOsmCliNSinstance | ForEach-Object { $_.Id })"``

Or

input-file: osm-openapi.yaml

directive:
  - where:
      verb: Get
      subject: BsnOsmCliNsi
      parameter-name: NetsliceInstanceId
    set:
      completer:
        name: NetsliceInstanceId Completer
        description: Dynamically retrieves NetsliceInstanceIds for tab completion.
        script: "'westus2', 'centralus', 'global'"

My Expectation : Get-BsnOsmCliNsi -NetsliceInstanceId

@amirhosseinmirmohammad amirhosseinmirmohammad added the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Feb 8, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

1 participant