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(core): rework JSON value processing #4194

Merged
merged 1 commit into from
Apr 6, 2023
Merged

fix(core): rework JSON value processing #4194

merged 1 commit into from
Apr 6, 2023

Conversation

B4nan
Copy link
Member

@B4nan B4nan commented Apr 6, 2023

Every driver behaves a bit differently when it comes to handling JSON columns. While SQLite is not processing then anyhow, and MongoDB supports them natively, all the others have rather quirky and not very configurable JSON parsing and stringification implemented. It is crucial to have the JSON values properly parsed, as well as normalized in the entity snapshot, so we can correctly detect updates.

This PR makes the JSON parsing fail-safe, returning the value directly if it is not a valid JSON string, and ensures the entity data are in the right shape.

Closes #4193

@B4nan B4nan force-pushed the json-hydration branch 2 times, most recently from 298ee03 to 8261825 Compare April 6, 2023 16:10
@B4nan B4nan merged commit 5594c46 into master Apr 6, 2023
8 checks passed
@B4nan B4nan deleted the json-hydration branch April 6, 2023 16:33
B4nan added a commit that referenced this pull request Apr 26, 2023
…omatically

This fixes a regression introduced in #4194.

Closes #4276
B4nan added a commit that referenced this pull request Apr 26, 2023
…omatically

This fixes a regression introduced in #4194.

Closes #4276
jsprw pushed a commit to jsprw/mikro-orm-full-text-operators that referenced this pull request May 7, 2023
Every driver behaves a bit differently when it comes to handling JSON
columns. While SQLite is not processing then anyhow, and MongoDB
supports them natively, all the others have rather quirky and not very
configurable JSON parsing and stringification implemented. It is crucial
to have the JSON values properly parsed, as well as normalized in the
entity snapshot, so we can correctly detect updates.

This PR makes the JSON parsing fail-safe, returning the value directly
if it is not a valid JSON string, and ensures the entity data are in the
right shape.

Closes mikro-orm#4193
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.

Not fetching records matched by JSON column
1 participant