paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Generating REST API Specifications through Static Analysis

通过静态分析生成 REST API 规范
ICSE Proceedings of the IEEE/ACM 46th International Conference on Software Engineering2024匹配度 2/10 · 论文用静态与符号程序分析从源码生成 REST API 规范,属于程序分析的工程应用,但未涉及 LLM/Agentic 程序分析、浮点程序分析或贝叶斯程序分析等用户画像的核心交叉方向。引用 17 inbox
Ruikai Huang, Manish Motwani, Idel Martinez, Alessandro Orso
crossref: 2026-09-12

AI 速览

一句话:提出 Respector,用静态与符号分析从源码自动生成 REST API 规范。

Web API 允许服务通过网络访问,其中 REST API 常使用 OpenAPI 等标准规范来描述。然而,从源码手工编写和维护这些规范耗时且易错,软件演化更会导致规范不完整或不一致,从而影响 API 的使用与测试。本文提出 Respector,首个利用静态与符号程序分析从 REST API 源码生成规范的技术。它推断端点方法、端点参数、方法响应以及参数属性,包括导致成功 HTTP 响应或错误的约束。作者在 15 个真实 API 上评估,端点方法、参数、响应和参数属性的推断取得较好的精确率与召回率。与开发者提供的规范对比,Respector 发现许多缺失的端点方法、参数、约束和响应,以及 API 实现与规范间的不一致;同时优于基于注解或直接调用 API 的规范推断技术。

问题
为 REST API 编写和维护 OpenAPI 等规范耗时且易错,软件演化会使规范不完整或不一致,进而影响 API 的使用和测试。
方法
提出 Respector,结合静态程序分析与符号执行,从 REST API 源码自动生成规范,并推断端点方法、参数、响应及参数约束。
评估
在 15 个真实 API 上评估端点方法、参数、响应和参数属性推断的精确率与召回率,并与开发者规范对比,最后与基于注解或调用 API 的推断技术进行比较。
原文摘要(Abstract)

Web Application Programming Interfaces (APIs) allow services to be accessed over the network. RESTful (or REST) APIs, which use the REpresentation State Transfer (REST) protocol, are a popular type of web API. To use or test REST APIs, developers use specifications written in standards such as OpenAPI. However, creating and maintaining these specifications is time-consuming and error-prone, especially as software evolves, leading to incomplete or inconsistent specifications that negatively affect the use and testing of the APIs. To address this problem, we present Respector (REST API specification generator), the first technique to employ static and symbolic program analysis to generate specifications for REST APIs from their source code. We evaluated Respector on 15 real-world APIs with promising results in terms of precision and recall in inferring endpoint methods, endpoint parameters, method responses, and parameter attributes, including constraints leading to successful HTTP responses or errors. Furthermore, these results could be further improved with additional engineering. Comparing the Respector-generated specifications with the developer-provided ones shows that Respector was able to identify many missing end-point methods, parameters, constraints, and responses, along with some inconsistencies between developer-provided specifications and API implementations. Finally, Respector outperformed several techniques that infer specifications from annotations within API implementations or by invoking the APIs.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot11317,
  title = {Generating REST API Specifications through Static Analysis},
  author = {Ruikai Huang and Manish Motwani and Idel Martinez and Alessandro Orso},
  booktitle = {ICSE},
  year = {2024},
  doi = {10.1145/3597503.3639137}
}