You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/02/25 07:59:36 UTC

[GitHub] [apisix] Chever-John opened a new pull request #6449: docs: add latest content about GraphQL in APISIX

Chever-John opened a new pull request #6449:
URL: https://github.com/apache/apisix/pull/6449


   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   
   ### Pre-submission checklist:
   
   <!--
   Please follow the PR manners:
   1. Use Draft if the PR is not ready to be reviewed
   2. Test is required for the feat/fix PR, unless you have a good reason
   3. Doc is required for the feat PR
   4. Use a new commit to resolve review instead of `push -f`
   5. If you need to resolve merge conflicts after the PR is reviewed, please merge master but do not rebase
   6. Use "request review" to notify the reviewer once you have resolved the review
   7. Only reviewer can click "Resolve conversation" to mark the reviewer's review resolved
   -->
   
   * [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   * [ ] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r818263812



##########
File path: docs/zh/latest/router-radixtree.md
##########
@@ -290,6 +292,36 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+我们可以通过以下两种方式分别去验证 GraphQL 匹配:
+
+1. 使用 GraphQL 查询字符串
+
+```shell
+$ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+query getRepo {
+    owner {
+        name
+    }
+    repo {
+        created
+    }
+}'
+```
+
+2. 使用 JSON 格式
+
+```shell
+$ curl -H 'content-type: application/json' -X POST \
+http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}'
+```
+
+3. 尝试 `GET` 请求
+
+```shell
+curl -H 'content-type: application/graphql' -X GET \
+"http://127.0.0.1:9080/graphql?query=query getRepo { owner {name } repo {created}}" -g
+```

Review comment:
       It is best to be consistent whether the shell adds $ or not.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Chever-John commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
Chever-John commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r814619522



##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,56 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. GraphQL query strings
+
+    ```shell
+    $ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+    query getRepo {
+        owner {
+            name
+        }
+        repo {
+            created
+        }
+    }'
+    ```

Review comment:
       OK




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] shuaijinchao commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
shuaijinchao commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r814618257



##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,56 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. GraphQL query strings
+
+    ```shell
+    $ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+    query getRepo {
+        owner {
+            name
+        }
+        repo {
+            created
+        }
+    }'
+    ```
+
+2. JSON format
+
+    ```shell
+    $ curl -H 'content-type: application/json' -X POST http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}'
+    ```

Review comment:
       ditto

##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,56 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. GraphQL query strings
+
+    ```shell
+    $ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+    query getRepo {
+        owner {
+            name
+        }
+        repo {
+            created
+        }
+    }'
+    ```

Review comment:
       Remove indentation, formatting needs to be consistent across the document.

##########
File path: docs/zh/latest/router-radixtree.md
##########
@@ -290,6 +292,56 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+我们可以通过以下两种方式分别去验证 GraphQL 匹配:
+
+1. 使用 GraphQL 查询字符串
+
+    ```shell
+    $ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+    query getRepo {
+        owner {
+            name
+        }
+        repo {
+            created
+        }
+    }'
+    ```

Review comment:
       ditto

##########
File path: docs/zh/latest/router-radixtree.md
##########
@@ -290,6 +292,56 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+我们可以通过以下两种方式分别去验证 GraphQL 匹配:
+
+1. 使用 GraphQL 查询字符串
+
+    ```shell
+    $ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+    query getRepo {
+        owner {
+            name
+        }
+        repo {
+            created
+        }
+    }'
+    ```
+
+2. 使用 JSON 格式
+
+    ```shell
+    $ curl -H 'content-type: application/json' -X POST http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}'
+    ```

Review comment:
       ditto




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] shuaijinchao commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
shuaijinchao commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r814631022



##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,56 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. GraphQL query strings
+
+    ```shell
+    $ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+    query getRepo {
+        owner {
+            name
+        }
+        repo {
+            created
+        }
+    }'
+    ```
+
+2. JSON format
+
+    ```shell
+    $ curl -H 'content-type: application/json' -X POST http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}'
+    ```
+
+Next, try a GET request.
+Let's first configure a route like this:
+
+```shell
+$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+    "methods": ["GET"],
+    "uri": "/_graphql",
+    "vars": [
+        ["graphql_operation", "==", "query"],
+        ["graphql_name", "==", "getRepo"],
+        ["graphql_root_fields", "has", "owner"]
+    ],
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "39.97.63.215:4000": 1
+        }
+    }
+}'
+```

Review comment:
       Why directly reuse the routing configuration of POST? You can add GET to the `methods` of your route configuration to support both GET and POST requests.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander merged pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #6449:
URL: https://github.com/apache/apisix/pull/6449


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Chever-John commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
Chever-John commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r816459963



##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,34 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. GraphQL query strings
+
+```shell
+$ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+query getRepo {
+    owner {
+        name
+    }
+    repo {
+        created
+    }
+}'
+```
+
+2. JSON format
+
+```shell
+$ curl -H 'content-type: application/json' -X POST http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}'
+```
+
+3. Try 'GET' request match

Review comment:
       Thanks for your review!
   It helps me a lot!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] leslie-tsang commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
leslie-tsang commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r814558899



##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,28 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. 使用 GraphQL 查询字符串

Review comment:
       Translation required.

##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,28 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. 使用 GraphQL 查询字符串
+
+    ```shell
+    $ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+    query getRepo {
+        owner {
+            name
+        }
+        repo {
+            created
+        }
+    }'
+    ```
+    
+2. 使用 JSON 格式

Review comment:
       Translation required.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Chever-John commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
Chever-John commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r814567213



##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,28 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. 使用 GraphQL 查询字符串
+
+    ```shell
+    $ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+    query getRepo {
+        owner {
+            name
+        }
+        repo {
+            created
+        }
+    }'
+    ```
+    
+2. 使用 JSON 格式

Review comment:
       Sry, it is all right now. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Chever-John commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
Chever-John commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r814566967



##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,28 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. 使用 GraphQL 查询字符串

Review comment:
       Oh, sry.
   now it is all right.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Chever-John commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
Chever-John commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r814634979



##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,56 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. GraphQL query strings
+
+    ```shell
+    $ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+    query getRepo {
+        owner {
+            name
+        }
+        repo {
+            created
+        }
+    }'
+    ```
+
+2. JSON format
+
+    ```shell
+    $ curl -H 'content-type: application/json' -X POST http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}'
+    ```
+
+Next, try a GET request.
+Let's first configure a route like this:
+
+```shell
+$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+    "methods": ["GET"],
+    "uri": "/_graphql",
+    "vars": [
+        ["graphql_operation", "==", "query"],
+        ["graphql_name", "==", "getRepo"],
+        ["graphql_root_fields", "has", "owner"]
+    ],
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "39.97.63.215:4000": 1
+        }
+    }
+}'
+```

Review comment:
       It can be done as you say, let me try it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] hf400159 commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
hf400159 commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r817433429



##########
File path: docs/zh/latest/router-radixtree.md
##########
@@ -290,6 +292,34 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+我们可以通过以下两种方式分别去验证 GraphQL 匹配:
+
+1. 使用 GraphQL 查询字符串
+
+```shell
+$ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '

Review comment:
       ```suggestion
   curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
   ```

##########
File path: docs/zh/latest/router-radixtree.md
##########
@@ -274,7 +276,7 @@ query getRepo {
 ```shell
 $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '

Review comment:
       ```suggestion
   curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   ```

##########
File path: docs/zh/latest/router-radixtree.md
##########
@@ -290,6 +292,34 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+我们可以通过以下两种方式分别去验证 GraphQL 匹配:
+
+1. 使用 GraphQL 查询字符串
+
+```shell
+$ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+query getRepo {
+    owner {
+        name
+    }
+    repo {
+        created
+    }
+}'
+```
+
+2. 使用 JSON 格式
+
+```shell
+$ curl -H 'content-type: application/json' -X POST http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}'

Review comment:
       ```suggestion
   curl -H 'content-type: application/json' -X POST http://127.0.0.1:9080/graphql \
   --data '{"query": "query getRepo { owner {name } repo {created}}"}'
   ```

##########
File path: docs/zh/latest/router-radixtree.md
##########
@@ -290,6 +292,34 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+我们可以通过以下两种方式分别去验证 GraphQL 匹配:
+
+1. 使用 GraphQL 查询字符串
+
+```shell
+$ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+query getRepo {
+    owner {
+        name
+    }
+    repo {
+        created
+    }
+}'
+```
+
+2. 使用 JSON 格式
+
+```shell
+$ curl -H 'content-type: application/json' -X POST http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}'
+```
+
+3. 尝试 `GET` 请求
+
+```shell
+curl -H 'content-type: application/graphql' -X GET "http://127.0.0.1:9080/graphql?query=query getRepo { owner {name } repo {created}}" -g

Review comment:
       ```suggestion
   curl -H 'content-type: application/graphql' -X \
   GET "http://127.0.0.1:9080/graphql?query=query getRepo { owner {name } repo {created}}" -g
   ```

##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,34 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. GraphQL query strings
+
+```shell
+$ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '

Review comment:
       Please refer to en modification




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] juzhiyuan commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r816452897



##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,34 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. GraphQL query strings
+
+```shell
+$ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+query getRepo {
+    owner {
+        name
+    }
+    repo {
+        created
+    }
+}'
+```
+
+2. JSON format
+
+```shell
+$ curl -H 'content-type: application/json' -X POST http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}'
+```
+
+3. Try 'GET' request match

Review comment:
       ```suggestion
   3. Try `GET` request match
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Chever-John commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
Chever-John commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r818265208



##########
File path: docs/zh/latest/router-radixtree.md
##########
@@ -290,6 +292,36 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+我们可以通过以下两种方式分别去验证 GraphQL 匹配:
+
+1. 使用 GraphQL 查询字符串
+
+```shell
+$ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+query getRepo {
+    owner {
+        name
+    }
+    repo {
+        created
+    }
+}'
+```
+
+2. 使用 JSON 格式
+
+```shell
+$ curl -H 'content-type: application/json' -X POST \
+http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}'
+```
+
+3. 尝试 `GET` 请求
+
+```shell
+curl -H 'content-type: application/graphql' -X GET \
+"http://127.0.0.1:9080/graphql?query=query getRepo { owner {name } repo {created}}" -g
+```

Review comment:
       You are right.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Chever-John commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
Chever-John commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r815535032



##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -289,6 +291,56 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+We can verify GraphQL matches in the following two ways:
+
+1. GraphQL query strings
+
+    ```shell
+    $ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+    query getRepo {
+        owner {
+            name
+        }
+        repo {
+            created
+        }
+    }'
+    ```
+
+2. JSON format
+
+    ```shell
+    $ curl -H 'content-type: application/json' -X POST http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}'
+    ```
+
+Next, try a GET request.
+Let's first configure a route like this:
+
+```shell
+$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+    "methods": ["GET"],
+    "uri": "/_graphql",
+    "vars": [
+        ["graphql_operation", "==", "query"],
+        ["graphql_name", "==", "getRepo"],
+        ["graphql_root_fields", "has", "owner"]
+    ],
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "39.97.63.215:4000": 1
+        }
+    }
+}'
+```

Review comment:
       Finished it! 
   Thanks for a review @shuaijinchao 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] juzhiyuan commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r817425942



##########
File path: docs/zh/latest/router-radixtree.md
##########
@@ -246,6 +246,8 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 
 ### 如何通过 GraphQL 属性过滤路由
 
+目前为止,APISIX 可以处理 HTTP GET 和 POST 方法。同时请求体正文可以是 GraphQL 查询字符串,也可以是 JSON 格式的内容。

Review comment:
       ```suggestion
   目前,APISIX 可以处理 HTTP GET 和 POST 方法。请求体正文可以是 GraphQL 查询字符串,也可以是 JSON 格式的内容。
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Chever-John commented on a change in pull request #6449: docs: add latest content about GraphQL in APISIX

Posted by GitBox <gi...@apache.org>.
Chever-John commented on a change in pull request #6449:
URL: https://github.com/apache/apisix/pull/6449#discussion_r814621554



##########
File path: docs/zh/latest/router-radixtree.md
##########
@@ -290,6 +292,56 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
+我们可以通过以下两种方式分别去验证 GraphQL 匹配:
+
+1. 使用 GraphQL 查询字符串
+
+    ```shell
+    $ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d '
+    query getRepo {
+        owner {
+            name
+        }
+        repo {
+            created
+        }
+    }'
+    ```
+
+2. 使用 JSON 格式
+
+    ```shell
+    $ curl -H 'content-type: application/json' -X POST http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}'
+    ```

Review comment:
       Solve it!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org