-
Notifications
You must be signed in to change notification settings - Fork 128
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
Add degraphql entity support #1346
Comments
The KIC team recently added generic support using The important part is: apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
namespace: default
name: degraphql-example
plugin: degraphql
config:
graphql_server_path: /v1/graphql
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongCustomEntity
metadata:
namespace: default
name: degraphql-route-example
spec:
type: degraphql_routes
fields:
uri: "/contacts"
query: "query{ contacts { name } }"
controllerName: kong
parentRef:
group: "configuration.konghq.com"
kind: "KongPlugin"
name: "degraphql-example" The This would translate to something similar to the following in deck: plugin_entities:
- plugin: my-degraphql-plugin
entity: degraphql_routes
fields:
uri: "/contacts"
query: "query{ contacts { name } }"
- plugin: my-degraphql-plugin
entity: degraphql_routes
fields:
uri: "/bookings"
query: "query{ bookings { id, cost } }"
- plugin: different-plugin
entity: some-plugin-entity
fields:
foo: bar |
Building this in an generic way is a lot of effort in DB-backed modes (months). Let's pivot to supporting |
@mheap I have chosen the following yaml format for degraphql-routes (and other subsequent custom entities): It is similar to what you had suggested above with minor changes -
For example, for degraphql-plugin this would look like
Let me know if any changes are necessary here. As of now, I am ensuring that most of the operations happen in a generic way so that expanding for other entities is easier. I will push a branch for the same soon. POC is complete and I am working on code-improvements and tests. Prior to that, if you have any suggestions for file inputs, I can add those in the code. |
LGTM. Is |
Hey team, Quick heads-up, speaking of degraphQL properties, It is probably important to highlight that degraphQL plugin manage more complex GQL queries than query SearchPosts($filters: PostsFilters) {
posts(filter: $filters) {
id
title
author
}
} In these scenarios, Some folks are using this properly to tell degraphQL plugin to handle ExamplePlugin config: curl -X POST https://admin.api.local/services/foo/degraphql/routes \
--data uri='/search/posts' \
--data methods='POST' \ # ⬅️
--data query='query SearchPosts($filters: PostsFilters) {
posts(filter: $filters) {
id
title
author
}
}' Usage: curl --request POST \
--url https://api.local/foo/search/posts \
--header 'Content-Type: application/json' \
--data '{ date: { between: { min: "2025-01-01", max: "2025-02-01" } } }'
curl --request POST \
--url https://api.local/foo/search/posts \
--header 'Content-Type: application/json' \
--data '{
"id": {
"in": [
"7cf342f2",
"9860193d",
"63498e1a"
]
}
}' By the way, method is an array / table and can be either or both plugin_entities:
- type: degraphql_routes
plugin: my-degraphql-plugin
fields:
uri: "/search/posts"
methods:
- "POST"
query: |
query SearchPosts($filters: PostsFilters) {
posts(filter: $filters) {
id
title
author
}
}
service: "<id>" # service id, TBC |
Update: |
Add support for configuring
degraphql
entities using Deck.https://docs.konghq.com/hub/kong-inc/degraphql/#3-configure-degraphql-routes-on-the-service
This may require changes in
go-database-reconciler
tooThe text was updated successfully, but these errors were encountered: