-
-
Notifications
You must be signed in to change notification settings - Fork 586
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
Change to optional Doctrine/Annotations package introduces a breaking change #1537
Comments
Yes it does, here is the original thread were they discuss the matter - #1471 It broke in production on a live environment and we had to figure all this 💩 out quick - see https://jmsyst.com/libs/serializer/master/configuration#configuring-metadata-locations So we ended up with explicitly adding the original requirement - aka It should have been a major OR at least not as that disruptive somehow. That was a bold move. |
Yea, that's what I did in order to fix it on our side. For future readers of this issue which are still using the Doctrine Annotation for the serializer: I'de suggest requiring |
Yeah, the problem is, as a user of This kind of situation happens and is usually handled in a way that you have "optional" dependencies that are declared by the library. And yes, at that moment you can go and read the doc about it to realize "oh, if I pull X then the component will use it". But every time you have those optional dependencies... well... they are optional! So the library works without them. And this is exactly what broke here. Basically, Doctrine Annotation is NOT an optional dependency on PHP 7.4 without explicit metadata. |
Doc block-based annotations ARE a form of explicit metadata. Except that metadata is declared on your class objects and not in a separate mapping file, and parsing that metadata relies on the Yes, that change broke applications that relied on transient dependencies to configure their environments properly, but short of making a B/C promise about the |
Docs updated. ;) |
This is BS. You should rollback all this and release a 3.30.1 version to patch the regression. And then you should find a proper way of removing Doctrine Annotations. |
@fredericgboutin-yapla indeed. This is breaking changes and it should be handled accordingly |
I'm now curious. How many folks following this issue have been bitten by the actual B/C break in the 3.30 release, the signature change in the To my knowledge, nobody has a B/C promise regarding the dependencies in their Look, I'm sorry applications broke because upgrading |
For me it was the removal of Removing a dependency is imo no BC break since like you state, there is no promise and going down that route would only result in everything needing a new major release. There is however one big gotcha. *(the sidenote) Right now this package still has a soft dependency to Now, I could be misunderstanding the upgrade to PHP Attributes requirement here - **second sidenote up head on that. Another big difference here versus the usage of a lot of other transient dependencies is that the We are using https://github.com/maglnet/ComposerRequireChecker in our pipeline so using classes from a package without requiring it is already detected and reported in our pipeline. Docblocks, however, are not real php code, so that check never took a (**sidenote 2) In regards to improvements, the communication could be a bit better regarding upgrade guide/changelog changes. But that's not really a point specifically for this package, but for the community overal since there are few repositories maintaining an up to date changelog/upgrade guide (even for major releases). Right now I could switch over from php docblocks to PHP Attributes. But since there's no upgrade guide here... I don't know what to do without quite some investigation and debugging. Just my two cents :) |
That wouldn't have happened. The entire push behind moving |
Steps required to reproduce the problem
In c7e6eb1 the
doctrine/annotations
package is removed from the require section. This change was released in tag 3.30.0 (3.29.1...3.30.0)In our case a
composer update
updatesjms/serializer
and removesdoctrine/annotations
from the installed packages and as a result, the de/serializer broke down completely. We're using annotations quite a lot for this serializer package.For example:
But without the
doctrine/annotations
, the annotations are suddenly ignored.I presume this is because of a migration to PHP Attributes? - although I can't find any proof of that in any changes here (CHANGELOG.md. UPGRADING.md have long not been touched)
Since this change was added in a minor release, it was quite unexpectedly breaking our builds.
Our serializer is initialized as following (Laravel framework):
Expected Result
Deserialization works as in tag 3.29.1
Actual Result
JMS \ Serializer \ Exception \ RuntimeException
Message:
You must define a type for Modules\Media\Models\File::$id.
The text was updated successfully, but these errors were encountered: