Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8794aaf
Upgrade com.github.javaparser to 3.27.0
uglide Jul 11, 2025
6c3b6a2
Use EclipseImportOrderingStrategy instead of custom sorting
uglide Jul 11, 2025
962201d
Update templates to use explicit imports
uglide Jul 11, 2025
fe167a5
Enable imports sorting
uglide Jul 11, 2025
ccc00c9
Add missing license headers to templates
uglide Jul 11, 2025
412ef2a
Remove unused import from template
uglide Jul 11, 2025
0619f3b
Do not remove imported annotations
uglide Jul 11, 2025
7087750
Fix import in template
uglide Jul 11, 2025
2d21f01
Use absolute identifier for KeyScanArgs
uglide Jul 11, 2025
0152dd9
Add missing getJsonParser() to template
uglide Jul 11, 2025
489d94d
Add missing import
uglide Jul 11, 2025
f9eaa5f
Add getJsonParser to KEEP_METHOD_RESULT_TYPE
uglide Jul 11, 2025
3989612
Add missing getJsonParser to the async interface
uglide Jul 11, 2025
651e062
Fix discrepancies in formatting to reduce deviations with templates
uglide Jul 11, 2025
156fd2e
More formatting fixes to align with generator
uglide Jul 11, 2025
aa29103
Clarify deprecation warning for StreamingChannel
uglide Jul 11, 2025
0e2d3d5
Fix formatting
uglide Jul 11, 2025
f21ec4c
Fix bug in matching used types
uglide Jul 11, 2025
943dc05
Fix imports order
uglide Jul 11, 2025
a2c7bbe
Align formatting with template
uglide Jul 11, 2025
78d0e2c
Align sync interfaces with template
uglide Jul 11, 2025
7503219
Align node selection async interfaces with template
uglide Jul 11, 2025
5e805a9
Align node selection sync interfaces with template
uglide Jul 11, 2025
cf7ea11
Fix node selection generators
uglide Jul 11, 2025
b09dba3
Add CI workflow for validation
uglide Jul 11, 2025
24342df
Fix workflow
uglide Jul 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions .github/workflows/api-generator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: API Generator Tests

on:
push:
paths-ignore:
- 'docs/**'
- '**/*.md'
- '**/*.rst'
branches:
- main
- '[0-9].*'
pull_request:
branches:
- main
- '[0-9].*'
workflow_dispatch:

env:
# Files to ignore when checking for changes after generation and formatting
# Add one file per line, using shell glob patterns
IGNORED_FILES: |
src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java

jobs:
api-generator:
name: API Generator Tests and Formatting
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v4

- name: Set Java up in the runner
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
cache: 'maven'

- name: Setup Maven
uses: s4u/[email protected]
with:
java-version: 8

- name: Maven offline
run: |
mvn -q dependency:go-offline
continue-on-error: true

- name: Run API generator tests (excluding Kotlin)
run: |
mvn test -Dgroups="api_generator" -Dtest='!CreateKotlinCoroutinesApi'
env:
JVM_OPTS: -Xmx3200m
TERM: dumb

- name: Run formatter
run: |
mvn formatter:format
env:
JVM_OPTS: -Xmx3200m
TERM: dumb

- name: Check for changes after generation and formatting
run: |
# Get all changed files
CHANGED_FILES=$(git status --porcelain)

if [ -n "$CHANGED_FILES" ]; then
echo "Files changed after generation and formatting:"
echo "$CHANGED_FILES"
echo ""

# Filter out ignored files
FILTERED_FILES=""
while IFS= read -r file; do
if [ -n "$file" ]; then
# Extract filename from git status output (remove status prefix)
filename=$(echo "$file" | sed 's/^...//')

# Check if file should be ignored
should_ignore=false
while IFS= read -r ignore_pattern; do
if [ -n "$ignore_pattern" ] && [[ "$filename" == $ignore_pattern ]]; then
echo "🔇 Ignoring changes in: $filename"
should_ignore=true
break
fi
done <<< "$IGNORED_FILES"

# Add to filtered list if not ignored
if [ "$should_ignore" = false ]; then
FILTERED_FILES="$FILTERED_FILES$file"$'\n'
fi
fi
done <<< "$CHANGED_FILES"

# Check if there are any non-ignored changes
if [ -n "$(echo "$FILTERED_FILES" | tr -d '\n')" ]; then
echo ""
echo "❌ Code changes detected after running API generators and formatter!"
echo "The following files have been modified (excluding ignored files):"
echo "$FILTERED_FILES"
echo ""
echo "Git diff (excluding ignored files):"
while IFS= read -r file; do
if [ -n "$file" ]; then
filename=$(echo "$file" | sed 's/^...//')
should_ignore=false
while IFS= read -r ignore_pattern; do
if [ -n "$ignore_pattern" ] && [[ "$filename" == $ignore_pattern ]]; then
should_ignore=true
break
fi
done <<< "$IGNORED_FILES"

if [ "$should_ignore" = false ]; then
echo "--- Changes in: $filename ---"
git diff "$filename"
echo ""
fi
fi
done <<< "$CHANGED_FILES"
echo ""
echo "This indicates that the generated code is not up to date with the templates"
echo "or that the code formatting is inconsistent."
echo "Please run the API generators and formatter locally and commit the changes."
exit 1
else
echo "✅ All changes are in ignored files. Generated code and formatting are up to date!"
fi
else
echo "✅ No changes detected. Generated code and formatting are up to date!"
fi
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@
<dependency>
<groupId>com.github.javaparser</groupId>
<artifactId>javaparser-core</artifactId>
<version>3.6.3</version>
<version>3.27.0</version>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Map;

import io.lettuce.core.RedisFuture;
import io.lettuce.core.json.JsonParser;
import io.lettuce.core.output.CommandOutput;
import io.lettuce.core.protocol.CommandArgs;
import io.lettuce.core.protocol.ProtocolKeyword;
Expand All @@ -33,6 +34,7 @@
* @param <K> Key type.
* @param <V> Value type.
* @author Mark Paluch
* @author Tihomir Mateev
* @author Ali Takavci
* @since 4.0
* @generated by io.lettuce.apigenerator.CreateAsyncApi
Expand Down Expand Up @@ -228,4 +230,10 @@ public interface BaseRedisAsyncCommands<K, V> {
@Deprecated
void flushCommands();

/**
* @return the currently configured instance of the {@link JsonParser}
* @since 6.5
*/
JsonParser getJsonParser();

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
*/
package io.lettuce.core.api.async;

import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.List;
import java.util.Map;

import io.lettuce.core.ExpireArgs;
import io.lettuce.core.HGetExArgs;
import io.lettuce.core.HSetExArgs;
Expand All @@ -33,12 +39,6 @@
import io.lettuce.core.output.KeyValueStreamingChannel;
import io.lettuce.core.output.ValueStreamingChannel;

import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* Asynchronous executed commands for Hashes (Key-Value pairs).
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package io.lettuce.core.api.async;

import java.util.List;

import io.lettuce.core.RedisFuture;
import io.lettuce.core.json.JsonPath;
import io.lettuce.core.json.JsonType;
Expand Down
27 changes: 18 additions & 9 deletions src/main/java/io/lettuce/core/api/async/RedisKeyAsyncCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@
import java.util.Date;
import java.util.List;

import io.lettuce.core.*;
import io.lettuce.core.CopyArgs;
import io.lettuce.core.ExpireArgs;
import io.lettuce.core.KeyScanCursor;
import io.lettuce.core.MigrateArgs;
import io.lettuce.core.RedisFuture;
import io.lettuce.core.RestoreArgs;
import io.lettuce.core.ScanArgs;
import io.lettuce.core.ScanCursor;
import io.lettuce.core.SortArgs;
import io.lettuce.core.StreamScanCursor;
import io.lettuce.core.output.KeyStreamingChannel;
import io.lettuce.core.output.ValueStreamingChannel;

Expand Down Expand Up @@ -609,21 +618,21 @@ public interface RedisKeyAsyncCommands<K, V> {
RedisFuture<KeyScanCursor<K>> scan();

/**
* Incrementally iterate the keys space. Use {@link KeyScanArgs} to specify {@code SCAN}-specific arguments.
* Incrementally iterate the keys space. Use {@link io.lettuce.core.KeyScanArgs} to specify {@code SCAN}-specific arguments.
*
* @param scanArgs scan arguments.
* @return KeyScanCursor&lt;K&gt; scan cursor.
* @see KeyScanArgs
* @see io.lettuce.core.KeyScanArgs
*/
RedisFuture<KeyScanCursor<K>> scan(ScanArgs scanArgs);

/**
* Incrementally iterate the keys space. Use {@link KeyScanArgs} to specify {@code SCAN}-specific arguments.
* Incrementally iterate the keys space. Use {@link io.lettuce.core.KeyScanArgs} to specify {@code SCAN}-specific arguments.
*
* @param scanCursor cursor to resume from a previous scan, must not be {@code null}.
* @param scanArgs scan arguments.
* @return KeyScanCursor&lt;K&gt; scan cursor.
* @see KeyScanArgs
* @see io.lettuce.core.KeyScanArgs
*/
RedisFuture<KeyScanCursor<K>> scan(ScanCursor scanCursor, ScanArgs scanArgs);

Expand All @@ -644,23 +653,23 @@ public interface RedisKeyAsyncCommands<K, V> {
RedisFuture<StreamScanCursor> scan(KeyStreamingChannel<K> channel);

/**
* Incrementally iterate the keys space. Use {@link KeyScanArgs} to specify {@code SCAN}-specific arguments.
* Incrementally iterate the keys space. Use {@link io.lettuce.core.KeyScanArgs} to specify {@code SCAN}-specific arguments.
*
* @param channel streaming channel that receives a call for every key.
* @param scanArgs scan arguments.
* @return StreamScanCursor scan cursor.
* @see KeyScanArgs
* @see io.lettuce.core.KeyScanArgs
*/
RedisFuture<StreamScanCursor> scan(KeyStreamingChannel<K> channel, ScanArgs scanArgs);

/**
* Incrementally iterate the keys space. Use {@link KeyScanArgs} to specify {@code SCAN}-specific arguments.
* Incrementally iterate the keys space. Use {@link io.lettuce.core.KeyScanArgs} to specify {@code SCAN}-specific arguments.
*
* @param channel streaming channel that receives a call for every key.
* @param scanCursor cursor to resume from a previous scan, must not be {@code null}.
* @param scanArgs scan arguments.
* @return StreamScanCursor scan cursor.
* @see KeyScanArgs
* @see io.lettuce.core.KeyScanArgs
*/
RedisFuture<StreamScanCursor> scan(KeyStreamingChannel<K> channel, ScanCursor scanCursor, ScanArgs scanArgs);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import io.lettuce.core.RedisFuture;
import io.lettuce.core.ShutdownArgs;
import io.lettuce.core.TrackingArgs;
import io.lettuce.core.UnblockType;
import io.lettuce.core.TrackingInfo;
import io.lettuce.core.UnblockType;
import io.lettuce.core.protocol.CommandType;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,20 @@
package io.lettuce.core.api.async;

import java.util.List;
import io.lettuce.core.*;

import io.lettuce.core.KeyValue;
import io.lettuce.core.Limit;
import io.lettuce.core.Range;
import io.lettuce.core.RedisFuture;
import io.lettuce.core.ScanArgs;
import io.lettuce.core.ScanCursor;
import io.lettuce.core.ScoredValue;
import io.lettuce.core.ScoredValueScanCursor;
import io.lettuce.core.StreamScanCursor;
import io.lettuce.core.ZAddArgs;
import io.lettuce.core.ZAggregateArgs;
import io.lettuce.core.ZPopArgs;
import io.lettuce.core.ZStoreArgs;
import io.lettuce.core.output.ScoredValueStreamingChannel;
import io.lettuce.core.output.ValueStreamingChannel;

Expand Down Expand Up @@ -1448,7 +1460,7 @@ RedisFuture<Long> zrevrangebyscoreWithScores(ScoredValueStreamingChannel<V> chan
* stores the result in the {@code dstKey} destination key.
*
* @param dstKey the src key.
*
*
* @param srcKey the dst key.
* @param range the score range.
* @param limit the limit to apply.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,19 @@
import java.util.List;
import java.util.Map;

import io.lettuce.core.*;
import io.lettuce.core.Consumer;
import io.lettuce.core.Limit;
import io.lettuce.core.Range;
import io.lettuce.core.RedisFuture;
import io.lettuce.core.StreamMessage;
import io.lettuce.core.XAddArgs;
import io.lettuce.core.XAutoClaimArgs;
import io.lettuce.core.XClaimArgs;
import io.lettuce.core.XGroupCreateArgs;
import io.lettuce.core.XPendingArgs;
import io.lettuce.core.XReadArgs;
import io.lettuce.core.XReadArgs.StreamOffset;
import io.lettuce.core.XTrimArgs;
import io.lettuce.core.models.stream.ClaimedMessages;
import io.lettuce.core.models.stream.PendingMessage;
import io.lettuce.core.models.stream.PendingMessages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import io.lettuce.core.BitFieldArgs;
import io.lettuce.core.GetExArgs;
import io.lettuce.core.KeyValue;
import io.lettuce.core.LcsArgs;
import io.lettuce.core.RedisFuture;
import io.lettuce.core.SetArgs;
import io.lettuce.core.LcsArgs;
import io.lettuce.core.StrAlgoArgs;
import io.lettuce.core.StringMatchResult;
import io.lettuce.core.output.KeyValueStreamingChannel;
Expand Down Expand Up @@ -349,15 +349,15 @@ public interface RedisStringAsyncCommands<K, V> {
/**
* Set multiple keys to multiple values.
*
* @param map the map.
* @param map the map containing key-value pairs.
* @return String simple-string-reply always {@code OK} since {@code MSET} can't fail.
*/
RedisFuture<String> mset(Map<K, V> map);

/**
* Set multiple keys to multiple values, only if none of the keys exist.
*
* @param map the map.
* @param map the map containing key-value pairs.
* @return Boolean integer-reply specifically:
*
* {@code 1} if the all the keys were set. {@code 0} if no key was set (at least one key already existed).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
*/
package io.lettuce.core.api.async;

import java.util.Map;
import java.util.List;
import java.util.Map;

import io.lettuce.core.RedisFuture;
import io.lettuce.core.VAddArgs;
import io.lettuce.core.VSimArgs;
Expand Down
Loading