Skip to content
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

fix: ledger_data returns an empty list (instead of null) when all entries are filtered out #4398

Conversation

drlongle
Copy link
Contributor

@drlongle drlongle commented Jan 24, 2023

High Level Overview of Change

This PR resolves issue 4392. When the type field to the ledger_data method is specified, it is possible that no objects of the specified type are found. When this happens, the state field of the response has the value null instead of an empty array ([]).

Context of Change

The PR initializes the state field of the response to an empty list so that the field is not a null. This can break client code that explicitly checks for null. However, this behavior is consistent with the documentation.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

@intelliot intelliot requested a review from mDuo13 January 24, 2023 17:36
@intelliot intelliot changed the title Ledger data returns an empty list instead of null when all entries are filtered out fix: Ledger data returns an empty list (instead of null) when all entries are filtered out Feb 8, 2023
@intelliot
Copy link
Collaborator

@drlongle if you agree that this is ready to merge, please comment with a suggested commit message for this PR

@drlongle
Copy link
Contributor Author

Suggested commit message

When no entries are found, make ledger_data return an empty array instead of null: (#4392)

When the type field for the ledger_data method is specified, it is possible that no objects of the specified type are found. When this happens, the state field of the response has the value null instead of an empty array. According to the documentation, the state field should be an array.

@intelliot intelliot merged commit 2f3f6dc into XRPLF:develop Mar 30, 2023
@drlongle drlongle deleted the ledger-data-returns-empty-list-instead-of-null branch March 31, 2023 16:00
@intelliot intelliot changed the title fix: Ledger data returns an empty list (instead of null) when all entries are filtered out fix: ledger_data returns an empty list (instead of null) when all entries are filtered out Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

ledger_data returns null instead of empty list when all entries are filtered out
6 participants