Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test loading petstore.yaml #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ctaggart
Copy link

I'm getting a NRE when simply trying to load the petstore.yaml.
https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v2.0/yaml/petstore.yaml

Test Name:	AutoRest.Modeler.Tests.SwaggerModelerXmlTests.TestModelOfPetstore
Test FullName:	AutoRest.Modeler.Tests.SwaggerModelerXmlTests.TestModelOfPetstore
Test Source:	C:\Users\taggac\github\autorest.modeler\test\SwaggerModelerXmlTests.cs : line 69
Test Outcome:	Failed
Test Duration:	0:00:00.327

Result StackTrace:	
at AutoRest.Modeler.ObjectBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\taggac\github\autorest.modeler\src\ObjectBuilder.cs:line 49
   at AutoRest.Modeler.ParameterBuilder.ParentBuildServiceType(String serviceTypeName, Boolean required) in C:\Users\taggac\github\autorest.modeler\src\ParameterBuilder.cs:line 98
   at AutoRest.Modeler.ParameterBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\taggac\github\autorest.modeler\src\ParameterBuilder.cs:line 95
   at AutoRest.Modeler.ParameterBuilder.Build() in C:\Users\taggac\github\autorest.modeler\src\ParameterBuilder.cs:line 54
   at AutoRest.Modeler.OperationBuilder.BuildMethodParameters(Method method) in C:\Users\taggac\github\autorest.modeler\src\OperationBuilder.cs:line 291
   at AutoRest.Modeler.OperationBuilder.BuildMethod(HttpMethod httpMethod, String url, String methodName, String methodGroup) in C:\Users\taggac\github\autorest.modeler\src\OperationBuilder.cs:line 100
   at AutoRest.Modeler.SwaggerModeler.BuildMethod(HttpMethod httpMethod, String url, String name, Operation operation) in C:\Users\taggac\github\autorest.modeler\src\SwaggerModeler.cs:line 404
   at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in C:\Users\taggac\github\autorest.modeler\src\SwaggerModeler.cs:line 106
   at AutoRest.Modeler.Tests.SwaggerModelerXmlTests.TestModelOfPetstore() in C:\Users\taggac\github\autorest.modeler\test\SwaggerModelerXmlTests.cs:line 75
Result Message:	System.NullReferenceException : Object reference not set to an instance of an object.

@OzBob
Copy link

OzBob commented Mar 27, 2020

After converting
https://petstore.swagger.io/v2/swagger.json
to OpenAPI 3.0.1

by loading it into https://editor.swagger.io/ then Edit | Convert to Open API 3 - > sending it to https://converter.swagger.io/api/convert

downloading the resultant json and using

Autorest --v3 --input-file=petstore3.json --csharp --output-folder=petstore --namespace=petstore

results in:

   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

Feature Request: add a --debug flag to have line numbers /paths etc. output to console during run of extensions

@OzBob
Copy link

OzBob commented Mar 27, 2020

raised in: Azure/autorest#3464

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants