Abstract
The generation of code templates from web API specifications is a common practice in the software industry. However, existing tools neglect the dependencies among input parameters (so called inter-parameter dependencies), extremely common in practice and usually described in natural language. As a result, developers are responsible for implementing the corresponding validation logic manually, a tedious and error-prone process. In this paper, we present an approach for the automated generation of code for inter-parameter dependencies in web APIs. Specifically, we exploit the IDL4OAS extension for specifying inter-parameter dependencies as a part of OpenAPI Specification (OAS) files. To make our approach applicable in practice, we present an extension of the popular OpenAPI Generator tool ecosystem, automating the generation of Java and Python code for the management of inter-parameter dependencies in both servers and clients. Evaluation results show the effectiveness of the approach in accelerating the development of APIs, generating up to 9.4 times more code than current generators, while making APIs potentially more reliable.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Amadeus Hotel Search API (2022). https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-search/api-reference. Accessed July 2022
Barakat, S., Barba Roque, E., Sánchez, A.B., Segura, S.: [Supplementary material] Automated code generation for inter-parameter dependencies in REST APIs (2022). https://doi.org/10.5281/zenodo.7105287
Barakat, S., Roque, E.B., Sánchez, A.B., Segura, S.: Automated code generation for inter-parameter dependencies in REST APIs. In: Navarro Martínez, E. (ed.) JCIS2022. SISTEDES (2022). http://hdl.handle.net/11705/JCIS/2022/027
Deljouyi, A., Ramsin, R.: Mdd4rest: model-driven methodology for developing restful web services. In: MODELSWARD, pp. 93–104. Scitepress (2022)
DHL Location Finder API (2022). https://developer.dhl.com/api-reference/location-finder. Accessed Sep 2022
Ed-Douibi, H., Izquierdo, J.L.C., Gómez, A., Tisi, M., Cabot, J.: EMF-REST: generation of restful APIs from models. In: Proceedings of the 31st Annual ACM Symposium on Applied Computing, 04–08 April 2016, pp. 1446–1453. Association for Computing Machinery (2016)
Fielding, R.T.: Rest: architectural styles and the design of network-based software architectures. Doctoral dissertation, University of California (2000)
Foursquare Search for Venues API (2022). https://developer.foursquare.com/reference/v2-venues-search. Accessed Sep 2022
Google Maps API (2022). https://developers.google.com/maps/documentation/places/web-service/search. Accessed Sep 2022
Gómez, O.S., Rosero, R.H., Cortés-Verdín, K.: CRUDyleaf: A DSL for generating spring boot rest APIs from entity crud operations. Cybern. Inf. Technol. 20(3), 3–14 (2020)
Inter-parameter Dependency Language (IDL) (2022) .https://github.com/isa-group/IDL. Accessed March 2022
Li, L., Chou, W.: Design and describe rest API without violating rest: a petri net based approach. In: 2011 IEEE International Conference on Web Services, pp. 508–515 (2011)
Li, L., Tang, T., Chou, W.: Automated creation of navigable REST services based on REST chart. J. Adv. Manag. Sci. 4, 385–392 (2016)
Martin-Lopez, A., Segura, S., Muller, C., Ruiz-Cortes, A.: Specification and automated analysis of inter-parameter dependencies in web APIs. IEEE Trans. Serv. Comput. 15(4), 1–14 (2021)
Martin-Lopez, A., Segura, S., Ruiz-Cortés, A.: A catalogue of inter-parameter dependencies in restful web APIs. In: Yangui, S., Bouassida Rodriguez, I., Drira, K., Tari, Z. (eds.) Service-Oriented Computing, pp. 399–414. Springer International Publishing, Cham (2019)
Martin-Lopez, A., Segura, S., Ruiz-Cortés, A.: RESTest: black-box constraint-based testing of restful web APIs. In: Kafeza, E., Benatallah, B., Martinelli, F., Hacid, H., Bouguettaya, A., Motahari, H. (eds.) Service-Oriented Computing, pp. 459–475. Springer International Publishing, Cham (2020)
Logic-less templates (2022). https://mustache.github.io/. Accessed July 2022
Ohsome API (2022). https://docs.ohsome.org/ohsome-api/v1/. Accessed July 2022
OMDb API (2022). http://www.omdbapi.com/. Accessed Sep 2022
OpenAPI Generator (2022). https://openapi-generator.tech/. Accessed July 2022
OpenAPI Specification (2022). https://swagger.io/specification/. Accessed July 2022
PayPal Invoicing API (2022). https://developer.paypal.com/docs/api/invoicing/v1/#invoices. Accessed Sep 2022
ProgrammableWeb API directory (2022). https://www.programmableweb.com/category/all/apis. Accessed Mar 2022
Queirós, R.: Kaang: a restful api generator for the modern web. In: 7th Symposium on Languages, Applications and Technologies SLATE 2018, vol. 62, pp. 1:1–1:15. Schloss Dagstuhl-Leibniz-Zentrum für Informatik (2018)
RapidAPI Hub (2022). https://rapidapi.com/hub. Accessed Mar 2022
RESTest: Automated Black-Box Testing of RESTful Web APIs (2022). https://github.com/isa-group/RESTest. Accessed Mar 2022
Rossi, D.: UML-based model-driven REST API development. In: WEBIST 2016 - Proceedings of the 12th International Conference on Web Information Systems and Technologies, pp. 194–201 (2016)
Tumblr API (2022). https://www.tumblr.com/docs/en/api. Accessed July 2022
Wang, B., Rosenberg, D., Boehm, B.W.: Rapid realization of executable domain models via automatic code generation. In: 2017 IEEE 28th Annual Software Technology Conference (STC), pp. 1–6 (2017)
Yelp API (2022). https://www.yelp.com/developers/documentation/v3. Accessed Sep 2022
The web’s scaffolding tool for modern webapps (2022). https://yeoman.io/. Accessed Sep 2022
YouTube Data API (2022). https://developers.google.com/youtube/v3/docs. Accessed Sep 2022
Acknowledgements
This work has been partially supported by the European Commission (ERDF) and Junta de Andalucía under project EKIPMENT-PLUS (P18-FR-2895), and by MCIN/AEI/10.13039/501100011033/FEDER, UE under project ATENEA (PID2021-126227NB-C22).
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Barakat, S., Roque, E.B., Sánchez, A.B., Segura, S. (2023). Specification-Driven Code Generation for Inter-parameter Dependencies in Web APIs. In: Troya, J., et al. Service-Oriented Computing – ICSOC 2022 Workshops. ICSOC 2022. Lecture Notes in Computer Science, vol 13821. Springer, Cham. https://doi.org/10.1007/978-3-031-26507-5_21
Download citation
DOI: https://doi.org/10.1007/978-3-031-26507-5_21
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-26506-8
Online ISBN: 978-3-031-26507-5
eBook Packages: Computer ScienceComputer Science (R0)