System.IO.Stream generated instead of request object type, for C# client
See original GitHub issueChange in behaviour noticed between NSwagStudio 13.2.0 and 13.2.2.
With a swagger 2.0 yaml spec with this path definition:
paths:
'/my-path':
post:
tags:
- My Path
description: >-
My web api path
operationId: SomeOperation
parameters:
- $ref: '#/parameters/AuthorizationParam'
- $ref: '#/parameters/x-nlp-interaction-id-Param'
- in: body
name: MyRequestDTOBody
description: Input data
required: true
schema:
$ref: '#/definitions/MyRequestDTO'
responses:
'200':
$ref: '#/responses/200Woohoo'
an IClient is generated with “System.IO.Stream” type parameter instead of MyRequestDTO. eg
System.Threading.Tasks.Task<WoohooResponse> SomeOperationAsync(string authorization, string x_nlp_interaction_id, System.IO.Stream myRequestDTOBody);
myRequestDTOBody should have type MyRequestDTO.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Cannot send file content to an API with Post method code ...
System.Net.Http.HttpRequestException: 'Error while copying content to a stream.' IOException: Unable to write data to the transport connection: ...
Read more >[C#] csharp client support for 'string/binary' · Issue #1381
A type of System.IO.Stream is not supported here; the AddParameter method attempts to serialize the Stream object itself instead of the stream's ...
Read more >Stream Class (System.IO)
Stream is the abstract base class of all streams. A stream is an abstraction of a sequence of bytes, such as a file,...
Read more >BufferedStream Class (System.IO)
Asynchronously reads the bytes from the current buffered stream and writes them to another stream, using a specified buffer size and cancellation token....
Read more >Advanced Usage — Requests 2.31.0 documentation
This document covers some of Requests more advanced features. Session Objects¶. The Session object allows you to persist certain parameters across requests. It ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve regenerated the test case using NSwagStudio 13.8.1; visually comparing the generated C# outputs, I can confirm the issue has been fixed. Many thanks @RicoSuter 👍
Hmm, is it a regression of one of these?
https://github.com/RicoSuter/NSwag/commit/4fbc0ccf65750f6e5d36abb0218da0862b6b96c7 https://github.com/RicoSuter/NSwag/pull/2633/files