-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binding confusion when params and request body have the same named field #1423
Comments
We were just about to upgrade to version 4. Out of coincidence one of our test cases for the application caught this bug. It was introduced in version 4.1.7. We will try to downgrade below that for now. |
The actual reason is this bug labstack/echo#1423.
Are there any workarounds for this. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I am very concerned that the bot marked this as "wontfix" because it is quite an obvious and serious bug that is quite hard to debug in production once you run into it. Happy to help with fixing this but I would need some guidance for that. As for workarounds, the only thing I can think of is either downgrading like we did or making sure there is no name collision between the path parameters and the JSON fields which is probably not very practical. |
IMO the decision to merge #1165, not even behind a custom setting or anything is very questionable. It basically breaks about half of our paths in some obscure way due to path parameters randomly matching with struct fields. That's a pretty big assumption that everyone would want query and path parameters inserted into structs. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Addressed in #1681 |
Issue Description
in this PR #1165 added feature to map url params to a struct with the default binder, now if the url params and request body have same named field but different variable type, the default binder will throw an type parse error.
Checklist
Expected behaviour
Maybe binder should bind url params just when struct really contains
params
tag.Actual behaviour
If struct have a field named
id
withjson
tag, and the url have a param namedid
, the default binder will throw an errorSteps to reproduce
curl
make a requestThe text was updated successfully, but these errors were encountered: