Skip to content

FAI-17274: Filter undefined fields from upserts #429

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

Merged
merged 1 commit into from
Jul 2, 2025

Conversation

ted-faros
Copy link
Contributor

@ted-faros ted-faros commented Jul 2, 2025

Description

Don't map undefined to null when creating upserts

Type of change

  • Bug fix
  • New feature
  • Breaking change

1. don't map undefined to null when creating upserts
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that undefined field values are omitted (rather than mapped to null) when generating GraphQL upsert objects.

  • Updated formatFieldValue and upsert construction logic to skip undefined values.
  • Added a new test and updated snapshots to verify undefined vs. null handling.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
test/graphql-client.test.ts Added a test case for filtering undefined fields.
test/snapshots/graphql-client.test.ts.snap Updated snapshots to reflect omitted undefined fields.
src/graphql/client/graphql-client.ts Changed object assembly to only include fields when value !== undefined.
Comments suppressed due to low confidence (2)

src/graphql/client/graphql-client.ts:900

  • Consider adding a brief comment above this condition explaining that undefined values are skipped to prevent them being mapped to null. This will clarify the intent for future maintainers.
        if (val !== undefined) {

test/graphql-client.test.ts:869

  • [nitpick] The test name 'undefined field' could be more descriptive. Consider renaming it to 'filter undefined fields from upsert' to clearly convey its purpose.
  test('undefined field', async () => {

Copy link

sonarqubecloud bot commented Jul 2, 2025

@ted-faros ted-faros merged commit 915319e into main Jul 2, 2025
3 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2025
@ted-faros ted-faros deleted the tt/no-undefined-to-null-mapping branch July 2, 2025 19:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants