question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autorest change the input filepath and does not found it

See original GitHub issue

This is something weird:

mono AutoRest.exe -i /git-restapi/arm-datafactory/2015-10-01/swagger/service.json -o /tmp/tmpyx24_nun/service.json -AddCredentials True -CodeGenerator Azure.Python -Header MICROSOFT_MIT_NO_VERSION -Namespace azure.mgmt.datafactory -PackageVersion 0.1.0 -ft 2

leads to:

FATAL: Error generating client model: System.Net.WebException: Could not find file "/git-restapi/arm-datafactory/2015-10-01/service.json". ---> System.Net.WebException: Could not find file "/git-restapi/arm-datafactory/2015-10-01/service.json". ---> System.IO.FileNotFoundException: Could not find file "/git-restapi/arm-datafactory/2015-10-01/service.json".
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0021a] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean useAsync) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.Net.FileWebStream..ctor (System.Net.FileWebRequest request, System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare sharing, System.Int32 length, System.Boolean async) [0x00000] in <59be416de143456b88b9988284f43350>:0
  at (wrapper remoting-invoke-with-check) System.Net.FileWebStream:.ctor (System.Net.FileWebRequest,string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,bool)
  at System.Net.FileWebResponse..ctor (System.Net.FileWebRequest request, System.Uri uri, System.IO.FileAccess access, System.Boolean asyncHint) [0x0002c] in <59be416de143456b88b9988284f43350>:0
   --- End of inner exception stack trace ---
  at System.Net.FileWebResponse..ctor (System.Net.FileWebRequest request, System.Uri uri, System.IO.FileAccess access, System.Boolean asyncHint) [0x000af] in <59be416de143456b88b9988284f43350>:0
  at (wrapper remoting-invoke-with-check) System.Net.FileWebResponse:.ctor (System.Net.FileWebRequest,System.Uri,System.IO.FileAccess,bool)
  at System.Net.FileWebRequest.GetResponseCallback (System.Object state) [0x00088] in <59be416de143456b88b9988284f43350>:0
   --- End of inner exception stack trace ---
  at System.Net.WebClient.DownloadDataInternal (System.Uri address, System.Net.WebRequest& request) [0x0008a] in <59be416de143456b88b9988284f43350>:0
  at System.Net.WebClient.DownloadString (System.Uri address) [0x00027] in <59be416de143456b88b9988284f43350>:0
  at System.Net.WebClient.DownloadString (System.String address) [0x00019] in <59be416de143456b88b9988284f43350>:0
  at (wrapper remoting-invoke-with-check) System.Net.WebClient:DownloadString (string)
  at AutoRest.Core.Utilities.FileSystem.ReadFileAsText (System.String path) [0x00029] in <6d767340bc1f4e7e8792a78912a0b187>:0
  at AutoRest.Swagger.SwaggerParser.EnsureCompleteDefinitionIsPresent (System.Collections.Generic.HashSet`1[T] visitedEntities, System.Collections.Generic.Dictionary`2[TKey,TValue] externalFiles, System.String currentFilePath, System.String entityType, System.String modelName, Newtonsoft.Json.Linq.JToken externalDoc) [0x0010f] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerParser.EnsureCompleteDefinitionIsPresent (System.Collections.Generic.HashSet`1[T] visitedEntities, System.Collections.Generic.Dictionary`2[TKey,TValue] externalFiles, System.String currentFilePath, System.String entityType, System.String modelName, Newtonsoft.Json.Linq.JToken externalDoc) [0x001d8] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerParser.EnsureCompleteDefinitionIsPresent (System.Collections.Generic.HashSet`1[T] visitedEntities, System.Collections.Generic.Dictionary`2[TKey,TValue] externalFiles, System.String currentFilePath, System.String entityType, System.String modelName, Newtonsoft.Json.Linq.JToken externalDoc) [0x001b4] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerParser.ResolveExternalReferencesInJson (System.String path, System.String swaggerDocument) [0x0001a] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerParser.Normalize (System.String path, System.String swaggerDocument) [0x00034] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerParser.Parse (System.String path, System.String swaggerDocument) [0x00000] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerParser.Load (System.String path, AutoRest.Core.Utilities.IFileSystem fileSystem) [0x00016] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerModeler.Build () [0x0004f] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Core.AutoRestController.Generate () [0x00073] in <6d767340bc1f4e7e8792a78912a0b187>:0
ERROR: Error generating client model: System.Net.WebException: Could not find file "/git-restapi/arm-datafactory/2015-10-01/service.json". ---> System.Net.WebException: Could not find file "/git-restapi/arm-datafactory/2015-10-01/service.json". ---> System.IO.FileNotFoundException: Could not find file "/git-restapi/arm-datafactory/2015-10-01/service.json".
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0021a] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean useAsync) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.Net.FileWebStream..ctor (System.Net.FileWebRequest request, System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare sharing, System.Int32 length, System.Boolean async) [0x00000] in <59be416de143456b88b9988284f43350>:0
  at (wrapper remoting-invoke-with-check) System.Net.FileWebStream:.ctor (System.Net.FileWebRequest,string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,bool)
  at System.Net.FileWebResponse..ctor (System.Net.FileWebRequest request, System.Uri uri, System.IO.FileAccess access, System.Boolean asyncHint) [0x0002c] in <59be416de143456b88b9988284f43350>:0
   --- End of inner exception stack trace ---
  at System.Net.FileWebResponse..ctor (System.Net.FileWebRequest request, System.Uri uri, System.IO.FileAccess access, System.Boolean asyncHint) [0x000af] in <59be416de143456b88b9988284f43350>:0
  at (wrapper remoting-invoke-with-check) System.Net.FileWebResponse:.ctor (System.Net.FileWebRequest,System.Uri,System.IO.FileAccess,bool)
  at System.Net.FileWebRequest.GetResponseCallback (System.Object state) [0x00088] in <59be416de143456b88b9988284f43350>:0
   --- End of inner exception stack trace ---
  at System.Net.WebClient.DownloadDataInternal (System.Uri address, System.Net.WebRequest& request) [0x0008a] in <59be416de143456b88b9988284f43350>:0
  at System.Net.WebClient.DownloadString (System.Uri address) [0x00027] in <59be416de143456b88b9988284f43350>:0
  at System.Net.WebClient.DownloadString (System.String address) [0x00019] in <59be416de143456b88b9988284f43350>:0
  at (wrapper remoting-invoke-with-check) System.Net.WebClient:DownloadString (string)
  at AutoRest.Core.Utilities.FileSystem.ReadFileAsText (System.String path) [0x00029] in <6d767340bc1f4e7e8792a78912a0b187>:0
  at AutoRest.Swagger.SwaggerParser.EnsureCompleteDefinitionIsPresent (System.Collections.Generic.HashSet`1[T] visitedEntities, System.Collections.Generic.Dictionary`2[TKey,TValue] externalFiles, System.String currentFilePath, System.String entityType, System.String modelName, Newtonsoft.Json.Linq.JToken externalDoc) [0x0010f] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerParser.EnsureCompleteDefinitionIsPresent (System.Collections.Generic.HashSet`1[T] visitedEntities, System.Collections.Generic.Dictionary`2[TKey,TValue] externalFiles, System.String currentFilePath, System.String entityType, System.String modelName, Newtonsoft.Json.Linq.JToken externalDoc) [0x001d8] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerParser.EnsureCompleteDefinitionIsPresent (System.Collections.Generic.HashSet`1[T] visitedEntities, System.Collections.Generic.Dictionary`2[TKey,TValue] externalFiles, System.String currentFilePath, System.String entityType, System.String modelName, Newtonsoft.Json.Linq.JToken externalDoc) [0x001b4] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerParser.ResolveExternalReferencesInJson (System.String path, System.String swaggerDocument) [0x0001a] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerParser.Normalize (System.String path, System.String swaggerDocument) [0x00034] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerParser.Parse (System.String path, System.String swaggerDocument) [0x00000] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerParser.Load (System.String path, AutoRest.Core.Utilities.IFileSystem fileSystem) [0x00016] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Swagger.SwaggerModeler.Build () [0x0004f] in <c0f21d1d16684152926e8aa58c112d50>:0
  at AutoRest.Core.AutoRestController.Generate () [0x00073] in <6d767340bc1f4e7e8792a78912a0b187>:0

You can see that /git-restapi/arm-datafactory/2015-10-01/service.json is not the filename I used as input. A parsing issue on Ubuntu?

This is from this file: https://github.com/Azure/azure-rest-api-specs-pr/tree/master/arm-datafactory/2015-10-01/swagger

Autorest 20170131

@fearthecowboy ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
olydiscommented, Mar 8, 2017

@lmazuel think this got fixed – shout if not! 😃

1reaction
amarzaverycommented, Feb 13, 2017

Looking at it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AutoRest Command Line Interface Documentation
AutoRest will use a configuration file to control the code generation process. By default, AutoRest will look for a file called readme.md or...
Read more >
Verilog-Mode Help - Veripool
Module names must be resolvable to filenames by adding a verilog-library-extensions , and being found in the same directory, or by changing the...
Read more >
How to use AutoRest with RDP - Refinitiv Developer Community
This article demonstrates how to use AutoRest to generate client libraries for RDP services. AutoRest Overview. AutoRest is an OpenAPI (Swagger) specification ...
Read more >
Fix Autorest Problems when Generating Client ... - Angela Evans
Note: This post aims to list the required changes to generate clients with autorest – for other client generators this may differ.
Read more >
Autorest C# client generation not respecting input/output types
NET 6 Web API project using Autorest, but my generated client doesn't seem to care about my request and response data types. My...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found