-
-
Notifications
You must be signed in to change notification settings - Fork 844
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
Fix handling of empty request content by allowing to disable listeners per operation #2757
Fix handling of empty request content by allowing to disable listeners per operation #2757
Conversation
148776e
to
a37e4f6
Compare
d104428
to
caba84f
Compare
Thanks to this you'd have the ability to remove some listeners ( I also don't get the link with #1282 |
Yes.
I don't get what you mean. It's possible to send an empty body if you set |
Well, we fix #1282 by doing the right thing out of the box, and allowing the user to disable specific listeners so that they're able to send empty body, as necessary. Or in other words, no weird attempts by us to try to read the user's mind. 🙈 |
But I'll add tests to show that. |
You removed a functional test, in a way a promise that this use case works :p. I'm not fond of these new attributes though, they're scarry lol, the wdyt @dunglas ?
Couldn't we fix this by implementing the following table instead?
|
Because it's wrong. I'll add new ones.
No. The interpretation depends on the content-type. We don't have enough information to make that decision. It's better to leave it up to the user. But we do the right thing by default, by leaving that up to the Serializer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea, but these new attributes must be honored in GraphQL resolvers too.
Also, couldn't this replace the |
Yes, but we'd need to add the same for:
We could rename the listeners too (and deprecate the old names). So the whole chain would be:
Any of the steps can be disabled individually. WDYT @dunglas? |
The semantics would be of interest to the built-in events implementation. /cc @alanpoulain |
@dunglas Another difficulty is that |
caba84f
to
7fb57fa
Compare
5db69a4
to
a35bf0d
Compare
Could someone help implement the GraphQL support? @alanpoulain? 😄 |
@dunglas Could GraphQL support be added in a separate PR (in |
…s per operation The toggleable listeners are: - ReadListener ("read") - DeserializeListener ("deserialize") - ValidateListener ("validate") - WriteListener ("write") - SerializeListener ("serialize")
a35bf0d
to
b1590b8
Compare
This needs to be documented asap |
Here I'm crying again. Sorry - we are trying to be up-to-date with new stable releases in quite a big project. Our tests failing for 2.4.3, and I spent quite a bit of time looking to the changelog, commits between 2.4.2 and 2.4.3 and searching in 3 repos something similar to this issue to find that this feature is not documented (I'm not even saying that this is a BC break in patch version). Could you please revise the way you guys deploy new features? If it's released, please make sure it's documented. Please make sure there is a note in the changelog. |
@borNfreee I agree, I missed it wasn't targeting master. Maybe should we revert this patch and merge it only in master. Also, it introduces an inconsistency with GraphQL. WYDT @teohhanhui? Can I revert this patch safely? |
If you guys decide to revert it, please tag a |
It's a bug fix. I don't see why it should be reverted. But we should (I should) add the documentation. |
It breaks existing applications that are just upgrading to a new patch version, it’s not acceptable. |
It's only for custom operations which used an empty request body. Our previous hack introduced other bugs, such as throwing an unexpected and cryptic exception when the request body is empty. There's no way to maintain compatibility with buggy behavior. So by definition a bug fix must break what depended on the buggy behavior. |
We could at least agree to not merge bug fixes introducing BC breaks in patch releases. They should at least be in minor releases. This one is a true BC break, not just an edge case... because the old behavior was covered by a test. It's too late to revert now, but could you add a note in the CHANGELOG explaining how to fix this BC break please? |
All bug fixes are BC breaks. We have many test cases that are wrong. It's an unavoidable problem.
I'm on it. |
See #2815 |
The toggleable listeners are:
Basically, we fix the handling of empty request content by removing explicit handling of empty request content (which was wrong, resulting in weird bugs such as #2731), but allowing the user to be in control instead.
TODO: