Azure / Azure/autorest.powershell

Feature Request : support streams for non-json content payloads

Open
#206 9 comments 0 reactions 0 assignees View on GitHub
feature-request P2
Dominant language
C#
Stars
123
Forks
99
PR merge metrics
No merged PRs in 30d

Description

I have the following openapi.yml:
```yml
openapi: 3.0.1
info:
title: MtRainier
description: Gets whether the mountain is out!
version: 1.0.0
servers:
- url: https://themtn.azurewebsites.net/
paths:
/:
get:
summary: Gets whether the mountain is out!
operationId: MtRainer_invoke
responses:
200:
description: OK
content:
text/html:
schema:
type: string
/api:
get:
summary: Gets whether the mountain is out!
operationId: MtRainer_get
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/MtRainer"
components:
schemas:
MtRainer:
type: object
properties:
result:
type: boolean
image:
type: string
```

Note, the `/` route (ignore the `/api` route).
It returns a:
```
text/html:
schema:
type: string
```

When I generate and run the command, I get an NullRef.:
```
❯❯❯ autorest --input-file=./openapi.yml --powershell

AutoRest code generation utility [version: 3.0.5166; node: v10.15.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core '/Users/tyler/.autorest/@microsoft.azure_autorest-core@3.0.5402/node_modules/@microsoft.azure/autorest-core/dist' (3.0.5402)
Loading AutoRest extension '@microsoft.azure/autorest.powershell' (beta->2.0.347)
Loading AutoRest extension '@microsoft.azure/autorest.remodeler' (beta->2.0.213)
Loading AutoRest extension '@microsoft.azure/autorest.csharp-v2' (beta->2.0.227)
--------------------------------------------------------------------

❯❯❯ cd ./generated/

❯❯❯ ./build-module.ps1 -Run

Creating isolated process...
Cleaning build folders...
Compiling module...
-------------Done-------------
Creating isolated process...

PS /Users/tyler/Code/PowerShell/AutoRest/IsTheMtnOut/generated [MtRainier]> Invoke-InvokeMtRainer

Invoke-InvokeMtRainer : Object reference not set to an instance of an object.
At line:1 char:1
+ Invoke-InvokeMtRainer
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Invoke-InvokeMtRainer], NullReferenceException
+ FullyQualifiedErrorId : Sample.API.Cmdlets.InvokeInvokeMtRainer

PS /Users/tyler/Code/PowerShell/AutoRest/IsTheMtnOut/generated [MtRainier]> $Error[0].Exception.StackTrace

at Sample.API.Cmdlets.InvokeInvokeMtRainer.onOK(HttpResponseMessage responseMessage, Task`1 response) in /Users/tyler/Code/PowerShell/AutoRest/IsTheMtnOut/generated/generated/cmdlets/InvokeInvokeMtRainer.cs:line 269
at Sample.API.MtRainier.MtRainerInvoke_Call(HttpRequestMessage request, Func`3 onOK, IEventListener eventListener, ISendAsync sender) in /Users/tyler/Code/PowerShell/AutoRest/IsTheMtnOut/generated/generated/api/MtRainier.cs:line 146
at Sample.API.MtRainier.MtRainerInvoke_Call(HttpRequestMessage request, Func`3 onOK, IEventListener eventListener, ISendAsync sender) in /Users/tyler/Code/PowerShell/AutoRest/IsTheMtnOut/generated/generated/api/MtRainier.cs:line 161
at Sample.API.MtRainier.MtRainerInvoke(Func`3 onOK, IEventListener eventListener, ISendAsync sender) in /Users/tyler/Code/PowerShell/AutoRest/IsTheMtnOut/generated/generated/api/MtRainier.cs:line 119
at Sample.API.Cmdlets.InvokeInvokeMtRainer.ProcessRecordAsync() in /Users/tyler/Code/PowerShell/AutoRest/IsTheMtnOut/generated/generated/cmdlets/InvokeInvokeMtRainer.cs:line 226
at Sample.API.Cmdlets.InvokeInvokeMtRainer.ProcessRecordAsync() in /Users/tyler/Code/PowerShell/AutoRest/IsTheMtnOut/generated/generated/cmdlets/InvokeInvokeMtRainer.cs:line 232
PS /Users/tyler/Code/PowerShell/AutoRest/IsTheMtnOut/generated [MtRainier]>
```

Side issue... I expected the cmdlet name to be `Invoke-MtRainier` not `Invoke-InvokeMtRainer`...

FWIW, the `Get-MtRainier` cmdlet works with the output type of object.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.