feat(postgrest): add stripNulls method for null value stripping#2189
Open
TheSeydiCharyyev wants to merge 3 commits intosupabase:masterfrom
Open
feat(postgrest): add stripNulls method for null value stripping#2189TheSeydiCharyyev wants to merge 3 commits intosupabase:masterfrom
TheSeydiCharyyev wants to merge 3 commits intosupabase:masterfrom
Conversation
@supabase/auth-js
@supabase/functions-js
@supabase/postgrest-js
@supabase/realtime-js
@supabase/storage-js
@supabase/supabase-js
commit: |
| test('stripNulls does not affect csv', async () => { | ||
| const res = await postgrest.from('users').select().csv().stripNulls() | ||
| expect(res.error).toBeNull() | ||
| // CSV format should still work — stripNulls is ignored for non-JSON formats |
Member
There was a problem hiding this comment.
How about failing instead when stripNulls is chained with csv?
Author
|
Good idea, will make it throw an error instead. Pushing a fix soon. |
Author
|
Updated — |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a
stripNulls()method to the PostgREST query builder, enabling null value stripping from JSON responses via the PostgRESTnulls=strippedmedia type parameter.Related Issue
Resolves supabase/postgrest-js#460
How it works
shouldStripNullsflag toPostgrestBuilderstripNulls()method sets this flag.then(), before fetch, the Accept header is modified:application/vnd.pgrst.array+json;nulls=strippedapplication/vnd.pgrst.object+json;nulls=strippedUsage