-
-
Notifications
You must be signed in to change notification settings - Fork 751
fix: preserve null for optional booleans and strip empty JSON objects in refineContentFields #3783
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
72a12b0
b279c22
4e2a322
c9abd1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,10 +6,21 @@ | |
| const item = { ...doc } as T | ||
| for (const key in item) { | ||
| if (fields[key as string] === 'json' && item[key] && item[key] !== 'undefined') { | ||
| item[key] = JSON.parse(item[key] as string) | ||
| const parsed = JSON.parse(item[key] as string) | ||
| if (key !== 'meta' && parsed && typeof parsed === 'object' && !Array.isArray(parsed) && Object.keys(parsed).length === 0) { | ||
| delete item[key] | ||
| } | ||
| else { | ||
| item[key] = parsed | ||
| } | ||
|
Comment on lines
13
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The guard at line 8 only excludes the string Fix: extend the guard to exclude 🐛 Proposed fix- if (fields[key as string] === 'json' && item[key] && item[key] !== 'undefined') {
+ if (fields[key as string] === 'json' && item[key] && item[key] !== 'undefined' && item[key] !== 'NULL') {As a secondary concern, 🤖 Prompt for AI Agents |
||
| } | ||
| if (fields[key as string] === 'boolean' && item[key] !== 'undefined') { | ||
| item[key] = Boolean(item[key]) as never | ||
| if (item[key] == null) { | ||
| delete item[key] | ||
| } | ||
| else { | ||
| item[key] = Boolean(item[key]) as never | ||
| } | ||
|
Comment on lines
22
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle At Line 22, Treat Also applies to: 27-30 🧰 Tools🪛 GitHub Check: ubuntu[failure] 19-19: 🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.