fix: Remove unsupported WithMerchant filter from transaction queries#18
Merged
eshaffer321 merged 1 commit intomainfrom Nov 27, 2025
Merged
Conversation
The MonarchMoney GraphQL API does not support filtering transactions
by merchant name via the `merchant` field in TransactionFilterInput.
Attempting to use this filter results in a 400 BAD_REQUEST error:
Field 'merchant' is not defined by type 'TransactionFilterInput'
This fix removes the WithMerchant() method from the TransactionQueryBuilder
interface and implementation. Users should use the Search() method instead,
which searches across multiple text fields including merchant names.
Changes:
- Removed WithMerchant() from TransactionQueryBuilder interface
- Removed WithMerchant() implementation from transactionQueryBuilder
- Enhanced Search() method documentation to clarify it searches merchants
Migration:
Before: client.Transactions.Query().WithMerchant("Starbucks")
After: client.Transactions.Query().Search("Starbucks")
This aligns the Go client with the Python reference implementation,
which does not expose a merchant-specific filter parameter.
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (44.82%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #18 +/- ##
==========================================
+ Coverage 44.74% 44.82% +0.08%
==========================================
Files 15 15
Lines 1665 1662 -3
==========================================
Hits 745 745
+ Misses 845 842 -3
Partials 75 75
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
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.
Summary
Removes the
WithMerchant()filter method from transaction queries because the MonarchMoney GraphQL API does not support filtering by merchant name. Using this filter causes a400 BAD_REQUESTerror.WithMerchant()method fromTransactionQueryBuilderinterface and implementationSearch()method instead, which searches merchants and other text fieldsProblem
The
TransactionFilterInputGraphQL type does not include amerchantfield. Attempting to useWithMerchant()results in:According to the Python reference implementation, the supported filters are:
Solution
Before:
After:
Changes
pkg/monarch/interfaces.go: RemovedWithMerchant()from interfacepkg/monarch/transactions.go: Removed implementation, enhancedSearch()documentationTest Plan
Search()provides equivalent functionalityBreaking Change
WithMerchant(). However:Search()Search()method