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

Question about OutputFilePath #413

Closed
ismcagdas opened this issue Nov 10, 2016 · 7 comments
Closed

Question about OutputFilePath #413

ismcagdas opened this issue Nov 10, 2016 · 7 comments
Milestone

Comments

@ismcagdas
Copy link

Hi,

I was trying to run npm package.
I have used *.nswag file to generate angular2 typescript proxies.

When I have an OutputFilePath like this
"OutputFilePath": "..\\src\\shared\\service-proxies\\service-proxies.ts"
I got an error but if I use full path like "D:\.................\service-proxies.ts" it works.

Can we use relative paths for OutputFilePath ? If so, can you share an example ?

Here is the exception message I'm getting.

System.AggregateException: One or more errors occurred. ---> System.UriFormatException: Invalid URI: The format of the URI could not be determined.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at NSwag.CodeGeneration.Utilities.PathUtilities.MakeAbsolutePath(String relativePath, String relativeTo) in C:\Data\NSwag\src\NSwag.AssemblyLoaderCore\Utilities\PathUtilities.cs:line 83
at NSwag.Commands.NSwagDocumentBase.ConvertToAbsolutePaths() in C:\Data\NSwag\src\NSwag.Commands\NSwagDocumentBase.cs:line 250
at NSwag.Commands.NSwagDocumentBase.<>c__DisplayClass59_01.<LoadAsync>b__0() in C:\Data\NSwag\src\NSwag.Commands\NSwagDocumentBase.cs:line 159 at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NSwag.CodeGeneration.Commands.NSwagDocumentCommand.d__0.MoveNext() in C:\Data\NSwag\src\NSwag.AssemblyLoaderCore\Commands\NSwagDocumentCommand.cs:line 23
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NSwag.Commands.NSwagDocumentCommandBase.d__5.MoveNext() in C:\Data\NSwag\src\NSwag.Commands\Commands\NSwagDocumentCommandBase.cs:line 47
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NSwag.Commands.NSwagDocumentCommandBase.d__4.MoveNext() in C:\Data\NSwag\src\NSwag.Commands\Commands\NSwagDocumentCommandBase.cs:line 28
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NConsole.CommandLineProcessor.d__12.MoveNext() in C:\projects\nconsole\src\NConsole\CommandLineProcessor.cs:line 138
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NConsole.CommandLineProcessor.d__11.MoveNext() in C:\projects\nconsole\src\NConsole\CommandLineProcessor.cs:line 107
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at NSwag.Commands.NSwagCommandProcessor.Process(String[] args) in C:\Data\NSwag\src\NSwag.Commands\NSwagCommandProcessor.cs:line 39 ---> (Inner Exception #0) System.UriFormatException: Invalid URI: The format of the URI could not be determined. at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at NSwag.CodeGeneration.Utilities.PathUtilities.MakeAbsolutePath(String relativePath, String relativeTo) in C:\Data\NSwag\src\NSwag.AssemblyLoaderCore\Utilities\PathUtilities.cs:line 83 at NSwag.Commands.NSwagDocumentBase.ConvertToAbsolutePaths() in C:\Data\NSwag\src\NSwag.Commands\NSwagDocumentBase.cs:line 250 at NSwag.Commands.NSwagDocumentBase.<>c__DisplayClass59_01.b__0() in C:\Data\NSwag\src\NSwag.Commands\NSwagDocumentBase.cs:line 159
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NSwag.CodeGeneration.Commands.NSwagDocumentCommand.d__0.MoveNext() in C:\Data\NSwag\src\NSwag.AssemblyLoaderCore\Commands\NSwagDocumentCommand.cs:line 23
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NSwag.Commands.NSwagDocumentCommandBase.d__5.MoveNext() in C:\Data\NSwag\src\NSwag.Commands\Commands\NSwagDocumentCommandBase.cs:line 47
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NSwag.Commands.NSwagDocumentCommandBase.d__4.MoveNext() in C:\Data\NSwag\src\NSwag.Commands\Commands\NSwagDocumentCommandBase.cs:line 28
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NConsole.CommandLineProcessor.d__12.MoveNext() in C:\projects\nconsole\src\NConsole\CommandLineProcessor.cs:line 138
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NConsole.CommandLineProcessor.d__11.MoveNext() in C:\projects\nconsole\src\NConsole\CommandLineProcessor.cs:line 107<---

Thanks a lot.

@RicoSuter
Copy link
Owner

Relative paths are allowed, but must be relative to the nswag file. Is this the case?

@ismcagdas
Copy link
Author

ismcagdas commented Nov 10, 2016

Hi,

Thank you for your response. Yes, it's relative to nswag file.
I'm attaching some screenshots to make it more clear.

This is the error message:
image

These are the locations of nswag file and output file directories.

image

and This is the SwaggerToTypeScriptCommand part of my configuration

"SwaggerToTypeScriptCommand": {
    "ClassName": "{controller}ServiceProxy",
    "ModuleName": "",
    "Namespace": "",
    "Template": "Angular2",
    "PromiseType": "Promise",
    "DateTimeType": "MomentJS",
    "GenerateClientClasses": true,
    "GenerateClientInterfaces": false,
    "GenerateDtoTypes": true,
    "OperationGenerationMode": "MultipleClientsFromPathSegments",
    "GenerateReadOnlyKeywords": true,
    "TypeStyle": "Class",
    "ClassTypes": null,
    "ExtendedClasses": null,
    "ExtensionCode": "service.extensions.ts",
    "GenerateDefaultValues": true,
    "ServiceHost": null,
    "ServiceSchemes": null,
    "OutputFilePath": "..\\src\\shared\\service-proxies\\service-proxies.ts"
  }

@RicoSuter
Copy link
Owner

Can you try nswag run without file name?

@ismcagdas
Copy link
Author

Thanks, It works that way 😊

@RicoSuter
Copy link
Owner

Ok, then you found a bug which i can reproduce.. will be fixed in the next version...

@RicoSuter RicoSuter added this to the vNext milestone Nov 10, 2016
@ismcagdas
Copy link
Author

Thanks for your great work.
We can continue with your solution at the moment.

@RicoSuter
Copy link
Owner

Will be fixed in v7.1

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

No branches or pull requests

2 participants