Skip to content
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

GraphQL (Docs): Document the /admin/schema/validate endpoint #6814

Merged
merged 2 commits into from
Oct 30, 2020

Conversation

aaroncarey
Copy link
Contributor

@aaroncarey aaroncarey commented Oct 30, 2020

Added documentation for the schema validation endpoint, per #6250 and GRAPHQL-578.

Fixes GRAPHQL-780


This change is Reviewable

Docs Preview: Dgraph Preview

@github-actions github-actions bot added area/documentation Documentation related issues. area/graphql Issues related to GraphQL support on Dgraph. labels Oct 30, 2020
Copy link
Contributor

@abhimanyusinghgaur abhimanyusinghgaur left a comment

Choose a reason for hiding this comment

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

Suggested some minor wording changes and a few spelling mistakes.
:lgtm: after those are addressed.

Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @aaroncarey, @abhimanyusinghgaur, @bucanero, @danielmai, and @MichaelJCompton)


wiki/content/graphql/admin/index.md, line 348 at r1 (raw file):

defnition 

definition


wiki/content/graphql/admin/index.md, line 349 at r1 (raw file):

Quoted 4 lines of code…
You can validate a GraphQL schema before adding it to your database by sending
your schema defnition to the `/admin/schema/validate` endpoint, as in the
following HTTP request example:
Request header:
ssh > path: /admin/schema/validate > method: POST > content-type: application/json > ``` > Request body: > ``` Should we phrase it like this: ``` You can validate a GraphQL schema before adding it to your database by sending your schema definition in an HTTP POST request to the `/admin/schema/validate` endpoint, with the following body:
___
*[wiki/content/graphql/admin/index.md, line 356 at r1](https://reviewable.io/reviews/dgraph-io/dgraph/6814#-MKsHv9l7raSs4q7O4ct:-MKsHv9l7raSs4q7O4cu:b-xhq5wc) ([raw file](https://github.com/dgraph-io/dgraph/blob/a179e80d05cb1fac6e0c0e854f74cc2e7ac56951/wiki/content/graphql/admin/index.md#L356)):*
> ```
> content-type: application/json
> ```
This header is not required in the HTTP request. The input is just plain text.
The HTTP response is JSON.
___
*[wiki/content/graphql/admin/index.md, line 368 at r1](https://reviewable.io/reviews/dgraph-io/dgraph/6814#-MKsIm-D9PH_Vi3kk-5S:-MKsIm-D9PH_Vi3kk-5T:b-k00oht) ([raw file](https://github.com/dgraph-io/dgraph/blob/a179e80d05cb1fac6e0c0e854f74cc2e7ac56951/wiki/content/graphql/admin/index.md#L368)):*
> ```
> and
> ```
an


<!-- Sent from Reviewable.io -->

Copy link
Contributor

@abhimanyusinghgaur abhimanyusinghgaur left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @aaroncarey, @abhimanyusinghgaur, @bucanero, @danielmai, and @MichaelJCompton)

Incorporate feedback from Abhimanyu's review
Copy link
Contributor Author

@aaroncarey aaroncarey left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @abhimanyusinghgaur, @bucanero, @danielmai, and @MichaelJCompton)


wiki/content/graphql/admin/index.md, line 348 at r1 (raw file):

Previously, abhimanyusinghgaur (Abhimanyu Singh Gaur) wrote…
defnition 

definition

Done. Sorry that I missed that!


wiki/content/graphql/admin/index.md, line 349 at r1 (raw file):

Previously, abhimanyusinghgaur (Abhimanyu Singh Gaur) wrote…
You can validate a GraphQL schema before adding it to your database by sending
your schema defnition to the `/admin/schema/validate` endpoint, as in the
following HTTP request example:
Request header:
```ssh
path: /admin/schema/validate
method: POST
content-type: application/json

Request body:

Should we phrase it like this:

You can validate a GraphQL schema before adding it to your database by sending
your schema definition in an HTTP POST request to the `/admin/schema/validate` endpoint, with the following body:

Thanks for this suggestion! I picked up some of this phrasing, but I wanted to retain the word "example" and also provide the example header that includes the content-type, as including that in the sentence made it too long.


wiki/content/graphql/admin/index.md, line 356 at r1 (raw file):

Previously, abhimanyusinghgaur (Abhimanyu Singh Gaur) wrote…
content-type: application/json

This header is not required in the HTTP request. The input is just plain text.
The HTTP response is JSON.

Thanks for the clarification! Fixed.


wiki/content/graphql/admin/index.md, line 368 at r1 (raw file):

Previously, abhimanyusinghgaur (Abhimanyu Singh Gaur) wrote…
and

an

Done.

This endpoint returns a JSON response that indicates if the schema is valid or
not, and provides an error if isn't valid. In this case, the schema is valid,
so the JSON response includes the following message: `Schema is valid`.

Copy link
Contributor

Choose a reason for hiding this comment

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

if you want, we could also add a curl example, like:

curl -X POST localhost:8080/admin/schema/validate --data-binary '@schema.graphql'

Copy link
Contributor

@bucanero bucanero left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor Author

@aaroncarey aaroncarey left a comment

Choose a reason for hiding this comment

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

Thanks!

Reviewable status: 0 of 1 files reviewed, 5 unresolved discussions (waiting on @aaroncarey, @abhimanyusinghgaur, @danielmai, and @MichaelJCompton)

@aaroncarey aaroncarey merged commit adbe385 into master Oct 30, 2020
@aaroncarey aaroncarey deleted the graphql-validate-schema branch October 30, 2020 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Documentation related issues. area/graphql Issues related to GraphQL support on Dgraph.
Development

Successfully merging this pull request may close these issues.

3 participants