Skip to content

JSON-LD ObjectMapper resolution #4734

@wolf4ood

Description

@wolf4ood

Bug Report

Describe the Bug

Currently we do fetch most of the time the ObjectMapper for JSON-LD processing in the initialize phase of extensions

by injecting the TypeManager and then doing

var jsonLdMapper = typeManager.getMapper(JSON_LD);

This can lead to an issue when the JSON_LD object mapper is not registered yet in the TypeManager.

I've encounter this while working on multi protocol webhooks PR

where I removed the ProtocolWebhook injectable replacing it by a ProtocolWebhookRegistry. This led to a different dependency injection timeline which causes some extension to fetch the JSON_LD ObjectMapper before it was configured by the JsonLdExtension

Possible Implementation

Move in the prepare phase or make it lazy the fetch of the required ObjectMapper

Additional but for future issues, we should make the Registry patter safe, ensuring that values cannot be read from a Registry during
the initialize phase.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions