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

NSwagStudio Exception while creating API Allegro.pl #1030

Open
frankii91 opened this issue Jul 16, 2019 · 2 comments
Open

NSwagStudio Exception while creating API Allegro.pl #1030

frankii91 opened this issue Jul 16, 2019 · 2 comments

Comments

@frankii91
Copy link

I am "thin" in these blocks and prose for help because there is some mistake ...

file
https://developer.allegro.pl/swagger.yaml

It gives mistakes as below

NSwagStudio v13.0.4.0
"
System.InvalidOperationException: Error while rendering Liquid template CSharp/Class:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Sequence contains more than one matching element

Runtime: NetCore21
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func2 predicate)
at NJsonSchema.CodeGeneration.Models.ClassTemplateModelBase.DerivedClassModel..ctor(String typeName, JsonSchema schema, OpenApiDiscriminator discriminator, TypeResolverBase resolver)
at NJsonSchema.CodeGeneration.Models.ClassTemplateModelBase.<get_DerivedClasses>b__13_0(KeyValuePair2 p) at System.Linq.Enumerable.SelectEnumerableIterator2.ToList()
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) --- End of inner exception stack trace --- at DotLiquid.Context.HandleError(Exception ex) at DotLiquid.Block.RenderAll(List1 list, Context context, TextWriter result)
at DotLiquid.Document.Render(Context context, TextWriter result)
at DotLiquid.Template.RenderInternal(TextWriter result, RenderParameters parameters)
at DotLiquid.Template.Render(TextWriter writer, RenderParameters parameters)
at DotLiquid.Template.Render(RenderParameters parameters)
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render() ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func2 predicate)
at NJsonSchema.CodeGeneration.Models.ClassTemplateModelBase.DerivedClassModel..ctor(String typeName, JsonSchema schema, OpenApiDiscriminator discriminator, TypeResolverBase resolver)
at NJsonSchema.CodeGeneration.Models.ClassTemplateModelBase.<get_DerivedClasses>b__13_0(KeyValuePair2 p) at System.Linq.Enumerable.SelectEnumerableIterator2.ToList()
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) --- End of inner exception stack trace --- at DotLiquid.Context.HandleError(Exception ex) at DotLiquid.Block.RenderAll(List1 list, Context context, TextWriter result)
at DotLiquid.Document.Render(Context context, TextWriter result)
at DotLiquid.Template.RenderInternal(TextWriter result, RenderParameters parameters)
at DotLiquid.Template.Render(TextWriter writer, RenderParameters parameters)
at DotLiquid.Template.Render(RenderParameters parameters)
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render()
--- End of inner exception stack trace ---
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render()
at NJsonSchema.CodeGeneration.CSharp.CSharpGenerator.GenerateClass(JsonSchema schema, String typeName)
at NJsonSchema.CodeGeneration.GeneratorBase.GenerateTypes()
at NJsonSchema.CodeGeneration.CSharp.CSharpGenerator.GenerateTypes()
at NSwag.CodeGeneration.ClientGeneratorBase`3.GenerateFile(ClientGeneratorOutputType outputType) in C:\projects\nswag\src\NSwag.CodeGeneration\ClientGeneratorBase.cs:line 75
at NSwag.Commands.CodeGeneration.SwaggerToCSharpClientCommand.b__83_0() in C:\projects\nswag\src\NSwag.Commands\Commands\CodeGeneration\OpenApiToCSharpClientCommand.cs:line 242
at NSwag.Commands.CodeGeneration.SwaggerToCSharpClientCommand.RunAsync() in C:\projects\nswag\src\NSwag.Commands\Commands\CodeGeneration\OpenApiToCSharpClientCommand.cs:line 228
at NSwag.Commands.CodeGeneration.SwaggerToCSharpClientCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in C:\projects\nswag\src\NSwag.Commands\Commands\CodeGeneration\OpenApiToCSharpClientCommand.cs:line 217
at NSwag.Commands.NSwagDocument.ExecuteAsync() in C:\projects\nswag\src\NSwag.Commands\NSwagDocument.cs:line 85
at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in C:\projects\nswag\src\NSwag.Commands\Commands\Document\ExecuteDocumentCommand.cs:line 85
at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in C:\projects\nswag\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 NConsole.CommandLineProcessor.Process(String[] args, Object input)
at NSwag.Commands.NSwagCommandProcessor.Process(String[] args) in C:\projects\nswag\src\NSwag.Commands\NSwagCommandProcessor.cs:line 56
"

@frankii91 frankii91 changed the title Problem c# NSwagStudio Exception while creating API Allegro.pl Jul 16, 2019
@RicoSuter
Copy link
Owner

Looks like a special case with oneOf/allOf/inheritance...

@RicoSuter RicoSuter transferred this issue from RicoSuter/NSwag Jul 17, 2019
@RicoSuter
Copy link
Owner

Moved to NJsonSchema - we need to repro this directly in NJS with a unit test.

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