The __construct()
of \Drupal\jsonapi_extras\EntityToJsonApi
has the following code:
assert(is_string($jsonapi_base_path));
assert($jsonapi_base_path[0] === '/');
assert(substr($jsonapi_base_path, -1) !== '/');
$this->jsonApiBasePath = $jsonapi_base_path;
It means that $jsonapi_base_path
shouldn't start from and end by a slash. However, the calculateContext()
method expects that $this->jsonApiBasePath
is ended by a slash.
$path = sprintf('%s%s/%s', $this->jsonApiBasePath, $resource_path, $entity->uuid());
Also, why jsonapi
and jsonapi_extras
have exactly same (symbol-to-symbol) EntityToJsonApi
? The jsonapi.entity.to_jsonapi
service uses \Drupal\jsonapi\EntityToJsonApi
when jsonapi_extras
disabled and \Drupal\jsonapi_extras\EntityToJsonApi
oterwise. It would be logically to have a decorator (in current scenario the dublucating services just isn't needed).
Comment | File | Size | Author |
---|---|---|---|
#4 | 2995093-4.patch | 926 bytes | BR0kEN |
|
Comments
Comment #2
BR0kENWell, I wasn't right for 100% but the problem exists. The
\Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType::getPath()
returns a value without leading slash.Comment #3
BR0kENRemove duplicating functionality of
jsonapi
.Comment #4
BR0kENThe previous patch is completely incorrect since I haven't checked that
jsonapi
is no longer has the functionality that I've considered as duplicated.Comment #5
e0ipsoI'm in for some resiliency.
Comment #7
e0ipso