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
Quoting @dawehner from #2813755-13: JSON responses encoded inconsistently: make them all RFC4627-compliant:
One question though I'd ask in general, shouldn't we strip of HTML out of those errors messages? For me those don't make sense, beside making it harder to read.
\Drupal\Component\Render\PlainTextOutput::renderFromHtml
or a potential different implementation, could be used here.
Proposed resolution
Update \Drupal\rest\Plugin\rest\resource\EntityResource::validate()
.
Remaining tasks
TBD
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#6 | 2835683-6.patch | 6.28 KB | dawehner |
#6 | interdiff.txt | 905 bytes | dawehner |
#4 | interdiff.txt | 1.16 KB | dawehner |
#4 | 2835683-4.patch | 6.26 KB | dawehner |
#2 | 2835683-2.patch | 5.47 KB | dawehner |
Comments
Comment #2
dawehnerHere is a patch for this.
Comment #4
dawehnerI hope I caught all of them.
Comment #5
Wim LeersThis looks great, just one nit :) Once that's done, this is RTBC. Thanks!
s/on REST requests/in REST responses/
Comment #6
dawehnerHe, I think Drupal got adult: It no longer mixes up requests and responses, URLs and links etc. :) Good catch.
Comment #7
Wim LeersThanks!
Comment #8
alexpottCommitted fb33894 and pushed to 8.3.x. Thanks!
Comment #11
Wim LeersThis was ported to JSON API in #2934370: Entity validation constraint violation messages contain JSON-encoded HTML.