Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
#2800873: Add XML GET REST test coverage, work around XML encoder quirks managed to finally get decent test coverage for the xml
serialization format. Which means that GET
ting entities (reading them) is finally supportable/maintainable, because we'll be notified of BC breaks via failing tests.
However, there's still lots of peculiarities there (as discussed in the first several dozen comments on that issue). So I don't think it's something we'd like to support in Drupal 9. Especially because writing XML still is not supported.
Proposed resolution
Deprecate the xml
format in Drupal 9.
Remaining tasks
Discuss.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2926034-2.patch | 1.92 KB | Wim Leers |
Comments
Comment #2
Wim LeersComment #6
Wim LeersComment #7
dawehnerIt feels like XML is a really rare used feature. I don't think we have any further data for this, don't we?
I think one argument in favour of deprecating the XML based encoding is that there is nothing blocking you from implementing a custom XML encoder/decoder for your own project or in contrib.
I could imagine that actually in reality you would need a custom way anyway, as certain systems use certain XML schemas already anyway.
Comment #8
Wim Leers#7: exactly! And we know of at least two cases of that: #2800873-21: Add XML GET REST test coverage, work around XML encoder quirks and #2824837: Change the root node name of a custom REST resource's XML encoding.
Comment #10
mradcliffeI find XmlEncoder useful when I'm writing unit tests, and having it removed or marked as @internal would make it hard for me to write pure unit tests because I would get deprecated or internal warnings in my IDE.
It's not necessarily true that APIs have complex XSD-capable definitions requiring a custom encoder. Plain-old XML (POX) is still used.
I don't really want to write and maintain my own POX encoder when it's already supported in Serializer or serialization module.
Comment #11
Wim LeersInteresting. Why do you specifically find it useful when writing unit tests?
Comment #12
mradcliffeUsing Symfony's XmlEncoder seems to work for me in unit tests, but the lack of NormalizationAwareInterface is probably helpful/useful/how-I-can normalize and denormalize xero api requests/responses. I'm using the
I think it would be possible to remove from core, but it would be a pain to have to install or maintain a contrib module only to re-add a wrapper to Symfony's XmlEncoder back.
The current change record sounds scary to me because it makes it seem like we're removing something as useful as XML, which is still used despite the hotness of JSON. Maybe rewording this to include alternatives if ripping out support for XML serialization is really necessary?
Comment #14
Wim Leers