Skip to main content

Specification-Driven Code Generation for Inter-parameter Dependencies in Web APIs

  • Conference paper
  • First Online:
Service-Oriented Computing – ICSOC 2022 Workshops (ICSOC 2022)

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 149.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 199.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://www.yelp.com/developers/documentation/v3/business_search.

  2. 2.

    https://github.com/OAI/OpenAPI-Specification/issues/256.

  3. 3.

    https://swagger.io/docs/specification/describing-parameters.

  4. 4.

    https://github.com/enriquebarba97/openapi-generator/tree/java-idl-dependencies.

References

  1. Amadeus Hotel Search API (2022). https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-search/api-reference. Accessed July 2022

  2. 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

  3. 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

  4. Deljouyi, A., Ramsin, R.: Mdd4rest: model-driven methodology for developing restful web services. In: MODELSWARD, pp. 93–104. Scitepress (2022)

    Google Scholar 

  5. DHL Location Finder API (2022). https://developer.dhl.com/api-reference/location-finder. Accessed Sep 2022

  6. 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)

    Google Scholar 

  7. Fielding, R.T.: Rest: architectural styles and the design of network-based software architectures. Doctoral dissertation, University of California (2000)

    Google Scholar 

  8. Foursquare Search for Venues API (2022). https://developer.foursquare.com/reference/v2-venues-search. Accessed Sep 2022

  9. Google Maps API (2022). https://developers.google.com/maps/documentation/places/web-service/search. Accessed Sep 2022

  10. 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)

    Google Scholar 

  11. Inter-parameter Dependency Language (IDL) (2022) .https://github.com/isa-group/IDL. Accessed March 2022

  12. 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)

    Google Scholar 

  13. Li, L., Tang, T., Chou, W.: Automated creation of navigable REST services based on REST chart. J. Adv. Manag. Sci. 4, 385–392 (2016)

    Article  Google Scholar 

  14. 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)

    Google Scholar 

  15. 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)

    Chapter  Google Scholar 

  16. 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)

    Chapter  Google Scholar 

  17. Logic-less templates (2022). https://mustache.github.io/. Accessed July 2022

  18. Ohsome API (2022). https://docs.ohsome.org/ohsome-api/v1/. Accessed July 2022

  19. OMDb API (2022). http://www.omdbapi.com/. Accessed Sep 2022

  20. OpenAPI Generator (2022). https://openapi-generator.tech/. Accessed July 2022

  21. OpenAPI Specification (2022). https://swagger.io/specification/. Accessed July 2022

  22. PayPal Invoicing API (2022). https://developer.paypal.com/docs/api/invoicing/v1/#invoices. Accessed Sep 2022

  23. ProgrammableWeb API directory (2022). https://www.programmableweb.com/category/all/apis. Accessed Mar 2022

  24. 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)

    Google Scholar 

  25. RapidAPI Hub (2022). https://rapidapi.com/hub. Accessed Mar 2022

  26. RESTest: Automated Black-Box Testing of RESTful Web APIs (2022). https://github.com/isa-group/RESTest. Accessed Mar 2022

  27. 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)

    Google Scholar 

  28. Tumblr API (2022). https://www.tumblr.com/docs/en/api. Accessed July 2022

  29. 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)

    Google Scholar 

  30. Yelp API (2022). https://www.yelp.com/developers/documentation/v3. Accessed Sep 2022

  31. The web’s scaffolding tool for modern webapps (2022). https://yeoman.io/. Accessed Sep 2022

  32. YouTube Data API (2022). https://developers.google.com/youtube/v3/docs. Accessed Sep 2022

Download references

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

Authors

Corresponding author

Correspondence to Saman Barakat .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics