feat(api): allow excluding id and order fields from list rows response#5381
Open
singhvishalkr wants to merge 1 commit into
Open
feat(api): allow excluding id and order fields from list rows response#5381singhvishalkr wants to merge 1 commit into
singhvishalkr wants to merge 1 commit into
Conversation
Adds support for excluding the built-in id and order fields from the list_database_table_rows API response. Users can now pass id and/or order in the exclude query parameter alongside regular field exclusions. Example: GET /rows/?exclude=id,order,field_1 Fixes baserow#893
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.
This PR adds the ability to exclude the built-in
idandorderfields from the list_database_table_rows API response.Currently, the
excludeparameter only works for user-created fields (field_1, field_2, etc.). Theidandorderfields are always included in the response even when not needed, which can be wasteful for clients that only care about the actual data.With this change, users can pass
idandorderin the exclude query parameter:GET /api/database/rows/table/{table_id}/?exclude=id- excludes idGET /api/database/rows/table/{table_id}/?exclude=order- excludes orderGET /api/database/rows/table/{table_id}/?exclude=id,order- excludes bothGET /api/database/rows/table/{table_id}/?exclude=id,order,field_1- mix with field exclusionsThe implementation adds:
extract_row_metadata_field_exclusions()helper in utils.py to detect id/order in exclude stringexclude_idandexclude_orderparameters toget_row_serializer_class()Closes #893