🤖 AI Summary
To address the challenge of locating and fixing REST API client misuses in cloud services, this paper proposes dcFix—a novel approach that jointly injects API specifications and non-compliant code snippets into large language model (LLM) prompts, integrating static analysis with prompt engineering to enable both violation detection and automated repair. Its core contribution is a specification-driven context enhancement mechanism that significantly improves the LLM’s comprehension of API semantic constraints. Experimental evaluation demonstrates that dcFix substantially outperforms baseline methods lacking specification integration, achieving higher accuracy in violation identification and greater success rates in automatic repair. The method enables end-to-end effective fixes across multiple real-world cloud API scenarios, validating its practical applicability and robustness.
📝 Abstract
Many cloud services provide REST API accessible to client applications. However, developers often identify specification violations only during testing, as error messages typically lack the detail necessary for effective diagnosis. Consequently, debugging requires trial and error. This study proposes dcFix, a method for detecting and automatically repairing REST API misuses in client programs. In particular, dcFix identifies non-conforming code fragments, integrates them with the relevant API specifications into prompts, and leverages a Large Language Model (LLM) to produce the corrected code. Our evaluation demonstrates that dcFix accurately detects misuse and outperforms the baseline approach, in which prompts to the LLM omit any indication of code fragments non conforming to REST API specifications.