-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix(document-handling): refactor the Objectmapper supplier and make it private so only copy can be created #3787
Conversation
…t private so only copy can be created
…t private so only copy can be created
There was a problem hiding this 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"; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
protected ObjectMapper objectMapper = | ||
ConnectorsObjectMapperSupplier.getCopy() | ||
.registerModule( | ||
new JacksonModuleDocument( | ||
this.documentFactory, | ||
null, | ||
JacksonModuleDocument.DocumentModuleSettings.create())); |
There was a problem hiding this comment.
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?
ConnectorsObjectMapperSupplier.DEFAULT_MAPPER.readValue( | ||
"{\"message\":{\"consumerTag\":\"myConsumerTag\",\"body\":{\"foo\": {\"bar\": \"barValue\"}},\"properties\":{}}}", | ||
Object.class); | ||
ConnectorsObjectMapperSupplier.getCopy() |
There was a problem hiding this comment.
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?
Description
Done during the hacking session with the team