Problem/Motivation
The work done on #3048348: Denormalizing NULL for an optional @FieldType=address or @FieldType=geolocation field fails due to either no main property name or computed read-only main property result on a failure on automated test where the db storage is PostgreSQL.
See test failures against 8.8.x and 8.7.x (patch to be commited yet).
Failure message is:
1) Drupal\Tests\jsonapi\Functional\JsonApiRegressionTest::testMapFieldTypeNormalizationFromIssue3040590
Failed asserting that null is identical to Array &0 (
'foo' => 'bar'
)./var/www/html/core/modules/jsonapi/tests/src/Functional/JsonApiRegressionTest.php:913
Proposed resolution
Fix the problem.
Remaining tasks
- Investigate why this is happening
- Write a fix for the issue
- Provide tests
User interface changes
No.
API changes
Not expected.
Data model changes
Not expected.
Release notes snippet
Not expected.
Comment | File | Size | Author |
---|---|---|---|
#3 | 3078639-3.patch | 762 bytes | gabesullice |
Comments
Comment #2
gambryThis is critical as being a bug which
Cause tests to fail in HEAD on the automated testing platform
for a supported environment (policy).Comment #3
gabesulliceValidating a hunch...
I don't yet have Postgres set up for testing, so let's let the testbot do it.
Comment #4
gabesulliceThe tests haven't finished, but looking at the console output I can see that
JsonApiRegressionTest
passed. I think the hunch was right: Postgres is probably sorting by "last updated" while MySQL is sorting by ID when no sort is explicitly provided. By adding asort
query parameter to the request URL we can side-step the implementation difference.Comment #5
Wim LeersMakes sense! I would've expected the Entity Field Query API would have handled this distinction for us automatically, but it's understandable that it does not.
The work-around is very reasonable. Thanks for getting to the bottom of this, @gabesullice! 👏
Comment #6
gambryAmazing found out. I honestly thought the whole segment
$data['data']
of$data['data'][0]['attributes']['data']
was missing, presenting a more catastrophic scenario... then just a sorting issue.Makes a lot of sense. Thanks @gabesullice . Would you update patch on #3048348: Denormalizing NULL for an optional @FieldType=address or @FieldType=geolocation field fails due to either no main property name or computed read-only main property as well?
I believe there won't be any more release on 8.7.x, so it's probably pointless to update the patch in there.8.8.x will happen in December, so there is plenty of time.Comment #8
catchCommitted 5cd4900 and pushed to 8.8.x. Thanks!