Skip to content
This repository has been archived by the owner on Feb 22, 2019. It is now read-only.

Add documentation for specification routes in SDK #297

Merged
merged 6 commits into from
Jun 15, 2017
Merged

Conversation

samniisan
Copy link
Contributor

@samniisan samniisan commented Jun 12, 2017

Introduces

  • Documentation for specifications CRUDL routes (get - search - scroll - update - delete - validate)

Document following Pull Requests:
kuzzleio/sdk-javascript#231
kuzzleio/sdk-php#77
kuzzleio/sdk-android#135

@samniisan samniisan self-assigned this Jun 12, 2017
// Deleting one document
kuzzle
.collection("collection", "index")
.deleteSpecifications("document unique ID", new ResponseListener<JSONObject>() {
Copy link
Contributor

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.

Copy link
Contributor

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) {
Copy link
Contributor

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
Copy link
Contributor

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)

Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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>() {
Copy link
Contributor

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>() {
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-which

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixed

@scottinet scottinet merged commit c6f2650 into rc.x Jun 15, 2017
@scottinet scottinet deleted the 3-data-validation branch June 15, 2017 08:39
@scottinet scottinet mentioned this pull request Jun 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants