Base solution for your next web application
Open Closed

Swagger Issue in ASP.NET Core + Angular 2 #2923


User avatar
0
thobiasxp created

Hi, Good Morning,

When we try to pass input value through swagger for testing the value is always going as 0 to the method. Is it a issue or we need to set something on swagger for sending input value to method??Can you guyss help us...

Thanks


7 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you share the method definition and example swagger input ? We will try to reproduce and understand it.

    Thanks.

  • User Avatar
    0
    thobiasxp created

    Hi, Good Morning,

    When we try to get result for specific data, we are not getting output in swagger. I have attached screenshot, when we retrieve a value from swagger, for example we need all values of id 1 in country module but we are not getting values. When we cross check it, the value going to method(GetCountryForEdit) was always 0. The value from swagger ui input is not going to the method.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you check the request parameters in browser's network tab ? And In the mean time can you try same test with postman ?

    Thanks.

  • User Avatar
    0
    thobiasxp created

    Hi,

    We checked the request parameter for swagger for the respective function but its not sending parameter. (In postman its working since we gave respective parameter value) Can you give solution to solve this issue to check service through swagger. Attached screenshot swagger which is calling method with out parameter.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you share your GetMileStoneForEdit method definition and it's input DTO ?

    Thanks.

  • User Avatar
    0
    thobiasxp created

    Hi, Good Morning,

    We have given nullableIddto. Below was the method

    "public async Task<GetMileStone> GetMileStoneForEdit(NullableIdDto input)"

  • User Avatar
    0
    alirizaadiyahsi created

    Hi,

    It may be a bug with Swashbuckle. We fixed it in latest version. Also, you can fixed it, too, with doing following changes: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/commit/49b9528e479a10fd5b9936cd87e6bb5885e35b87">https://github.com/aspnetzero/aspnet-ze ... 5885e35b87</a>

    Error is about parameter type. In your example, type is "model binding", but it should be "query" type. If you do above changes (or download latest version of aspner-zero-core), it must be work.