Skip to content

Commit

Permalink
chore: Remove strict payload parsing (#34680)
Browse files Browse the repository at this point in the history
Reverting #33724
temporarily, until we gain more confidence.

[Slack
conversation](https://theappsmith.slack.com/archives/C040LHZN03V/p1719997989677959).



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Improved server configuration by removing unnecessary custom object
mapper settings.
- Optimized data source handling by cleaning up authentication object
manipulations.

- **New Features**
- Introduced a new method for future strict type checking on the server.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: “sneha122” <“[email protected]”>
  • Loading branch information
sharat87 and “sneha122” authored Jul 3, 2024
1 parent 8508161 commit 0b4d664
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
10 changes: 1 addition & 9 deletions app/client/src/api/DatasourcesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ class DatasourcesApi extends API {
datasourceConfiguration: {
...storage.datasourceConfiguration,
isValid: undefined,
authentication: DatasourcesApi.cleanAuthenticationObject(
storage.datasourceConfiguration.authentication,
),
connection: storage.datasourceConfiguration.connection && {
...storage.datasourceConfiguration.connection,
ssl: {
Expand All @@ -70,6 +67,7 @@ class DatasourcesApi extends API {
return API.post(DatasourcesApi.url, datasourceConfig);
}

// Need for when we add strict type checking back on server
static cleanAuthenticationObject(authentication: any): any {
if (!authentication) {
return undefined;
Expand Down Expand Up @@ -144,9 +142,6 @@ class DatasourcesApi extends API {
toastMessage: undefined,
datasourceConfiguration: datasourceConfig.datasourceConfiguration && {
...datasourceConfig.datasourceConfiguration,
authentication: DatasourcesApi.cleanAuthenticationObject(
datasourceConfig.datasourceConfiguration.authentication,
),
connection: datasourceConfig.datasourceConfiguration.connection && {
...datasourceConfig.datasourceConfiguration.connection,
ssl: {
Expand Down Expand Up @@ -179,9 +174,6 @@ class DatasourcesApi extends API {
toastMessage: undefined,
datasourceConfiguration: datasourceStorage.datasourceConfiguration && {
...datasourceStorage.datasourceConfiguration,
authentication: DatasourcesApi.cleanAuthenticationObject(
datasourceStorage.datasourceConfiguration.authentication,
),
connection: datasourceStorage.datasourceConfiguration.connection && {
...datasourceStorage.datasourceConfiguration.connection,
ssl: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.appsmith.util.JSONPrettyPrinter;
import com.appsmith.util.SerializationUtils;
import com.fasterxml.jackson.core.PrettyPrinter;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
Expand All @@ -18,7 +17,6 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.util.StringUtils;
import reactor.core.scheduler.Scheduler;
import reactor.core.scheduler.Schedulers;
Expand Down Expand Up @@ -103,16 +101,6 @@ public ObjectMapper objectMapper() {
return SerializationUtils.getDefaultObjectMapper(null);
}

@Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();

converter.setObjectMapper(objectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, "CE".equals(ProjectProperties.EDITION)));

return converter;
}

@Bean
public Gson gsonInstance() {
GsonBuilder gsonBuilder = new GsonBuilder();
Expand Down

0 comments on commit 0b4d664

Please sign in to comment.