Microprofile GraphQL Specification
Read the MicroProfile GraphQL 1.1.0 Specification
Use this in your project to depend on both the server and client API:
<dependency> <groupId>org.eclipse.microprofile.graphql</groupId> <artifactId>microprofile-graphql-api</artifactId> <version>1.0.3</version> </dependency>
GraphQL is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with existing data. It provides an alternative, though not necessarily a replacement for REST.
GraphQL was developed internally by Facebook in 2012 before being publicly released in 2015.
On 7 November 2018, the GraphQL project was moved from Facebook to the newly-established GraphQL foundation, hosted by the non-profit Linux Foundation. This is a significant milestone in terms of industry and community adoption. GraphQL is used by many large and small customers including Atlassian, Coursera, Facebook, GitHub, PayPal, Twitter, and many more.
The main reasons developers might want to use GraphQL are:
Improved data consumption for customers (IoS, Android, Web). Allowing for example to be able to retrieve several types of data in a single request or limiting the response data to exactly the specific data requested.
Better analysis of the exhaustiveness of data calls (allowing to know the use of each node) and better manage the deletion of deprecated fields.
Advanced developer experience:
The schema defines how the data can be accessed and serves as the contract between the client and the server. Developer teams on both sides can work without further communication,
Native schema introspection enabling to discover the API and to refine the queries on the client-side. This advantage is increased with graphical tools such as GraphiQL enabling smooth and easy API discovery,
On the client-side, the query language provides a lot of flexibility and efficiency enabling developers to adapt to the constraints of their technical environments (IoS, Android, Web).
The official purpose of MicroProfile is to optimize Enterprise Java for a microservices architecture and delivers application portability across multiple MicroProfile runtimes. GraphQL is already widely used in Microservices architectures as the API Endpoint. As noted in the Known java libraries section, there are several Java-based GraphQL libraries available, but none with the reach of the MicroProfile community. GraphQL continues to grow in popularity, and as such there should be a specification for GraphQL development in Java. MicroProfile is the optimal place to host that standard as it is open, ideally suited for incubating technologies, and has broad reach both in terms of the user community and vendor support.
What GraphQL is not
This specification will focus on making it easy for developers to create a GraphQL Service/Endpoint and publish it as an API. Where the data comes from (NoSQL, Relational DB, another service, etc.) is not the concern of this Proposed Specification.
SmallRye GraphQL - https://github.com/smallrye/smallrye-graphql (standalone implementation)
Open Liberty 184.108.40.206 - https://openliberty.io/blog/2020/06/05/graphql-open-liberty-20006.html
Quarkus 1.5 - https://quarkus.io/blog/quarkus-1-5-final-released/
This API and specification would not be possible without the enormous assistance from the GraphQL SPQR project.
Do you want to contribute to this project? Find out how you can help here.