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
Support for graphql #3184
Comments
+1 |
6 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
👍 |
Hi @YannickB, Thanks for bringing this up. We would like to add this to our roadmap. I haven't used GraphQL much and hence having some trouble understanding the exact scope of the requirement. For some clarity, could you explain the exact limitations of the current functionality using an example maybe? Basically what is exposed through the Apollo server and how would you have to expose this through the API Gateway today vs what would have been the ideal way of exposing it through the API Gateway. Thanks, |
+1 |
Hi @nuwand, First as disclaimer, even if I opened the ticket I'm not sure I am the best person to describe how the feature should work. Think of me as someone studying to build a really good software architecture, so including stuff like GraphQL and API Gateway, and as I was studying this I became obvious to me that no API Gateways on the market today was designed to fully support GraphQL. Hence I have no real use case in production as of yet, but I'll do my best to help. I agree the best way to explain will be an example so here it is : Let's say you have an API providing CRUD functions for two objects, product and invoice. With a Rest API, you'd have two endpoints to use, http://myapi.com/api/product and http://myapi.com/api/invoice, and you then do GET/POST/PUT/DELETE operations on them. But if we are providing a GraphQL API we are currently much much more limited. This is due to the fact both objects will be accessible in the same endpoint http://myapi.com/graphql. And there is no way to create several endpoints http://myapi.com/graphql/product and http://myapi.com/graphql/invoice, this is completely anti-pattern with the best practices of GraphQL and will make most the tools in its ecosystem to stop working. Moreover, I believe all HTTP operations are POST. So as example, we may want to do theses requests on the GraphQL endpoint :
The first request will query the informations of the specified product, and the second will create an invoice for this product. Both queries are executed on http://myapi.com/graphql endpoint. So with current state of WSO2 Gateway, which if I'm not wrong only allow to configure per endpoint, if I want for example to monetize at 0.01cent each call to createInvoice by configuring the http://myapi.com/graphql endpoint, then the call to product will also be monetized at 0.01cent. With REST, you'd just configure the 0.01cent to the http://myapi.com/api/invoice on POST and that would be all. So the solution IMHO is allowing to attach WSO2 configuration not only to endpoint, but to GraphQL functions as well. This may prove to be a technical challenge I think, but there is definitely a need for this in the market because currently GraphQL just does not work with API Gateways, or in a very degraded way. It seems this suggestion attracted quite some attention. To people following this issue, I invite you to give some informations about your use case and how WSO2 should design this feature. I hope I did my best to describe the situation, but I believe they'll need some real example to properly implement this. Best regards, |
As temporary solution it would be great to have at least possibility to import in WSO2-AM graphql endpoints, in order to use it as Service Directory while waiting for a full support into the API Gateway |
Hi @YannickB, Thanks for you explanation. Forgive me, but I'm still trying to figure out the limitations with the endpoints. Let me explain the capability API Manager has with regard to endpoints and then maybe you can pin point the limitation. Assume you have two endpoints as http://myapi.com/api/invoice and http://myapi.com/api/product. Note that I'm using the same example as you did, on which both endpoints seem to be on the same host (myapi.com). If your requirement is to have a single API on API Manager to proxy both endpoints, what you have to do is to create two resources, one as POST /invoice and the other as POST /product and specify http://myapi.com/api/ as the endpoint of the respective API. This will enable you to access both endpoints above using a single API. For example, if your gateway host is gateway.myapi.com and the context of the API you create is /graphql and its version is 1.0.0, the following requests would proxy each to the appropriate endpoint as below. POST http://gateway.myqpi.com/graphql/1.0.0/invoice -> POST http://myqpi.com/api/invoice Note that you only have to create 1 API (/graphql/1.0.0) to proxy both endpoints. I'm sorry if I'm repeating something you already know :), but if you could pin point the limitation on our resource to mapping that makes it impossible to use GraphQL that would help me to understand the problem better. Thanks, |
nuwand, i'm less technical than you. But in my understanding with an APIM / Identity server we define on API Level the management of an API (security, throttling, ... ..) . GraphQL is a kind of 'super' language combining API's via a 'meta' language . What would be of interest of me is to understand how the concepts of GraphQL and the concepts of a WS02 APIM is matched. and if both concepts will be integrated. Offcourse you can consider the GraphQL als 1 resource which itself manage everything .... but than the value of WS02 is limited if all my 'legacy'services will be accessible via the graphql server. |
+1 |
With GraphQL, there really is only a single endpoint, so there is no such thing as myapi.com/graphql/invoice and graphql/product, the endoint is just "myapi.com/graphql", and nothing after that. It is literally the same URL for each query and mutation, with the operations defined inside the body of the request. Some api management features then would require introspection of the request body, knowledge of the graphql schema, etc. Let's assume that this is not feasible on a short term: WSO2 should almost become a GraphQL server/gateway in itself (or integrate one). Instead, we should focus on what API management features are possible. I guess we need co-operation between WSO2 and the actual GraphQL server/gateway, e.g. by setting headers. For example monetization: the GraphQL server can compute the complexity of the query, add this information as a HTTP header to the response, where WSO2 translates this value into a price. Similarly for monitoring, the GraphQL server can 'convert' the JSON-shaped query into (a list of) rest-like pseudo-endpoint(s), which WSO2 reads from the response header to update the monitoring information. The same thing can be done for security, maybe in 2 phases: 1st ask the GraphQL server to convert the query into rest-like endpoints, WSO2 decides to pass or not, forwarding the query to the actual endpoint. I'm completely new to WSO2 and haven't read most of the documentation, so maybe these features are already in WSO2 (more specifically: for any functionality of WSO2 that is usually derived from the exact REST endpoint URI, whether that same functionality can be derived in a alternative way (e.g. a header value or some other API to WSO2 itself)). It is likely that a GraphQL server needs to be modified to support these WSO2-specific features. The question is: what low hanging fruit can we start with? (Of course I would like to see WSO2 make a big commitment into GraphQL... but we need to start somehwere, right?) |
Great feedback , i feel the same ;)
Op di 6 nov. 2018 om 12:06 schreef fourth44 <notifications@github.com>:
… With GraphQL, there really is only a single endpoint, so there is no such
thing as myapi.com/graphql/invoice and graphql/product, the endoint is
just "myapi.com/graphql", and nothing after that. It is literally the
same URL for each query and mutation, with the operations defined inside
the body of the request.
Some api management features then would require introspection of the
request body, knowledge of the graphql schema, etc. Let's assume that this
is *not* feasible on a short term: WSO2 should almost become a GraphQL
server/gateway in itself (or integrate one).
Instead, we should focus on what API management features *are* possible.
I guess we need co-operation between WSO2 and the actual GraphQL
server/gateway, e.g. by setting headers. For example monetization: the
GraphQL server can compute the complexity of the query, add this
information as a HTTP header to the response, where WSO2 translates this
value into a price. Similarly for monitoring, the GraphQL server can
'convert' the JSON-shaped query into (a list of) rest-like
pseudo-endpoint(s), which WSO2 reads from the response header to update the
monitoring information. The same thing can be done for security, maybe in 2
phases: 1st ask the GraphQL server to convert the query into rest-like
endpoints, WSO2 decides to pass or not, forwarding the query to the actual
endpoint.
I'm completely new to WSO2 and haven't read most of the documentation, so
maybe these features are already in WSO2 (more specifically: for any
functionality of WSO2 that is usually derived from the exact REST endpoint
URI, whether that same functionality can be derived in a alternative way
(e.g. a header value or some other API to WSO2 itself)). It is likely that
a GraphQL server needs to be modified to support these WSO2-specific
features. The question is: what low hanging fruit can we start with?
(Of course I would like to see WSO2 make a big commitment into GraphQL...
but we need to start somehwere, right?)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3184 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Ad4tuNmWvNcpkc1Nk5y46DljcQeM9RPwks5usW0kgaJpZM4TLf2Q>
.
--
Bart Van Vlierberghe
|
Hello, |
Looks great |
@wasuradananjith can you also post how a GraphQL API looks like in the store ? Is querying available in the API Portal, probably with the schema ? |
At least Apollo supports using GET for the GraphQL data request. |
Hi all, Please find the information and PR of Graphql support related to the WSO2 APIM 3.0.0 release. Since we are going to release WSO2 APIM 3.0.0 under a new React-based UI, screenshots of new UI have been added in follows. API publisher Functionalities at the publisher.
API Store Functionalities at the store.
Screenshots of views
Invocation time of Graphql API
PR will be found at wso2/carbon-apimgt#6784.
Appreciate your thoughts and valuable inputs regarding this. Thanks! |
Hi @HiranyaKavishani , Also is there any Beta/Alpha Release to test out the feature ? Thanks ! |
Hi @arvindkannan, For the existing Graphql APIs, it is needed to recreate the APIs and republish since the graphql has different support when it compared to the rest APIs. But If do so, it should need to make sure that existing tokens and existing URLs are not going to change with this as it will be affected to existing customers. The feature will available with APIM 3.0.0 which will be going to release in October. Thanks! |
Close the issue as this support available in APIM 3.0.0 Beta version |
Hello all,
I'd like to know if any strong support for GraphQL APIs is planned for the future of WSO2 ? GraphQL has an ever growing adoption among API developer with strong arguments against REST.
There is a lot of great tools for GraphQL today, but imho the big bottleneck for massive adoption is the very poor support by API gateways today.
Of course it still works. A GraphQL endpoint is REST compliant, you just have to create a REST endpoint on WSO2 APIM. But today this is far for optimum and by design you can't use correctly most of WSO2 APIM features.
The reason is, you usually have the whole schema of your API cluster in a single endpoint. Even if you have dozens of microservices serving their own GraphQL APIs, the good practice is to aggregate them through an API router like Apollo tools https://www.apollographql.com/docs/graphql-tools/schema-stitching.html.
Because of this, we can't properly use throttling and monetization features in WSO2, which are configured by endpoint but in GraphQL we want to be able to configure them by GraphQL functions. Configuring an GraphQL endpoint today defeat most of the usefulness of an API gateway, except maybe for the anti-DDOS needs.
I'd love to be able to create my GraphQL microservices, aggregate them with an Apollo server and properly securing, monetize and monitor with WSO2 gateway. I understand this is a lot of work, but today the support for GraphQL APIs among API gateways is so poor that I hope this can be a strong competitive advantage for WSO2 and a big opportunity. Even for analytics, today there is no open-source analytics for GraphQL, the only analytics I can think is apollo Optics and it's closed-source.
Thanks for listening to my point, I'm looking forward to know more about your roadmap if this is something planned.
Best regards,
The text was updated successfully, but these errors were encountered: