GithubHelp home page GithubHelp logo

[Bug]: FromRoute parameter only binds directly on method signature, not when nested in request record about swashbuckle.aspnetcore HOT 11 CLOSED

RasmusEdvardsen avatar RasmusEdvardsen commented on July 17, 2024
[Bug]: FromRoute parameter only binds directly on method signature, not when nested in request record

from swashbuckle.aspnetcore.

Comments (11)

RasmusEdvardsen avatar RasmusEdvardsen commented on July 17, 2024

On further examination, this actually works if the [FromRoute] decorator within the request record has a Name attribute specified, like so:

[FromRoute(Name = "id")]

I was under the impression that this would be inferred somehow - or is this indeed the intended behavior?

from swashbuckle.aspnetcore.

jgarciadelanoceda avatar jgarciadelanoceda commented on July 17, 2024

@RasmusEdvardsen. The issue that you are describing here should be fixed just by adding [FromRoute] on the object property.
But if you do that, you have to specify the Route in the controller as Id instead of id( It's case sensitive).

Do you want it to be case insensitive?

from swashbuckle.aspnetcore.

RasmusEdvardsen avatar RasmusEdvardsen commented on July 17, 2024

@jgarciadelanoceda Ah I see, that might be what I'm referring to in my latest comment. If you ask me my personal preference, I'd just want it to work the same way it does as if it was specified directly on the controller parameter. If it already does, I apologize for taking time out of your schedule. Thanks for a good project, btw.

from swashbuckle.aspnetcore.

jgarciadelanoceda avatar jgarciadelanoceda commented on July 17, 2024

I'll look at this feature, because it seems to be a issue of the library although with dotnet 8 you will have the issue
dotnet/aspnetcore#54212. It's a nice to have case insensitive on the Route parameters

from swashbuckle.aspnetcore.

RasmusEdvardsen avatar RasmusEdvardsen commented on July 17, 2024

Agreed - and yea, it does seem like the issue you linked pertains to this issue. I went around it the dirty way - suppressing the warning.

from swashbuckle.aspnetcore.

jgarciadelanoceda avatar jgarciadelanoceda commented on July 17, 2024

As far as I have seen it's an issue with the JS that is part of the /swagger-api/swagger-ui package, I was not able to get a way to make the filtering by Path case insensitive with this library :(

from swashbuckle.aspnetcore.

jgarciadelanoceda avatar jgarciadelanoceda commented on July 17, 2024

@RasmusEdvardsen. The issue that you are describing here should be fixed just by adding [FromRoute] on the object property.
But if you do that, you have to specify the Route as Id instead of id( It's case sensitive).

I think that when this issue is solved, we could handle swagger-api/swagger-ui#8143

from swashbuckle.aspnetcore.

RasmusEdvardsen avatar RasmusEdvardsen commented on July 17, 2024

Alright, sounds good, thanks. I'll close this, and let's hope the linked issue will be fixed soon 👍

from swashbuckle.aspnetcore.

RasmusEdvardsen avatar RasmusEdvardsen commented on July 17, 2024

@jgarciadelanoceda do you want me to close this for now? I realised I should've asked you first, as you have linked this one in swagger-api/swagger-ui#8143

from swashbuckle.aspnetcore.

jgarciadelanoceda avatar jgarciadelanoceda commented on July 17, 2024

As you please, I showed that it has linked a PR that has been active for 3 years, but I hope they merge it

from swashbuckle.aspnetcore.

RasmusEdvardsen avatar RasmusEdvardsen commented on July 17, 2024

Okay, I'll close it. Thanks

from swashbuckle.aspnetcore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.