Azure / autorest.powershell

AutoRest PowerShell Generator
MIT License
113 stars 86 forks source link

Feature request: support setting of arbitrary request headers on generated cmdlets #1005

Open maisarissi opened 2 years ago

maisarissi commented 2 years ago

The current AutoREST design requires the supported headers to be explicitly declared in the OpenAPI document as header parameters - https://swagger.io/docs/specification/describing-parameters/#header-parameters.

Some APIs such as https://docs.microsoft.com/en-us/graph/api/plannertaskdetails-update?view=graph-rest-1.0&tabs=http#request-headers require the caller to set a request header. Currently, there is no option for one to set request headers to the generated PS cmdlets when making a call.

peombwa commented 1 year ago

AutoREST should also provide support for arbitrary query parameters. i.e.,

$QueryParameter = @{"sortBy" =  "createdDate"}
Get-User -QueryParameter @($QueryParameter)
darrelmiller commented 1 year ago

If the support for the header is not declared in the API description then runtime API calling tools will never know that it is possible. e.g. Copilots. Therefore, we should always have supported headers described. Allowing arbitrary headers is workaround that will prevent us from getting complete API descriptons.