Skip to content

parity(postgrest): add StripNulls method for null value stripping [from supabase-js] #245

Closed

Description

@grdsdev

SDK Parity: C# implementation needed

A new feature was added in supabase-js that needs to be implemented in supabase-community/postgrest-csharp for SDK parity.

Reference Implementation (supabase-js)

What Changed

Added a .stripNulls() method to the PostgREST query builder that sets Prefer: return=stripped-nulls header. PostgREST omits null-valued properties from response JSON. Requires PostgREST 11.2.0+.

Code Reference

```typescript
const { data } = await supabase.from('characters').select().stripNulls()
// Response: [{ "id": 1, "name": "Luke" }] (bio: null is stripped)
```

Implementation Guidance

Expected API Surface

Add a .StripNulls() method to the query builder chain. It should append return=stripped-nulls to the Prefer header.

Note: With C# System.Text.Json, stripped null values work well with nullable properties (string?). Missing JSON properties will deserialize to null/default for nullable types.

Key Behaviors to Match

  • Sets Prefer: return=stripped-nulls header
  • Cannot be combined with .Csv() (throw InvalidOperationException)
  • Works with .Select(), .Single(), .MaybeSingle()

Acceptance Criteria

  • .StripNulls() method added
  • Prefer: return=stripped-nulls header set
  • Exception thrown when combined with .Csv()
  • Unit tests
  • No breaking changes

Context

  • supabase-js version: v2.103.0+
  • PostgREST requirement: 11.2.0+
  • Parity tracking: This issue was auto-generated by SDK parity analysis

Generated with Claude Code /sync-sdk-parity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions