-
Notifications
You must be signed in to change notification settings - Fork 53
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.OBJLEN
and JSON.OBJKEYS
.
#2492
Conversation
Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
java/client/src/main/java/glide/api/commands/servermodules/Json.java
Outdated
Show resolved
Hide resolved
* assert Arrays.equals((Object[]) res, new Object[][] { { "a", "b", "c" } }); // key names as a nested list for objects matching the JSONPath `$.b`. | ||
* }</pre> | ||
*/ | ||
public static CompletableFuture<Object[]> objkeys( |
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.
objkeys returns an array is all cases? well at least one of the commands acts decently.
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.
Object[][]
for JSONPath and Object[]
for legacy path. So common denominator is Object[]
.
assertEquals(2L, res); | ||
res = Json.objlen(client, gs(key)).get(); | ||
assertEquals(2L, res); | ||
} |
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.
should we test when the path doesn't exist, or the path is not an array, or the key is not JSON?
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.
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.
Maybe. I don't want to start testing module instead of client.
res = Json.objkeys(client, key).get(); | ||
assertArrayEquals(new Object[] {"a", "b"}, res); | ||
res = Json.objkeys(client, gs(key)).get(); | ||
assertArrayEquals(new Object[] {gs("a"), gs("b")}, res); |
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.
should we test when the path doesn't exist, or the path is not an array, or the key is not JSON?
…alkey-449 Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
* `JSON.OBJLEN` and `JSON.OBJKEYS`. Signed-off-by: Yury-Fridlyand <[email protected]> --------- Signed-off-by: Yury-Fridlyand <[email protected]>
* `JSON.OBJLEN` and `JSON.OBJKEYS`. Signed-off-by: Yury-Fridlyand <[email protected]> --------- Signed-off-by: Yury-Fridlyand <[email protected]> Signed-off-by: BoazBD <[email protected]>
Issue link
#2430
Checklist
Before submitting the PR make sure the following are checked: