GraphQLify:自动化且保持类型安全的GraphQL API采用
GraphQLify: Automated and Type Safety-Preserving GraphQL API Adoption
AI总结:
本文提出GraphQLify框架,通过静态源代码分析实现REST API向GraphQL的自动化迁移,生成类型安全的GraphQL schema,并在性能上优于现有工具。
摘要:
GraphQL提供了一种基于模式的强类型查询语言,使客户端-服务器通信更加高效。本文介绍了GraphQLify,一种自动化框架,用于将现有REST API迁移到GraphQL。不同于以往依赖关系型数据库、RDF或可机解析规范的方法,GraphQLify利用静态源代码分析进行精确的类型推断。这种新技术生成的GraphQL schema保证了端到端的类型安全,保留了采用GraphQL的核心优势。此外,现有迁移工具通常生成单独的适配器服务器,这会通过动态请求绑定和网络延迟引入性能开销。GraphQLify通过生成嵌入式服务器直接调用底层API代码,显著提高了性能。我们在九个流行的开源项目中的834个API上评估了GraphQLify,其成功将100%的API转换,零类型不匹配。相比之下,当前最先进的工具OASGraph在相同数据集上表现出3.5%的失败率和42%的类型不匹配率。最后,我们的性能评估表明,对于需要五次连续API调用的工作流,使用GraphQLify的客户端比REST counterparts减少数据获取时间2到4倍。
英文摘要:
GraphQL provides a schema-based, strongly typed query language that enables highly efficient client-server communication. This paper introduces GraphQLify, an automated framework designed to migrate existing REST APIs to GraphQL. Unlike prior approaches that rely on relational databases, resource description frameworks (RDF), or machine-parsable specifications, GraphQLify leverages static source code analysis for precise type inference. This novel technique generates GraphQL schemas that guarantee end-to-end type safety, preserving a core advantage of adopting GraphQL. Furthermore, existing migration tools typically generate separate adapter servers, which introduce performance overhead via dynamic request binding and network latency. GraphQLify eliminates this by generating an embedded server that directly invokes the underlying API code, significantly improving performance. We evaluated GraphQLify on 834 APIs across nine popular open-source projects, where it successfully converted 100% of the APIs with zero type mismatches. In contrast, the current state-of-the-art tool, OASGraph, exhibited a 3.5% failure rate and a 42% type mismatch rate on the same dataset. Finally, our performance evaluation demonstrates that for workflows requiring five sequential API calls, clients using GraphQLify reduce data fetching time by a factor of 2 to 4 compared to their REST counterparts.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。