OpenAPITools / OpenAPITools/openapi-generator
[REQ] Automated Code Generation for Inter-Parameter Dependencies in Web APIs
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
The current tools for generating code templates from web API specifications neglect the inter-parameter dependencies—relationships between input parameters that are common in practice but often described in natural language [1]. Developers are left to implement validation logic for these dependencies manually, which is error-prone and time-consuming.
In my PhD work, I introduced IDLGen, an extension of the OpenAPI Generator ecosystem, aimed at automating the generation of validation code for inter-parameter dependencies in web APIs. This work was presented at the International Conference on Service-Oriented Computing (ICSOC) 2023 [2]. IDLGen leverages the IDL4OAS extension [3] to specify these dependencies within OpenAPI Specification (OAS) files and generates Java and Python code to manage them.
Evaluation results show the effectiveness of the tool, generating up to 9.4 times more lines of Java code than the existing generator. This leads to average time savings ranging from 16 to 24 minutes when implementing API operations, including between one and three dependencies when compared to manual coding. More importantly, the generated code reduces human errors, significantly improving the reliability of web APIs.
Problem
- Lack of automated handling of inter-parameter dependencies in existing tools, requiring developers to manually code the validation logic for dependencies.
- Error-prone manual implementation, leading to possible mistakes in API operations.
Proposed Solution
IDLGen extension for the OpenAPI Generator tool ecosystem to automate the generation of Java and Python code for handling inter-parameter dependencies in web APIs [4].
Expected Benefits
- Significant time savings (16 to 24 minutes) when handling inter-parameter dependencies.
- Reduction of human errors in API operations, enhancing reliability.
- Greater efficiency in API development, with up to 9.4 times more lines of generated code than current solutions.
Steps to Reproduce
- Use the IDL4OAS extension to specify inter-parameter dependencies in OpenAPI Specification files.
- Use the IDLGen extension to generate Java or Python code from the OAS file.
- Observe the generated code for validation logic related to inter-parameter dependencies.
Additional Context
This extension significantly improves the development of web APIs that require the management of inter-parameter dependencies, ensuring reliable and efficient code generation. More information can be found on the project website.
Examples
The following screenshot displays the Java code automatically generated by IDLGen to manage inter-parameter dependencies in a web API.
References
[1] A. Martin-Lopez, S. Segura, and A. Ruiz-Cortés, "A catalogue of inter-parameter dependencies in RESTful web APIs," in Service-Oriented Computing, S. Yangui, I. Bouassida Rodriguez, K. Drira, and Z. Tari, Eds., Cham: Springer International Publishing, 2019, pp. 399–414, doi: 10.1007/978-3-030-33702-5_31.
[2] S. Barakat, A.B. Sánchez, and S. Segura, "IDLGen: Automated code generation for inter-parameter dependencies in web APIs," in Service-Oriented Computing, F. Monti, S. Rinderle-Ma, A. Ruiz Cortés, Z. Zheng, and M. Mecella, Eds., Cham: Springer International Publishing, 2023, pp. 128-141, doi: 10.1007/978-3-031-48421-6_11.
[3] A. Martin-Lopez, S. Segura, C. Müller and A. Ruiz-Cortés, "Specification and Automated Analysis of Inter-Parameter Dependencies in Web APIs," in IEEE Transactions on Services Computing, vol. 15, no. 4, pp. 2342-2355, 1 July-Aug. 2022, doi: 10.1109/TSC.2021.3050610.
[4] S. Barakat, A. B. Sánchez, and S. Segura. IDLGen. https://github.com/ssegura/
openapi-generator/tree/IDLGen-extension, 2023. Accessed: July 2023.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the IDLGen extension branch and the existing OpenAPI Generator architecture, then trace how OpenAPI specifications become Java and Python output. Determine how the IDL4OAS dependency syntax would fit the project and what generated validation behavior is required. Done means an agreed integration design, implementation scope, and verification examples for both languages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, python
- Domain
- api, backend-api-design, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100