-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Client generation in NSwagStudio exceptions #2545
Comments
Same problem here. Traced the source of the exception to referencing the same response in multiple places, in your case that's: 400":{"$ref":"#/components/responses/BadRequest"}, |
Do we have a stacktrace or something? |
Stack trace from running NSwagStudio (latest version) with the document provided in the first post: System.InvalidOperationException: Error while rendering Liquid template CSharp/Client.Class: Runtime: Default |
NSwagStudio 13.2.2.0 fails to generate client for following spec: openapi: '3.0.0'
paths:
/bugs:
get:
summary: Returns list on NSwagStudio bugs
responses:
'200':
$ref: '#/components/responses/NSwagStudioBug'
'400':
$ref: '#/components/responses/NSwagStudioBug'
components:
responses:
NSwagStudioBug:
description: List of NSwagStudio bugs
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/NSwagStudioBug'
schemas:
NSwagStudioBug:
description: Describes NSwagStudio bug
type: object
required:
- description
properties:
description:
description: Bug description
type: string
example:
description: https://github.com/RicoSuter/NSwag/issues/2545 Error as in previous comment. The reason is using the same multiple response for different codes. |
I've hit this bug again today (forgot about it) and I can see I already commented.. Is anyone working on it, or can I take a shot at fixing it? |
If there's no open PR, you can assume nobody is working on it. |
Apologies for the late reply. |
When I try to generate a C# .NET Core3 client using the NSwagStudio (13.1.6.0) the following OpenAPI document generates exception
https://leksaker.starweb.se/api/v2/openapi.json
I have imported it into SwaggerHub without any errors.
I have also saved it as Yaml here: http://download.edument.se/openapi.yaml (from swaggerhub and http://online.swagger.io/)
Any hint on how I can debug this?
The exception I get is:
System.InvalidOperationException: Error while rendering Liquid template CSharp/Client.Class:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.InvalidOperationException: Sequence contains more than one matching element
The text was updated successfully, but these errors were encountered: