Azure / autorest

OpenAPI (f.k.a Swagger) Specification code generator. Supports C#, PowerShell, Go, Java, Node.js, TypeScript, Python
MIT License
4.59k stars 731 forks source link

Generic Value cannot be null error message #3187

Closed gldraphael closed 4 years ago

gldraphael commented 5 years ago

Stacktrace:

FATAL: System.ArgumentNullException: Value cannot be null.
Parameter name: source
   at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable1 source, Func2 selector)
   at AutoRest.Modeler.Model.RequestBody.AsParameters() in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\Model\RequestBody.cs:line 38
   at AutoRest.Modeler.Model.Operation.get_Parameters() in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\Model\Operation.cs:line 90
   at AutoRest.Modeler.OperationBuilder.BuildMethodParameters(Method method) in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\OperationBuilder.cs:line 253
   at AutoRest.Modeler.OperationBuilder.BuildMethod(HttpMethod httpMethod, String url, String methodName, String methodGroup) in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\OperationBuilder.cs:line 100
   at AutoRest.Modeler.SwaggerModeler.BuildMethod(HttpMethod httpMethod, String url, String name, Operation operation) in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\SwaggerModeler.cs:line 366
   at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\SwaggerModeler.cs:line 105
   at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\Program.cs:line 60
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NewPlugin.<Process>d__15.MoveNext()
FATAL: python/imodeler1 - FAILED
FATAL: Error: Plugin imodeler1 reported failure.
Process() cancelled due to exception : Plugin imodeler1 reported failure.
  Error: Plugin imodeler1 reported failure.

vi.yaml

--- 
input-file: 
  - vi-swagger.json

namespace: Amplily.AI.VideoIndexer
title: Azure Video Indexer

python:
  output-folder: generated

vi-swagger.json

  1. Download it from here: https://api-portal.videoindexer.ai/docs/services/operations/export?DocumentFormat=Swagger
  2. Delete line 9.

Run autorest vi.yaml to see the above stacktrace.


$ autorest --info
AutoRest code generation utility [version: 2.0.4283; node: v8.11.4]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest

Showing All Installed Extensions

 Type       Extension Name                           Version      Location
 core       @microsoft.azure/autorest-core           2.0.4280     /Users/gldraphael/.autorest/@microsoft.azure_autorest-core@2.0.4280
 core       @microsoft.azure/autorest-core           2.0.4302     /Users/gldraphael/.autorest/@microsoft.azure_autorest-core@2.0.4302
 extension  @microsoft.azure/autorest.csharp         2.3.82       /Users/gldraphael/.autorest/@microsoft.azure_autorest.csharp@2.3.82
 extension  @microsoft.azure/autorest.modeler        2.3.44       /Users/gldraphael/.autorest/@microsoft.azure_autorest.modeler@2.3.44
 extension  @microsoft.azure/autorest.modeler        2.3.55       /Users/gldraphael/.autorest/@microsoft.azure_autorest.modeler@2.3.55
 extension  @microsoft.azure/autorest.python         2.1.40       /Users/gldraphael/.autorest/@microsoft.azure_autorest.python@2.1.40
fearthecowboy commented 4 years ago

I haven't tested this, but I think that it doesn't like

 {
            "name": "body",
            "in": "formData",
            "description": "Format - binary. If a video URL is not specified, the file should be passed as a multipart/form body content.",
            "type": "file"
          }

there is no type file in json schema.

We're writing new generators; and we're not going to go back and update the existing ones at this point.