Open i-sinister opened 4 years ago
According to OpenApi 3.0 spec "reusable request bodies" are supported. However with latest NSwag (version 13.3.0.0) controllers are not generated correctly - action argument is always of type 'object':
openapi: '3.0.0' paths: /bugs: post: summary: Returns list on NSwagStudio bugs requestBody: $ref: "#/components/requestBodies/NSwagStudioBug" responses: '200': $ref: '#/components/responses/NoContent' components: requestBodies: description: Describes NSwagStudio bug required: true content: application/json: schema: type: string responses: NoContent: description: No content
and here is the generated code generated for action:
[Microsoft.AspNetCore.Mvc.HttpPost, Microsoft.AspNetCore.Mvc.Route("bugs")] public System.Threading.Tasks.Task Bugs([Microsoft.AspNetCore.Mvc.FromBody] object body) { return _implementation.BugsAsync(body); }
Expected: body type should be 'string'.
Seems like a duplicate of https://github.com/RicoSuter/NSwag/issues/2122 However, the problem is not fixed
According to OpenApi 3.0 spec "reusable request bodies" are supported. However with latest NSwag (version 13.3.0.0) controllers are not generated correctly - action argument is always of type 'object':
and here is the generated code generated for action:
Expected: body type should be 'string'.