This patch implements support for the optional name parameter in ListStores functionality for the OpenFGA Java SDK, addressing issue #157.
Adds the ability to filter stores by name when calling listStores(), supporting the API functionality introduced in openfga/api#211.
listStores-name-filter.patch- Git diff of all changeslistStores-name-filter-staged.patch- Staged changes ready for commit
// Filter by name only
ClientListStoresOptions options = new ClientListStoresOptions().name("my-store");
ClientListStoresResponse response = client.listStores(options).get();
// Combine with pagination
ClientListStoresOptions options = new ClientListStoresOptions()
.name("my-store")
.pageSize(10)
.continuationToken("token");- Added
namefield with getter/setter methods - Follows existing pattern for optional parameters
- Extended method signatures to include
nameparameter - Maintained backward compatibility with overloaded methods
- Updated
pathWithParamscall to include name parameter - Added comprehensive JavaDoc documentation
- Updated client to pass
nameparameter from options to API - Uses existing options pattern consistently
- Unit Tests: Added tests for name filter scenarios
- Integration Tests: Added tests for both API and Client levels
- Combined Parameters: Tests for name + pagination parameters
- Backward Compatibility: Verified existing tests still pass
✅ All existing listStores() method signatures remain unchanged
✅ Existing code continues to work without modification
✅ New functionality is purely additive
- Uses existing
pathWithParamsutility for query parameter construction - Null values are handled gracefully (filtered out automatically)
- Follows project conventions for optional parameters
- Passes all existing tests
- Passes Spotless code formatting checks
- Follows existing code patterns and conventions
- Comprehensive test coverage added
./gradlew test # All tests pass ✅
./gradlew build # Clean build ✅
./gradlew spotlessCheck # Code formatting ✅src/main/java/dev/openfga/sdk/api/configuration/ClientListStoresOptions.javasrc/main/java/dev/openfga/sdk/api/OpenFgaApi.javasrc/main/java/dev/openfga/sdk/api/client/OpenFgaClient.javasrc/test/java/dev/openfga/sdk/api/client/OpenFgaClientTest.javasrc/test-integration/java/dev/openfga/sdk/api/OpenFgaApiIntegrationTest.javasrc/test-integration/java/dev/openfga/sdk/api/client/OpenFgaClientIntegrationTest.java
# Apply the patch to your OpenFGA Java SDK repository
git apply listStores-name-filter.patch
# Or if you have staged the files:
git apply listStores-name-filter-staged.patch
# Verify the changes
git status
git diff
# Run tests to verify
./gradlew test# Stage and commit the changes
git add .
git commit -m "Add name filter support to ListStores
- Add name parameter to ClientListStoresOptions
- Extend OpenFgaApi.listStores() method signatures
- Update OpenFgaClient to pass name parameter
- Add comprehensive unit and integration tests
- Maintain full backward compatibility
Resolves #157"
# Push to your fork
git push origin main- Resolves: openfga/java-sdk#157
- Related: openfga/sdk-generator#517
- Implements: openfga/api#211
This implementation provides the Java SDK portion of the broader SDK generator issue. The changes follow the exact patterns used by other optional parameters in the SDK and maintain full backward compatibility.
Generated on: $(date)