Skip to content

Commit

Permalink
fix: fixated deserialisation from files to respective types (#35103)
Browse files Browse the repository at this point in the history
## Description
> [!TIP]  
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.Git"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!IMPORTANT]
> 🟣 🟣 🟣 Your tests are running.
> Tests running at:
<https://github.com/appsmithorg/appsmith/actions/runs/10052956494>
> Commit: c36c6a9
> Workflow: `PR Automation test suite`
> Tags: `@tag.Git`
> Spec: ``
> <hr>Tue, 23 Jul 2024 04:56:36 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


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


- **New Features**
- Enhanced JSON deserialization to preserve float values accurately,
improving data integrity during processing.

- **Documentation**
- Added comments to clarify the purpose of changes in the
deserialization process.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
sondermanish authored Jul 23, 2024
1 parent 351acde commit a38ef9a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.appsmith.util.SerializationUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.PrettyPrinter;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
Expand Down Expand Up @@ -64,9 +65,11 @@ public FileOperationsCEv2Impl(
super(gitServiceConfig, gitExecutor, gsonBuilder, observationHelper);

this.objectMapper = SerializationUtils.getBasicObjectMapper(prettyPrinter);
this.objectReader = objectMapper.readerWithView(Git.class);
this.objectWriter = objectMapper.writerWithView(Git.class);

// this is done in order to stop importing float values as int while deserializing
this.objectReader = objectMapper.readerWithView(Git.class).without(DeserializationFeature.ACCEPT_FLOAT_AS_INT);

this.objectWriter = objectMapper.writerWithView(Git.class);
this.observationHelper = observationHelper;
}

Expand Down

0 comments on commit a38ef9a

Please sign in to comment.