US-20260127047-A1 - APPLICATION PROGRAMMING INTERFACE SPECIFICATION ENHANCEMENT
Abstract
Mechanisms are provided for enhancing an Application Programming Interface (API) specification. The mechanisms receive an existing API specification and an API document that describes the API, and identifies an element candidate in the API document based on a matching of elements in the existing API specification with elements in the API document. The mechanisms determine, for the element candidate, a minimal ancestor based on one or more predetermined minimal ancestor criteria. In addition, the mechanisms generate additional content for the existing API specification which specifies parameter metadata for the element candidate, based on an application of an artificial intelligence (AI) language model (LM) to the minimal ancestor. Moreover, the mechanisms integrate the additional content into the existing API specification to thereby generate an enhanced API specification.
Inventors
- Koren Ran Lazar
- Matan Vetzler
- Guy Uziel
- ESTHER GOLDBRAICH
- David Boaz
- David Amid
- Ateret Anaby - Tavor
Assignees
- INTERNATIONAL BUSINESS MACHINES CORPORATION
Dates
- Publication Date
- 20260507
- Application Date
- 20241104
Claims (20)
- 1 . A method, in a data processing system, for enhancing an Application Programming Interface (API) specification, the method comprising: receiving an existing API specification for an API and an API document that describes the API; identifying an element candidate in the API document based on a matching of elements in the existing API specification with elements in the API document; determining, for the element candidate, a minimal ancestor based on one or more predetermined minimal ancestor criteria; generating additional content for the existing API specification which specifies parameter metadata for the element candidate, based on an application of an artificial intelligence (AI) language model (LM) to the minimal ancestor; and integrating the additional content into the existing API specification to thereby generate an enhanced API specification.
- 2 . The method of claim 1 , further comprising processing the minimal ancestor to filter child elements of the element candidate according to one or more predetermined filter criteria and remove attributes of the filtered child elements to thereby generate a filtered minimal ancestor, and wherein the additional content is generated based on the filtered minimal ancestor.
- 3 . The method of claim 1 , wherein the one or more predetermined filter criteria comprises a first filter criterion specifying whether the child element is a table element, a second filter criterion specifying whether the child is preceded by a parameter header element, a third filter criterion specifying whether the child contains any extracted parameter name, and a fourth filter criterion specifying whether the child contains predefined specific phrases indicating a level of importance to the API, wherein if any of the first, second, third, or fourth criterion are matched by a child element, the child element is maintained in the minimal ancestor.
- 4 . The method of claim 1 , wherein determining a minimal ancestor comprises traversing a hierarchical structure of the API document from the element candidate upwards along the hierarchical structure until an element meeting at least one of the one or more predetermined minimal ancestor criteria is encountered.
- 5 . The method of claim 4 , wherein the one or more predetermined minimal ancestor criteria comprises a first criterion in which an ancestor contains an API endpoint element matching an API Uniform Resource Locator (URL) identified from the existing API specification, and a second criterion in which the ancestor contains one or more elements of a same parameter name extracted from the existing API specification.
- 6 . The method of claim 1 , wherein the additional content is at least one of a textual description of the minimal ancestor for inclusion in the existing API specification, or a structured component of the minimal ancestor for inclusion in the existing API specification.
- 7 . The method of claim 6 , wherein the additional content is a structured component, and wherein the structured component is a table data structure comprising table elements specifying parameters of the minimal ancestor.
- 8 . The method of claim 1 , wherein generating the additional content for the existing API specification comprises generating a language model In-Context Learning (ICL) prompt instructing the AI LM to generate a structured component based on the minimal ancestor.
- 9 . The method of claim 1 , wherein integrating the additional content into the existing API specification to generate the enhanced API specification comprises overriding conflicting parameter metadata in the existing API specification with parameter metadata in the additional content.
- 10 . The method of claim 1 , further comprising storing the enhanced API specification in replacement of the existing API specification in an API specification repository.
- 11 . A computer program product comprising a computer readable storage medium having a computer readable program stored therein, wherein the computer readable program, when executed in a data processing system, causes the data processing system to: receive an existing Application Programming Interface (API) specification for an API and an API document that describes the API; identify an element candidate in the API document based on a matching of elements in the existing API specification with elements in the API document; determine, for the element candidate, a minimal ancestor based on one or more predetermined minimal ancestor criteria; generate additional content for the existing API specification which specifies parameter metadata for the element candidate, based on an application of an artificial intelligence (AI) language model (LM) to the minimal ancestor; and integrate the additional content into the existing API specification to thereby generate an enhanced API specification.
- 12 . The computer program product of claim 11 , wherein the computer readable program further causes the data processing system to process the minimal ancestor to filter child elements of the element candidate according to one or more predetermined filter criteria and remove attributes of the filtered child elements to thereby generate a filtered minimal ancestor, and wherein the additional content is generated based on the filtered minimal ancestor.
- 13 . The computer program product of claim 11 , wherein the one or more predetermined filter criteria comprises a first filter criterion specifying whether the child element is a table element, a second filter criterion specifying whether the child is preceded by a parameter header element, a third filter criterion specifying whether the child contains any extracted parameter name, and a fourth filter criterion specifying whether the child contains predefined specific phrases indicating a level of importance to the API, wherein if any of the first, second, third, or fourth criterion are matched by a child element, the child element is maintained in the minimal ancestor.
- 14 . The computer program product of claim 11 , wherein determining a minimal ancestor comprises traversing a hierarchical structure of the API document from the element candidate upwards along the hierarchical structure until an element meeting at least one of the one or more predetermined minimal ancestor criteria is encountered.
- 15 . The computer program product of claim 14 , wherein the one or more predetermined minimal ancestor criteria comprises a first criterion in which an ancestor contains an API endpoint element matching an API Uniform Resource Locator (URL) identified from the existing API specification, and a second criterion in which the ancestor contains one or more elements of a same parameter name extracted from the existing API specification.
- 16 . The computer program product of claim 11 , wherein the additional content is at least one of a textual description of the minimal ancestor for inclusion in the existing API specification, or a structured component of the minimal ancestor for inclusion in the existing API specification.
- 17 . The computer program product of claim 16 , wherein the additional content is a structured component, and wherein the structured component is a table data structure comprising table elements specifying parameters of the minimal ancestor.
- 18 . The computer program product of claim 11 , wherein generating the additional content for the existing API specification comprises generating a language model In-Context Learning (ICL) prompt instructing the AI LM to generate a structured component based on the minimal ancestor.
- 19 . The computer program product of claim 11 , wherein integrating the additional content into the existing API specification to generate the enhanced API specification comprises overriding conflicting parameter metadata in the existing API specification with parameter metadata in the additional content.
- 20 . An apparatus comprising: at least one processor; and at least one memory coupled to the at least one processor, wherein the at least one memory comprises instructions which, when executed by the at least one processor, cause the at least one processor to: receive an existing Application Programming Interface (API) specification for an API and an API document that describes the API; identify an element candidate in the API document based on a matching of elements in the existing API specification with elements in the API document; determine, for the element candidate, a minimal ancestor based on one or more predetermined minimal ancestor criteria; generate additional content for the existing API specification which specifies parameter metadata for the element candidate, based on an application of an artificial intelligence (AI) language model (LM) to the minimal ancestor; and integrate the additional content into the existing API specification to thereby generate an enhanced API specification.
Description
BACKGROUND The present application relates generally to a data processing apparatus and method and more specifically to a computing tool and computing tool operations/functionality for enhancing Application Programming Interface (API) specifications through artificial intelligence (AI) model processing of API documents. An Application Programming Interface (API) is a software interface that connects computers or pieces of software to each other by providing a collection of communication protocols and subroutines used by various programs and computing devices to communicate between them. The API acts as a messenger between pieces of software or computing systems by taking requests from one application and delivery responses from another. The API can be used to expose data and functionality to external users, such as developers, business partners, and customers. With regard to application development, APIs simplify programming of applications by abstracting the underlying implementation and only exposing the objects or actions that the application developer may need to develop the application. APIs are made up of different parts which act as tools or services that are available to a programmer by performing an API call. The calls of an API are also sometimes referred to as subroutines, methods, requests, or endpoints. An API specification is a document or standard that describes how to build the connection or interface of the API and defines these API calls by explaining how to use and implement these API calls. APIs are ubiquitous in modern computer applications. Examples of APIs include APIs for various popular applications, such as Twitter API, ChatGPT API, Paypal API, Slack API, Instagram API, and the like. SUMMARY This Summary is provided to introduce a selection of concepts in a simplified form that are further described herein in the Detailed Description. This Summary is not intended to identify key factors or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter. In one illustrative embodiment, a method, in a data processing system, is provided for enhancing an Application Programming Interface (API) specification. The method comprises receiving an existing API specification for an API and an API document that describes the API, and identifying an element candidate in the API document based on a matching of elements in the existing API specification with elements in the API document. The method further comprises determining, for the element candidate, a minimal ancestor based on one or more predetermined minimal ancestor criteria. In addition, the method comprises generating additional content for the existing API specification which specifies parameter metadata for the element candidate, based on an application of an artificial intelligence (AI) language model (LM) to the minimal ancestor. Moreover, the method comprises integrating the additional content into the existing API specification to thereby generate an enhanced API specification. In other illustrative embodiments, a computer program product comprising a computer useable or readable medium having a computer readable program is provided. The computer readable program, when executed on a computing device, causes the computing device to perform various ones of, and combinations of, the operations outlined above with regard to the method illustrative embodiment. In yet another illustrative embodiment, a system/apparatus is provided. The system/apparatus may comprise one or more processors and a memory coupled to the one or more processors. The memory may comprise instructions which, when executed by the one or more processors, cause the one or more processors to perform various ones of, and combinations of, the operations outlined above with regard to the method illustrative embodiment. These and other features and advantages of the present invention will be described in, or will become apparent to those of ordinary skill in the art in view of, the following detailed description of the example embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS The invention, as well as a preferred mode of use and further objectives and advantages thereof, will best be understood by reference to the following detailed description of illustrative embodiments when read in conjunction with the accompanying drawings, wherein: FIG. 1 is an example diagram of a distributed data processing system environment in which aspects of the illustrative embodiments may be implemented and at least some of the computer code involved in performing the inventive methods may be executed; FIG. 2 is an example block diagram illustrating the primary operational components of an Application Programming Interface (API) specification enhancement engine in accordance with one illustrative embodiment; FIGS. 3A-3D are diagrams illustrating an example operation for determining a minimal ancestor in