[Regression] Modeler ArgumentNullException with request body parameters
See original GitHub issueAttempting to generate code for an OpenAPI 3.0 document with a multipart/form-data
request body, such as the following:
openapi: '3.0.3'
info:
title: OpenAPI 3 example with multipart/form-data request body
version: '1.0.0'
components:
schemas:
ExampleFormDataBody:
type: object
properties:
prop1:
type: string
prop2:
type: string
paths:
/post-example:
post:
operationId: postExample
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/ExampleFormDataBody'
responses:
'201':
description: Success
Using the command autorest --v3 --csharp --input-file=openapi.yaml
, produces an error such as:
AutoRest code generation utility [cli version: 3.0.6187; node: v10.17.0, max-memory: 8192 gb]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core '/home/kevin/.autorest/@autorest_core@3.0.6246/node_modules/@autorest/core/dist' (3.0.6246)
Loading AutoRest extension '@microsoft.azure/autorest.csharp' (~2.3.79->2.3.84)
Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.55->2.3.55)
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 /opt/vsts/work/1/s/src/Model/RequestBody.cs:line 38
at AutoRest.Modeler.SwaggerModeler.Unwrap(SwaggerParameter swaggerParameter) in /opt/vsts/work/1/s/src/SwaggerModeler.cs:line 452
at AutoRest.Modeler.OperationBuilder.BuildMethodParameters(Method method) in /opt/vsts/work/1/s/src/OperationBuilder.cs:line 255
at AutoRest.Modeler.OperationBuilder.BuildMethod(HttpMethod httpMethod, String url, String methodName, String methodGroup) in /opt/vsts/work/1/s/src/OperationBuilder.cs:line 100
at AutoRest.Modeler.SwaggerModeler.BuildMethod(HttpMethod httpMethod, String url, String name, Operation operation) in /opt/vsts/work/1/s/src/SwaggerModeler.cs:line 404
at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in /opt/vsts/work/1/s/src/SwaggerModeler.cs:line 106
at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in /opt/vsts/work/1/s/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.
Thanks, Kevin
Issue Analytics
- State:
- Created 4 years ago
- Reactions:16
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Value cannot be null. (Parameter 'key'). What do I wrong ...
Does somebody know, what I am doing wrong? System.ArgumentNullException: Value cannot be null. (Parameter 'key') at System.Collections.Generic.
Read more >Logging the model data from the POST request body
Hi,. My requirement is to log the model data that I am receiving from a POST request. but when I am tring to...
Read more >Dials, Tune, and Parsnip: Tidymodels' Way to Create and ...
In this post, I present three ways to tune parameters with tidymodels and provide example codes. Most examples of tidymodels I have seen...
Read more >Accepting Raw Request Body Content in ASP.NET Core API ...
Make sure you add [FromBody] to any parameter that tries to read data from the POST body and maps it. It's easy to...
Read more >Exactly how many parameters are in multiple linear regression ...
I've read some resources such as my Introductory Econometrics textbook that state the model parameters are B0, B1, ..., Bp where p is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.Hi, we’re also getting the
additionalProperties
problem doingautorest --input-file=swagger.json --output-folder=. --typescript --version=3.0.6274
anybody looking at it?