Skip to main content
Erschienen in:
Buchtitelbild

2019 | OriginalPaper | Buchkapitel

An Empirical Study of GraphQL Schemas

verfasst von : Erik Wittern, Alan Cha, James C. Davis, Guillaume Baudart, Louis Mandel

Erschienen in: Service-Oriented Computing

Verlag: Springer International Publishing

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

GraphQL is a query language for APIs and a runtime to execute queries. Using GraphQL queries, clients define precisely what data they wish to retrieve or mutate on a server, leading to fewer round trips and reduced response sizes. Although interest in GraphQL is on the rise, with increasing adoption at major organizations, little is known about what GraphQL interfaces look like in practice. This lack of knowledge makes it hard for providers to understand what practices promote idiomatic, easy-to-use APIs, and what pitfalls to avoid.
To address this gap, we study the design of GraphQL interfaces in practice by analyzing their schemas – the descriptions of their exposed data types and the possible operations on the underlying data. We base our study on two novel corpuses of GraphQL schemas, one of 16 commercial GraphQL schemas and the other of 8,399 GraphQL schemas mined from GitHub projects. We make available to other researchers those schemas mined from GitHub whose licenses permit redistribution. We also make available the scripts to mine the whole corpus. Using the two corpuses, we characterize the size of schemas and their use of GraphQL features and assess the use of both prescribed and organic naming conventions. We also report that a majority of APIs are susceptible to denial of service through complex queries, posing real security risks previously discussed only in theory. We also assess ways in which GraphQL APIs attempt to address these concerns.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Fußnoten
1
We anonymized the returned names.
 
2
We submitted a pull request adding several public GraphQL APIs that were missing from the APIs.guru list, but that we found using web searches. The APIs.guru maintainers accepted the pull request and we included those schemas in this analysis.
 
3
A complete schema (1) contains a query operation (a SchemaDefinition node [15] or a Query object type [8]), and (2) defines all referenced types and directives.
 
4
If multiple possible definitions were found, we broke ties under the assumption that developers will use the directory hierarchy to place related files close to each other.
 
5
We collected data in November 2018 using the same methodology, and found 5,345 unique schemas, 701 of which resulted from merging. This reflects a growth of \(57\%\) in half a year.
 
6
Subscriptions permit clients to register for continuous updates on data.
 
7
For simplicity, we tested for camelCase and PascalCase names using only the first letter. A more sophisticated dictionary-based analysis is a possible extension.
 
8
These conventions are “organic” in the sense that they are emerging naturally without apparent central direction. There could, however, be some hidden form of direction, e.g. many projects influenced by the same team or corporation.
 
9
In practice, the size of retrieved object lists are often explicitly bounded by slicing arguments (e.g., first: 2 in Fig. 1). See also Sect. 4.4.
 
10
In Table 3, we use the slightly relaxed notion \(O(n \times D^K)\).
 
11
In GraphQL the first field is always query, and cannot be a list type.
 
Literatur
16.
Zurück zum Zitat Brito, G., Mombach, T., Valente, M.T.: Migrating to GraphQL: a practical assessment. In: 2019 IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER), pp. 140–150. IEEE (2019) Brito, G., Mombach, T., Valente, M.T.: Migrating to GraphQL: a practical assessment. In: 2019 IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER), pp. 140–150. IEEE (2019)
19.
Zurück zum Zitat Hartig, O., Pérez, J.: An initial analysis of Facebook’s GraphQL language. In: CEUR Workshop Proceedings (2017) Hartig, O., Pérez, J.: An initial analysis of Facebook’s GraphQL language. In: CEUR Workshop Proceedings (2017)
20.
Zurück zum Zitat Hartig, O., Pérez, J.: Semantics and complexity of GraphQL. In: Conference on World Wide Web (WWW) (2018) Hartig, O., Pérez, J.: Semantics and complexity of GraphQL. In: Conference on World Wide Web (WWW) (2018)
21.
Zurück zum Zitat Kim, Y.W., Consens, M.P., Hartig, O.: An empirical analysis of GraphQL API schemas in open code repositories and package registries. In: Proceedings of the 13th Alberto Mendelzon International Workshop on Foundations of Data Management (AMW), June 2019 Kim, Y.W., Consens, M.P., Hartig, O.: An empirical analysis of GraphQL API schemas in open code repositories and package registries. In: Proceedings of the 13th Alberto Mendelzon International Workshop on Foundations of Data Management (AMW), June 2019
22.
Zurück zum Zitat Palma, F., Gonzalez-Huerta, J., Moha, N., Guéhéneuc, Y.-G., Tremblay, G.: Are RESTful APIs well-designed? Detection of their linguistic (Anti)Patterns. In: Barros, A., Grigori, D., Narendra, N.C., Dam, H.K. (eds.) ICSOC 2015. LNCS, vol. 9435, pp. 171–187. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-48616-0_11CrossRef Palma, F., Gonzalez-Huerta, J., Moha, N., Guéhéneuc, Y.-G., Tremblay, G.: Are RESTful APIs well-designed? Detection of their linguistic (Anti)Patterns. In: Barros, A., Grigori, D., Narendra, N.C., Dam, H.K. (eds.) ICSOC 2015. LNCS, vol. 9435, pp. 171–187. Springer, Heidelberg (2015). https://​doi.​org/​10.​1007/​978-3-662-48616-0_​11CrossRef
24.
Zurück zum Zitat Rinquin, A.: Avoiding n+1 requests in GraphQL, including within subscriptions Rinquin, A.: Avoiding n+1 requests in GraphQL, including within subscriptions
25.
Zurück zum Zitat Stoiber, M.: Securing your GraphQL API from malicious queries Stoiber, M.: Securing your GraphQL API from malicious queries
26.
Zurück zum Zitat Vargas, D.M., et al.: Deviation testing: a test case generation technique for GraphQL APIs (2018) Vargas, D.M., et al.: Deviation testing: a test case generation technique for GraphQL APIs (2018)
27.
Zurück zum Zitat Vázquez-Ingelmo, A., Cruz-Benito, J., García-Peñalvo, F.J.: Improving the OEEU’s data-driven technological ecosystem’s interoperability with GraphQL. In: Proceedings of the 5th International Conference on Technological Ecosystems for Enhancing Multiculturality - TEEM 2017, pp. 1–8 (2017) Vázquez-Ingelmo, A., Cruz-Benito, J., García-Peñalvo, F.J.: Improving the OEEU’s data-driven technological ecosystem’s interoperability with GraphQL. In: Proceedings of the 5th International Conference on Technological Ecosystems for Enhancing Multiculturality - TEEM 2017, pp. 1–8 (2017)
Metadaten
Titel
An Empirical Study of GraphQL Schemas
verfasst von
Erik Wittern
Alan Cha
James C. Davis
Guillaume Baudart
Louis Mandel
Copyright-Jahr
2019
DOI
https://doi.org/10.1007/978-3-030-33702-5_1