-
Notifications
You must be signed in to change notification settings - Fork 67
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
Java: JSON.ARRINSERT
and JSON.ARRLEN
#2476
Conversation
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
JSON.ARRINSERT
and JSON.ARRLEN
JSON.ARRINSERT
and JSON.ARRLEN
…alkey-442 Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
}; | ||
var res = Json.arrinsert(client, key, "$..a", 0, values).get(); | ||
|
||
doc = Json.get(client, key).get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you re-using doc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not? I reuse res
as well
@@ -11,6 +11,7 @@ dependencies { | |||
implementation project(':client') | |||
|
|||
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.13.0' | |||
implementation 'com.google.code.gson:gson:2.10.1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the license ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apache-2
Anyway it is used for tests only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll align with you to use this google library instead of org.skyscreamer.jsonassert
for JSON equality test in my next PR then. We don't need 2 different lib for the same purpose.
* | ||
* @param client The client to execute the command. | ||
* @param key The key of the JSON document. | ||
* @return The array length stored at the root of the document. If document root is not an array, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamesx-improving are we including this signature? It doesn't seem useful to include a API signature that won't get used.
We should consider removing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which signature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this command, path
is indeed optional on all versions of documentations, hence it's hard to justify the removal of this signature (and the GlideString variant of it down below)
@@ -19,9 +19,11 @@ | |||
/** Module for JSON commands. */ | |||
public class Json { | |||
|
|||
public static final String JSON_PREFIX = "JSON."; | |||
private static final String JSON_PREFIX = "JSON."; | |||
public static final String JSON_SET = JSON_PREFIX + "SET"; | |||
public static final String JSON_GET = JSON_PREFIX + "GET"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change both GET
and SET
to private too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used somewhere in UT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry about it, I'll get it sort out in my next PR. But you do have a point, these don't need to be public.
java/client/src/main/java/glide/api/commands/servermodules/Json.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@@ -19,9 +19,11 @@ | |||
/** Module for JSON commands. */ | |||
public class Json { | |||
|
|||
public static final String JSON_PREFIX = "JSON."; | |||
private static final String JSON_PREFIX = "JSON."; | |||
public static final String JSON_SET = JSON_PREFIX + "SET"; | |||
public static final String JSON_GET = JSON_PREFIX + "GET"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry about it, I'll get it sort out in my next PR. But you do have a point, these don't need to be public.
@@ -11,6 +11,7 @@ dependencies { | |||
implementation project(':client') | |||
|
|||
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.13.0' | |||
implementation 'com.google.code.gson:gson:2.10.1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll align with you to use this google library instead of org.skyscreamer.jsonassert
for JSON equality test in my next PR then. We don't need 2 different lib for the same purpose.
* | ||
* @param client The client to execute the command. | ||
* @param key The key of the JSON document. | ||
* @return The array length stored at the root of the document. If document root is not an array, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this command, path
is indeed optional on all versions of documentations, hence it's hard to justify the removal of this signature (and the GlideString variant of it down below)
* `JSON.ARRINSERT` and `JSON.ARRLEN` Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
* `JSON.ARRINSERT` and `JSON.ARRLEN` Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
* `JSON.ARRINSERT` and `JSON.ARRLEN` Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
* `JSON.ARRINSERT` and `JSON.ARRLEN` Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Issue link
#2430
Checklist
Before submitting the PR make sure the following are checked: