RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.69k stars 1.24k forks source link

Unable to generate client using nswag studio - Unexpected character encountered while parsing value #4694

Open xantari opened 8 months ago

xantari commented 8 months ago

Point nswag studio to this URL: https://api.galaxydigital.com/docs/api.yml?v=1.5.0

Full documentation: https://api.galaxydigital.com/docs/

Pick "net60" as runtime. Checkmark "CSharp Client".

Do not click "Create local copy".

Here is sample:

image

Click "Generate Outputs"

You will get this error: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: o. Path '', line 0, position 0.

Runtime: Net60 at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at NJsonSchema.Infrastructure.JsonSchemaSerialization.FromJson[T](String json, IContractResolver contractResolver) at NJsonSchema.Infrastructure.JsonSchemaSerialization.<>c__DisplayClass14_01.<FromJsonAsync>b__0() at NJsonSchema.Infrastructure.JsonSchemaSerialization.FromJsonWithLoaderAsync[T](Func1 loader, SchemaType schemaType, String documentPath, Func2 referenceResolverFactory, IContractResolver contractResolver, CancellationToken cancellationToken) at NSwag.OpenApiDocument.FromJsonAsync(String data, String documentPath, SchemaType expectedSchemaType, Func2 referenceResolverFactory, CancellationToken cancellationToken) in //src/NSwag.Core/OpenApiDocument.cs:line 203 at NSwag.OpenApiDocument.FromUrlAsync(String url, CancellationToken cancellationToken) in //src/NSwag.Core/OpenApiDocument.cs:line 235 at NSwag.Commands.Generation.FromDocumentCommand.RunAsync() in //src/NSwag.Commands/Commands/Generation/FromDocumentCommand.cs:line 62 at NSwag.Commands.Generation.FromDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in //src/NSwag.Commands/Commands/Generation/FromDocumentCommand.cs:line 53 at NSwag.Commands.NSwagDocumentBase.GenerateSwaggerDocumentAsync() in //src/NSwag.Commands/NSwagDocumentBase.cs:line 275 at NSwag.Commands.NSwagDocument.ExecuteAsync() in //src/NSwag.Commands/NSwagDocument.cs:line 81 at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in //src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 85 at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in //src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 32 at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input) at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input) at NSwag.Commands.NSwagCommandProcessor.ProcessAsync(String[] args) in /_/src/NSwag.Commands/NSwagCommandProcessor.cs:line 61