You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "spacewander (via GitHub)" <gi...@apache.org> on 2023/02/28 06:55:37 UTC
[GitHub] [apisix] spacewander opened a new pull request, #8959: feat: add degraphql plugin
spacewander opened a new pull request, #8959:
URL: https://github.com/apache/apisix/pull/8959
Thanks for @tzssangglass to provide the inital implementation.
Signed-off-by: spacewander <sp...@gmail.com>
### Description
<!-- Please include a summary of the change and which issue is fixed. -->
<!-- Please also include relevant motivation and context. -->
Fixes #8787
### Checklist
- [ ] I have explained the need for this PR and the problem it solves
- [x] I have explained the changes or the new features added to this PR
- [x] I have added tests corresponding to this change
- [x] I have updated the documentation to reflect this change
- [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
<!--
Note
1. Mark the PR as draft until it's ready to be reviewed.
2. Always add/update tests for any changes unless you have a good reason.
3. Always update the documentation to reflect the changes made in the PR.
4. Make a new commit to resolve conversations instead of `push -f`.
5. To resolve merge conflicts, merge master instead of rebasing.
6. Use "request review" to notify the reviewer after making changes.
7. Only a reviewer can mark a conversation as resolved.
-->
--
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] bzp2010 commented on a diff in pull request #8959: feat: add degraphql plugin
Posted by "bzp2010 (via GitHub)" <gi...@apache.org>.
bzp2010 commented on code in PR #8959:
URL: https://github.com/apache/apisix/pull/8959#discussion_r1121018435
##########
apisix/plugins/degraphql.lua:
##########
@@ -0,0 +1,160 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local gq_parse = require("graphql").parse
+local req_set_body_data = ngx.req.set_body_data
+local ipairs = ipairs
+local pcall = pcall
+local type = type
+
+
+local schema = {
+ type = "object",
+ properties = {
+ query = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024,
+ },
+ variables = {
+ type = "array",
+ items = {
+ type = "string"
+ },
+ minItems = 1,
+ },
+ operation_name = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024
+ },
+ },
+ required = {"query"},
+}
+
+local plugin_name = "degraphql"
Review Comment:
I have a small question, should we call it `graphql-transcode` according to the `grpc` class plugin specification (`rest2grpc` => `grpc-transcode`) 🤔
--
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 commented on a diff in pull request #8959: feat: add degraphql plugin
Posted by "spacewander (via GitHub)" <gi...@apache.org>.
spacewander commented on code in PR #8959:
URL: https://github.com/apache/apisix/pull/8959#discussion_r1121021341
##########
apisix/plugins/degraphql.lua:
##########
@@ -0,0 +1,160 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local gq_parse = require("graphql").parse
+local req_set_body_data = ngx.req.set_body_data
+local ipairs = ipairs
+local pcall = pcall
+local type = type
+
+
+local schema = {
+ type = "object",
+ properties = {
+ query = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024,
+ },
+ variables = {
+ type = "array",
+ items = {
+ type = "string"
+ },
+ minItems = 1,
+ },
+ operation_name = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024
+ },
+ },
+ required = {"query"},
+}
+
+local plugin_name = "degraphql"
Review Comment:
We borrow the name degraphql from Kong. What do you think about it, @juzhiyuan?
--
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 #8959: feat: add degraphql plugin
Posted by "spacewander (via GitHub)" <gi...@apache.org>.
spacewander merged PR #8959:
URL: https://github.com/apache/apisix/pull/8959
--
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 diff in pull request #8959: feat: add degraphql plugin
Posted by "juzhiyuan (via GitHub)" <gi...@apache.org>.
juzhiyuan commented on code in PR #8959:
URL: https://github.com/apache/apisix/pull/8959#discussion_r1121057993
##########
apisix/plugins/degraphql.lua:
##########
@@ -0,0 +1,160 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local gq_parse = require("graphql").parse
+local req_set_body_data = ngx.req.set_body_data
+local ipairs = ipairs
+local pcall = pcall
+local type = type
+
+
+local schema = {
+ type = "object",
+ properties = {
+ query = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024,
+ },
+ variables = {
+ type = "array",
+ items = {
+ type = "string"
+ },
+ minItems = 1,
+ },
+ operation_name = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024
+ },
+ },
+ required = {"query"},
+}
+
+local plugin_name = "degraphql"
Review Comment:
From my understanding, `de` means `decode`, so `degraphql` means `decode GraphQL`. I think this name works because it does not belong to Kong only :)
--
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 commented on a diff in pull request #8959: feat: add degraphql plugin
Posted by "spacewander (via GitHub)" <gi...@apache.org>.
spacewander commented on code in PR #8959:
URL: https://github.com/apache/apisix/pull/8959#discussion_r1121077303
##########
apisix/plugins/degraphql.lua:
##########
@@ -0,0 +1,160 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local gq_parse = require("graphql").parse
+local req_set_body_data = ngx.req.set_body_data
+local ipairs = ipairs
+local pcall = pcall
+local type = type
+
+
+local schema = {
+ type = "object",
+ properties = {
+ query = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024,
+ },
+ variables = {
+ type = "array",
+ items = {
+ type = "string"
+ },
+ minItems = 1,
+ },
+ operation_name = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024
+ },
+ },
+ required = {"query"},
+}
+
+local plugin_name = "degraphql"
Review Comment:
IMHO, it would be better to keep the original name, so we don't need to modify this PR and other things which are not public.
--
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 diff in pull request #8959: feat: add degraphql plugin
Posted by "juzhiyuan (via GitHub)" <gi...@apache.org>.
juzhiyuan commented on code in PR #8959:
URL: https://github.com/apache/apisix/pull/8959#discussion_r1121057993
##########
apisix/plugins/degraphql.lua:
##########
@@ -0,0 +1,160 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local gq_parse = require("graphql").parse
+local req_set_body_data = ngx.req.set_body_data
+local ipairs = ipairs
+local pcall = pcall
+local type = type
+
+
+local schema = {
+ type = "object",
+ properties = {
+ query = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024,
+ },
+ variables = {
+ type = "array",
+ items = {
+ type = "string"
+ },
+ minItems = 1,
+ },
+ operation_name = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024
+ },
+ },
+ required = {"query"},
+}
+
+local plugin_name = "degraphql"
Review Comment:
From my understanding, `de` means `decode`, so `degraphql` means `decode GraphQL`. I think this name works because it does not belong to Kong only :)
Or `transcode-graphql`?
##########
apisix/plugins/degraphql.lua:
##########
@@ -0,0 +1,160 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local gq_parse = require("graphql").parse
+local req_set_body_data = ngx.req.set_body_data
+local ipairs = ipairs
+local pcall = pcall
+local type = type
+
+
+local schema = {
+ type = "object",
+ properties = {
+ query = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024,
+ },
+ variables = {
+ type = "array",
+ items = {
+ type = "string"
+ },
+ minItems = 1,
+ },
+ operation_name = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024
+ },
+ },
+ required = {"query"},
+}
+
+local plugin_name = "degraphql"
Review Comment:
From my understanding, `de` means `decode`, so `degraphql` means `decode GraphQL`. I think this name works because it does not belong to Kong only :)
Or `graphql-transcode`?
--
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 diff in pull request #8959: feat: add degraphql plugin
Posted by "juzhiyuan (via GitHub)" <gi...@apache.org>.
juzhiyuan commented on code in PR #8959:
URL: https://github.com/apache/apisix/pull/8959#discussion_r1121078343
##########
apisix/plugins/degraphql.lua:
##########
@@ -0,0 +1,160 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local gq_parse = require("graphql").parse
+local req_set_body_data = ngx.req.set_body_data
+local ipairs = ipairs
+local pcall = pcall
+local type = type
+
+
+local schema = {
+ type = "object",
+ properties = {
+ query = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024,
+ },
+ variables = {
+ type = "array",
+ items = {
+ type = "string"
+ },
+ minItems = 1,
+ },
+ operation_name = {
+ type = "string",
+ minLength = 1,
+ maxLength = 1024
+ },
+ },
+ required = {"query"},
+}
+
+local plugin_name = "degraphql"
Review Comment:
+1
--
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