Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(document-handling): refactor the Objectmapper supplier and make it private so only copy can be created #3787

Merged
merged 3 commits into from
Dec 16, 2024

Conversation

mathias-vandaele
Copy link
Contributor

Description

Done during the hacking session with the team

@mathias-vandaele mathias-vandaele requested a review from a team as a code owner December 12, 2024 14:58
@mathias-vandaele mathias-vandaele added this to the 8.7.0-alpha3 milestone Dec 13, 2024
@mathias-vandaele mathias-vandaele self-assigned this Dec 13, 2024
@johnBgood johnBgood self-requested a review December 13, 2024 09:37
Copy link
Collaborator

@johnBgood johnBgood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments :)

/** Secrets used as fallback if SecretProvider is loaded via SPI */
public static final String SECRETS_PROJECT_ENV_NAME = "SECRETS_PROJECT_ID";

public static final String SECRETS_PREFIX_ENV_NAME = "SECRETS_PREFIX";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any changes in this class? If not let's revert the changes (re ordering I guess)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes thanks to spotless 🤔

@@ -44,7 +45,13 @@ public class OutboundConnectorContextBuilder {
protected Map<String, Object> variables;
protected DocumentFactory documentFactory =
new DocumentFactoryImpl(InMemoryDocumentStore.INSTANCE);
private ObjectMapper objectMapper = ConnectorsObjectMapperSupplier.getCopy();
private ObjectMapper objectMapper =
ConnectorsObjectMapperSupplier.getCopy()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be the other getCopy(.....) I guess

@@ -51,7 +51,7 @@ public class InboundConnectorContextBuilder {
protected InboundConnectorDefinition definition;
protected ValidationProvider validationProvider;

protected ObjectMapper objectMapper = ConnectorsObjectMapperSupplier.DEFAULT_MAPPER;
protected ObjectMapper objectMapper = ConnectorsObjectMapperSupplier.getCopy();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also plug the document capability here?

@@ -163,8 +163,7 @@ public ConsoleSecretApiClient consoleSecretApiClient(CamundaClientProperties cli
@Bean
@ConditionalOnMissingBean
public ObjectMapper objectMapper(DocumentFactory documentFactory) {
ConnectorsObjectMapperSupplier.registerDocumentModule(
documentFactory, DocumentModuleSettings.create());
ConnectorsObjectMapperSupplier.getCopy(documentFactory, DocumentModuleSettings.create());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should return this line not the one below

Copy link
Member

@chillleader chillleader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@mathias-vandaele mathias-vandaele added this pull request to the merge queue Dec 16, 2024
Comment on lines +57 to +63
protected ObjectMapper objectMapper =
ConnectorsObjectMapperSupplier.getCopy()
.registerModule(
new JacksonModuleDocument(
this.documentFactory,
null,
JacksonModuleDocument.DocumentModuleSettings.create()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt we reuse the getCopy(DocumentFactory factory, DocumentModuleSettings settings) method here?

Merged via the queue into main with commit 6f4c5b5 Dec 16, 2024
11 checks passed
@mathias-vandaele mathias-vandaele deleted the hacking-session-fixing-object-mapper-together branch December 16, 2024 14:08
ConnectorsObjectMapperSupplier.DEFAULT_MAPPER.readValue(
"{\"message\":{\"consumerTag\":\"myConsumerTag\",\"body\":{\"foo\": {\"bar\": \"barValue\"}},\"properties\":{}}}",
Object.class);
ConnectorsObjectMapperSupplier.getCopy()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reuse it between the tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants