question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System.IO.Stream generated instead of request object type, for C# client

See original GitHub issue

Change 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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
philmccarthy40commented, Sep 29, 2020

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 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found