Abstract
GraphQL is a data query language and specification originally developed by Facebook. There are GraphQL runtimes on both — client-side and server-side in several languages that implement the GraphQL Specification. Basic client implementations in general-purpose languages like Java/Javascript mostly deal with GraphQL queries as strings; hence, the language’s underlying type system remains underutilized. More sophisticated client implementations provide Domain Specific Language (DSL) based on some input GraphQL schema (e.g., GitHub) to present increased type safety. However, the mismatches between data schemata and how programs use the data elements known as impedance mismatch make programs written with DSLs challenging to update. The language data types often do not match the corresponding GraphQL schema types. These problems make the creation, maintenance, and evolution of GraphQL clients difficult. Addressing these problems means a significant investment of programmers’ time since they would have to manually map each type in the GraphQL Schema to a corresponding type in the programming language. Not only is this process error-prone, but it might not even be feasible if the input schema is large. We address these issues by implementing a client that provides a custom DSL and automatically maps types from GraphQL schema to the corresponding types in the programs written using this DSL. As a result of both, we improve type-safety of GraphQL programs using our client and reduce the development effort on the user’s end. We accomplished this by using experimental Scala metaprogramming capabilities (macros). Using our client on GitHub’s GraphQL schema, it is possible to efficiently conduct studies such as vulnerability dependency analysis of software repositories.
Published Version
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have