diff --git a/core/modules/jsonapi/src/Context/FieldResolver.php b/core/modules/jsonapi/src/Context/FieldResolver.php index c6e590efd7..cafe33bb0b 100644 --- a/core/modules/jsonapi/src/Context/FieldResolver.php +++ b/core/modules/jsonapi/src/Context/FieldResolver.php @@ -355,12 +355,15 @@ public function resolveInternalEntityQueryPath($entity_type_id, $bundle, $extern // JSON:API representation, or if it is an relationship (an entity // reference field), in which case the `id` of the related resource must // always be specified. - $property_specifier_needed = ($at_least_one_entity_reference_field && !$operator || !in_array($operator, ['IS NULL', 'IS NOT NULL'])) || count($candidate_property_names) > 1; + $property_specifier_needed = $at_least_one_entity_reference_field || count($candidate_property_names) > 1; // If there are no remaining path parts, the process is finished unless // the field has multiple properties, in which case one must be specified. if (empty($parts)) { - if ($property_specifier_needed) { + // If the operator is asserting the presence or absence of a + // relationship entirely, it does not make sense to require a property + // specifier. + if ($property_specifier_needed && (!$at_least_one_entity_reference_field || !in_array($operator, ['IS NULL', 'IS NOT NULL'], TRUE))) { $possible_specifiers = array_map(function ($specifier) use ($at_least_one_entity_reference_field) { return $at_least_one_entity_reference_field && $specifier !== 'id' ? "meta.$specifier" : $specifier; }, $candidate_property_names);