Open kevinoid opened 4 years ago
I just noticed this issue also affects OpenAPI 2 documents. For example:
I also bisected the affected versions and found that --version:3.0.6130
works correctly while--version:3.0.6132
does not.
See also #3464.
Any idea which version to use if I face this error and also https://github.com/Azure/autorest/issues/3492?
I'm also receiving this
I just noticed this issue also affects OpenAPI 2 documents. For example:
OpenAPI 2 example with formData parameters I also bisected the affected versions and found that
--version:3.0.6130
works correctly while--version:3.0.6132
does not.
I faced this same issue with an openapi version 3.0.1 spec. I came across your answer and spot on. Up to 3.0.6130
it works. Anything newer than that including 3.0.6247
creates an error.
Hi, we're also getting the additionalProperties
problem doing autorest --input-file=swagger.json --output-folder=. --typescript --version=3.0.6274
anybody looking at it?
The issue still exists in the latest version:
$ autorest readme.md --go --v3 --verbose
AutoRest code generation utility [cli version: 3.1.5; node: v12.9.0, max-memory: 1024 MB]
...
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\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\Model\RequestBody.cs:line 38
at AutoRest.Modeler.SwaggerModeler.Unwrap(SwaggerParameter swaggerParameter) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 375
at AutoRest.Modeler.OperationBuilder.BuildMethodParameters(Method method) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\OperationBuilder.cs:line 240
at AutoRest.Modeler.OperationBuilder.BuildMethod(HttpMethod httpMethod, String url, String methodName, String methodGroup) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\OperationBuilder.cs:line 86
at AutoRest.Modeler.SwaggerModeler.BuildMethod(HttpMethod httpMethod, String url, String name, Operation operation) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 327
at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 105
at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\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()
Error: Plugin imodeler1 reported failure.
I tried a bunch of different settings and it seems like it occurs when you use a "multipart/form-data" content. The relevant code part that seems to fail is here: https://github.com/Azure/autorest.modeler/blob/master/src/Model/RequestBody.cs#L38
It's strange because AFAICT, schema.Properties
should not be null as the schema definitely contains a Properties member and the call to .Select() should hence succeed... or maybe it cannot parse the properties object in the first place and that's why it's null?
Moving back to an older version - as suggested - is not really a viable workaround for us because that produces a bunch of other errors when generating, so...
Any help?
Relevant parts of api schema:
...
"/api/v{version}/ingest/genericJSON/files": {
"post": {
"tags": [
"OKPluginGenericJSONIngest"
],
"operationId": "Ingest",
"parameters": [
{
"name": "context",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "version",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"required": [
"files"
],
"type": "object",
"properties": {
"files": {
"type": "array",
"items": {
"type": "string",
"format": "binary"
}
}
}
},
"encoding": {
"files": {
"style": "form"
}
}
}
}
},
"responses": {
"200": {
"description": "Success"
}
},
"security": [
{
"oauth2": [
]
}
]
}
},
...
Goid
Good
Attempting to generate code for an OpenAPI 3.0 document with a
multipart/form-data
request body, such as the following:Using the command
autorest --v3 --csharp --input-file=openapi.yaml
, produces an error such as:Thanks, Kevin