-
Notifications
You must be signed in to change notification settings - Fork 2
Add documentation for specification routes in SDK #297
Conversation
// Deleting one document | ||
kuzzle | ||
.collection("collection", "index") | ||
.deleteSpecifications("document unique ID", new ResponseListener<JSONObject>() { |
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.
Document unique ID is not part of this function's prototype.
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.
Also, since this method resolves to an array, the listener should not take a JSONObject
but an array-like argument.
I don't know the type of the returned array, though, since this API call seems to always resolve to an empty array, which seems bad design to me.
.collection("collection", "index") | ||
.deleteSpecifications("document unique ID", new ResponseListener<JSONObject>() { | ||
@Override | ||
public void onSuccess(JSONObject 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.
Same here: this should not resolve to a JSONObject
object
|
||
--- | ||
|
||
## Callback response |
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 be > Callback response
instead and directly after the PHP code example, to make this response example appear in the same panel, and below the code examples (see http://docs.kuzzle.io/v/edge/sdk-reference/collection/mcreate-document/ for a documentation example)
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.
Also this callback example seems off compared to the JS code example, which states that the returned object has a hits
array and a total
integer.
Which one is correct?
|
||
--- | ||
|
||
## Callback response |
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 be > Callback response
instead and directly after the PHP code example, to make this response example appear in the same panel, and below the code examples (see http://docs.kuzzle.io/v/edge/sdk-reference/collection/mcreate-document/ for a documentation example)
|
||
--- | ||
|
||
## Callback response |
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 be > Callback response
instead and directly after the PHP code example, to make this response example appear in the same panel, and below the code examples (see http://docs.kuzzle.io/v/edge/sdk-reference/collection/mcreate-document/ for a documentation example)
|
||
--- | ||
|
||
## Callback response |
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 be > Callback response
instead and directly after the PHP code example, to make this response example appear in the same panel, and below the code examples (see http://docs.kuzzle.io/v/edge/sdk-reference/collection/mcreate-document/ for a documentation example)
// Using callbacks (NodeJS or Web Browser) | ||
kuzzle | ||
.collection('collection', 'index') | ||
.updateSpecifications({specification: 'content'}, function (err, 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.
This example (and the others below) is misleading: according to it, the content part of the specifications is a string. I believe it should be an object instead?
Maybe this should be changed to a more practical example and maybe a link to the specifications documentation could be added to this method description?
// Using callbacks (NodeJS or Web Browser) | ||
kuzzle | ||
.collection('collection', 'index') | ||
.validateSpecifications({specification: 'content'}, function (err, isValid) { |
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.
Same as for updateSpecifications
: the code example should use a practical specification content instead of a misleading string value
|
||
kuzzle | ||
.collection("collection", "index") | ||
.searchSpecifications(filters, options, new ResponseListener<JSONObject>() { |
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.
As seen in the corresponding SDK PRs, this method now resolves to a SearchResult/KuzzleSearchResult object
|
||
kuzzle | ||
.collection("collection", "index") | ||
.scrollSpecifications(scrollId, opts, new ResponseListener<JSONObject>() { |
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.
As seen in the corresponding SDK PRs, this method now resolves to a SearchResult/KuzzleSearchResult object
} | ||
``` | ||
|
||
Deletes the validation specification set for the <index>/<collection>. | ||
It responds 200 even there where no validation specification manually set before. | ||
|
||
***Note:*** by default, an empty specification is implicitally applied to all collections which. In a way, "no specification set" means "all documents are valid". This is why, using this route when no specifications have been set before, does not produce an error. | ||
***Note:*** by default, an empty specification is implicitly applied to all collections which. In a way, "no specification set" means "all documents are valid". This is why, using this route when no specifications have been set before, does not produce an error. |
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
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.
Good catch, fixed
Introduces
Document following Pull Requests:
kuzzleio/sdk-javascript#231
kuzzleio/sdk-php#77
kuzzleio/sdk-android#135