Information processing program and information processing device
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-02-10
- Publication Date
- 2026-08-13
Smart Images

Figure JP2025004379_13082026_PF_FP_ABST
Abstract
Description
Information Processing Program and Information Processing Apparatus
[0001] The present invention relates to an information processing program and an information processing apparatus.
[0002] A Web API (Application Programming Interface) has become a major means for communication and data sharing between systems, and its use is increasing in many fields such as Web applications (hereinafter sometimes simply referred to as "apps"), mobile apps, and IoT (Internet of Things) apps.
[0003] An API is an interface provided for an application to utilize data and functions, and is created and published by a data provider or a function developer. By newly providing a Web API to an existing Web app, it becomes possible to use the data and functions of the Web app from other apps via the Web without being aware of the physical location.
[0004] However, to build a Web API from the source code of a Web app, developers have to write a lot of code manually, which takes time and effort. Therefore, there is an increasing need to streamline the process by automatically generating a Web API using the source code of the Web app as input.
[0005] As an API generation method, for example, a method of converting all methods of object-oriented code into Web APIs is known. This method assumes that the source code is written in an object-oriented language and that the methods function individually and do not need to be called in a specific order. In such a method, an API code that takes the union of the arguments of the constructor method and the instance method is mechanically generated for all public methods of all classes.
[0006] Also known are methods of splitting methods (see, for example, Non-Patent Document 1) and methods of simplifying the source code by combining methods through inlining expansion to make long and complex methods shorter and understandable.
[0007] Japanese Patent Publication No. 2020-53201, International Publication No. 2022 / 230191, Japanese Unexamined Patent Application Publication No. 2018-55625
[0008] Danilo Silva, Ricardo Terra, and Marco Tulio Valente, "Recommending automated extract method refactorings" [online], June 2, 2014, Conference: 22nd IEEE International Conference on Program Comprehension (ICPC) [Searched on January 27, 2025], Internet <URL: https: / / dl.acm.org / doi / 10.1145 / 2597008.<2597141>
[0009] However, in such a conventional Web API generation method, the quality of the Web API generated based on the source code is not guaranteed. For example, it is difficult to generate Web APIs with different optimal granularities (e.g., the number of API endpoints and the number of arguments) for each client (user).
[0010] In one aspect, the present invention aims to be able to generate a Web API that satisfies the generation conditions.
[0011] Therefore, this information processing program receives the generation conditions, extracts the methods included in the source code of the Web application, uses the extracted methods to generate a set of API endpoint candidates (initial API endpoint set) including one or more API (Application Programming Interface) endpoints, and when the set of API endpoint candidates does not satisfy the generation conditions, performs at least one of splitting and combining the API code on the APIs included in the set of API endpoint candidates to generate a set of API endpoints that satisfies the generation conditions, and causes the computer to execute a process of outputting the set of API endpoints that satisfies the generation conditions.
[0012] According to one embodiment, a Web API that satisfies the generation conditions can be generated.
[0013] This is a schematic diagram showing the configuration of an information processing device according to one embodiment. This is a diagram showing an example of the hardware configuration of an information processing device according to one embodiment. This is a diagram illustrating the code of an API endpoint using a Web API framework. This is a diagram illustrating the granularity adjustment user interface in an information processing device according to one embodiment. This is a diagram illustrating the granularity adjustment user interface in an information processing device according to one embodiment. This is a flowchart for explaining the processing in an information processing device according to one embodiment. This is a flowchart for explaining the processing in an information processing device according to one embodiment.
[0014] Embodiments of this information processing program and information processing device will be described below with reference to the drawings. However, the embodiments shown below are merely examples, and there is no intention to exclude various modifications or applications of technologies not explicitly shown in the embodiments. In other words, these embodiments can be implemented with various modifications without departing from their spirit. Furthermore, each figure is not intended to represent only the components shown in the figure, but may include other functions, etc.
[0015] (A) Configuration (A-1) Hardware Configuration Example Figure 1 is a schematic diagram showing the configuration of an information processing device 1 according to one embodiment, and Figure 2 is a block diagram showing an example of the hardware (HW) configuration of a computer 10 that implements its functions. When multiple computers are used as HW resources to implement the functions of the information processing device 1, each computer may have the HW configuration illustrated in Figure 2.
[0016] As shown in Figure 2, the computer 10 may, as an example of its hardware configuration, include a processor 10a, a graphics processing unit 10b, a memory 10c, a storage unit 10d, an IF (Interface) unit 10e, an IO (Input / Output) unit 10f, and a read unit 10g.
[0017] The processor 10a is an example of an arithmetic processing unit that performs various control and calculations, and is also an example of a control unit. The processor 10a may be connected to each block in the computer 10 via a bus 10j so as to be able to communicate with each other. The processor 10a may be a multiprocessor that includes multiple processors, a multicore processor that has multiple processor cores, or a configuration that has multiple multicore processors.
[0018] Examples of the processor 10a include integrated circuits (ICs) such as CPUs, MPUs, APUs, DSPs, ASICs, and FPGAs. Two or more combinations of these integrated circuits may be used as the processor 10a. CPU stands for Central Processing Unit, MPU for Micro Processing Unit, APU for Accelerated Processing Unit, DSP for Digital Signal Processor, ASIC for Application Specific IC, and FPGA for Field-Programmable Gate Array.
[0019] The graphics processing unit 10b controls the screen display for output devices such as monitors, which are part of the I / O unit 10f. The graphics processing unit 10b can be various types of arithmetic processing units, such as integrated circuits (ICs) like GPUs (Graphics Processing Units), APUs, DSPs, ASICs, or FPGAs.
[0020] Memory 10c is an example of hardware that stores various data and program information. Examples of memory 10c include volatile memory such as DRAM (Dynamic Random Access Memory) and non-volatile memory such as PM (Persistent Memory), or both.
[0021] The storage unit 10d is an example of hardware that stores various data and program information. Examples of storage units 10d include magnetic disk devices such as HDDs (Hard Disk Drives), semiconductor drive devices such as SSDs (Solid State Drives), and various storage devices such as non-volatile memory. Examples of non-volatile memory include flash memory, SCM (Storage Class Memory), and ROM (Read Only Memory).
[0022] The memory unit 10d may store a program 10h (information processing program) that implements all or part of the various functions of the computer 10.
[0023] For example, the processor 10a of the information processing device 1 can perform the functions of the Web API generation unit 2 and the Web API execution unit 3, which will be described later, by loading the program 10h stored in the storage unit 10d into the memory 10c and executing it.
[0024] The IF unit 10e is an example of a communication interface that controls the connection and communication between this computer 10 and other computers. For example, the IF unit 10e may include an adapter compliant with LAN (Local Area Network) such as Ethernet®, or optical communication such as FC (Fibre Channel). The adapter may support wireless, wired, or both communication methods.
[0025] The information processing device 1 may be connected to other computers (not shown) via the IF unit 10e and a network to enable communication with them. For example, the information processing device 1 may be connected via the IF unit 10e and a network to a computer used by a developer who created the source code for a web application (not shown) or a computer used by a user of the web application (not shown). The program 10h may be downloaded from the network to the computer 10 via the communication IF and stored in the storage unit 10d.
[0026] The I / O unit 10f may include one or both of an input device and / or an output device. Examples of input devices include a keyboard, mouse, and touch panel. Examples of output devices include a monitor, projector, and printer. The I / O unit 10f may also include a touch panel that integrates an input device and a display device. The output device may be connected to the graphics processing unit 10b.
[0027] The reading unit 10g is an example of a reader that reads data and program information recorded on the recording medium 10i. The reading unit 10g may include a connection terminal or device to which the recording medium 10i can be connected or inserted. Examples of the reading unit 10g include an adapter compliant with USB (Universal Serial Bus), a drive device for accessing a recording disk, and a card reader for accessing flash memory such as an SD card. The recording medium 10i may store a program 10h, and the reading unit 10g may read the program 10h from the recording medium 10i and store it in the storage unit 10d.
[0028] Examples of recording media 10i include non-temporary computer-readable recording media such as magnetic / optical discs and flash memory. Examples of magnetic / optical discs include flexible discs, CDs (Compact Discs), DVDs (Digital Versatile Discs), Blu-ray discs, and HVDs (Holographic Versatile Discs). Examples of flash memory include semiconductor memory such as USB memory and SD cards.
[0029] The hardware configuration of computer 10 described above is illustrative. Therefore, the addition or deletion of hardware within computer 10 (for example, adding or deleting arbitrary blocks), division, integration in any combination, or addition or deletion of buses may be performed as appropriate.
[0030] (A-2) Functional Configuration Example As shown in Figure 1, the information processing device 1 may, as an example, be equipped with functions as a Web API generation unit 2 and a Web API execution unit 3. These functions may be implemented by the hardware of the computer 10 (see Figure 1).
[0031] As shown in Figure 1, the WebAPI generation unit 2 has the functions of an initial setting unit 21, a granularity adjustment user interface (UI) 22, and a candidate generation unit 23.
[0032] The initial setup unit 21 receives the application source code and unit tests (test programs) entered by the developer and stores them in a predetermined storage area of the storage unit 10d. The application may be a web application. The web application may be executed on a server or the like (not shown). The unit tests are test programs that run the source code of the web application to verify the operation of the application. Hereinafter, the source code of the web application may be referred to as the target source code. The unit tests are used by the serialization cost measurement processing unit 32, which will be described later.
[0033] The granularity adjustment user interface 22 is a user interface for exchanging information with users who use the Web application. Users use the Web application, for example, through a client application. The client application then accesses the Web application via Web API code.
[0034] The user inputs at least one of the desired number of API endpoints and the number of arguments via this granularity adjustment user interface 22. The user may input the desired number of API endpoints and the number of arguments as a data range that includes, for example, at least one of an upper limit and a lower limit.
[0035] The number of API endpoints and arguments desired by the user, input via the granularity adjustment user interface 22, are used as generation conditions (constraints) by the candidate generation unit 23, which will be described later.
[0036] The number of API endpoints and arguments desired by the user, entered via the granularity adjustment user interface 22, are input to the Web API generation unit 2. In other words, the Web API generation unit 2 accepts the generation conditions (number of endpoints, number of arguments).
[0037] The number of API endpoints and arguments desired by the user can be referred to as the desired conditions. These desired conditions may also include conditions other than the number of API endpoints and arguments.
[0038] Here, an API endpoint is information that represents a specific connection destination and connection method for a Web API client to exchange data with a Web API server. An API endpoint can also be called a Web API endpoint. A single API endpoint consists of a set of three elements: a root, an HTTP (Hypertext Transfer Protocol) method, and arguments.
[0039] Here, the route is a specific access path represented as part of a URL (Uniform Resource Locator). HTTP methods are instructions sent by the client to the server, such as GET, POST, PUT, and DELETE. Arguments are additional information sent by the client to the server, such as parameters.
[0040] Figure 3 is an example of API endpoint code using the Web API framework.
[0041] In the example shown in Figure 3, " / api / data" is the root and "GET" is the HTTP method. A single integer argument is also shown. Note that the implementation details are omitted in this example.
[0042] Further, the granularity adjustment user interface 22 presents the API endpoint set generated by the filtering unit 31 described later to the user by displaying it. The details of the granularity adjustment user interface 22 will be described later with reference to FIGS. 4 and 5.
[0043] The candidate generation unit 23 generates candidates for API endpoints to be presented to the user. The candidate generation unit 23 also performs a process of initializing the candidate set with an empty set.
[0044] As shown in FIG. 1, the candidate generation unit 23 has functions as an initial candidate generation unit 24, a static analysis unit 25, and an additional candidate generation unit 26.
[0045] The initial candidate generation unit 24 extracts and enumerates all public methods from the source code of the Web application stored by the initial setting unit 21, and generates an initial endpoint set by mechanically converting them. The initial endpoint set is an example of a candidate for an API endpoint set.
[0046] For example, when the public method of the program is "train(x, y)", the initial setting unit 21 may generate a set of "( / train, POST, (x, y))" as a Web API endpoint.
[0047] The initial candidate generation unit 24 generates (Web API-izes) an initial endpoint set by regarding the methods of existing object-oriented code as Web APIs. It is assumed that the source code is written in an object-oriented language, and the methods function individually and do not need to call a plurality of methods in a specific order. The initial candidate generation unit 24 mechanically generates API code that takes the union of the arguments of the constructor method and the arguments of the instance method for all public methods of all classes.
[0048] Hereinafter, the process of generating Web API code based on the target source code by the initial candidate generation unit 24 will be exemplified. Assume that the target source code is as follows.
[0049] #Target source code class PassageHallucinationChecker(HallucinationChecker): def __init__(self, common_param): ... def check(self, passage, references, contexts = []): ...
[0050] In the target source code described above, the constructor method has a common_param as its argument, and the instance method has three arguments: passage, references, and contexts. The initial candidate generation unit 24 generates the Web API code shown below (#Web API code that wraps the target source code) based on this source code.
[0051] #Web API code to wrap the target source code @app.post(" / check") def check(common_param, passage, references, contexts=[]): instance = PassageHallucinationChecker(common_param) return instance.check(passage, references, contexts) In the generated Web API code above, the check method includes four arguments: common_param, passage, references, and contexts.
[0052] The initial candidate generation unit 24, for example, treats all methods included in the target source code as Web APIs and converts them. Then, the initial candidate generation unit 24 extracts and lists all public methods included in the target source code.
[0053] As an example of listing public methods extracted from the target source code, the public methods of the AutoML class are shown below.
[0054] - def_ _init_ _(self, model_name=None) - def train(X_train, y_train) - def predict(model_name, X) The initial candidate generation unit 24 can be said to naively enumerate all API endpoints included in the target source code.
[0055] Next, the initial candidate generation unit 24 generates an initial API endpoint set by combining the public methods and constructor methods for all the enumerated public methods. Based on all the enumerated public methods, the initial candidate generation unit 24 generates API endpoints using these public methods and generates an initial API endpoint set that includes these generated API endpoints. The initial API endpoint set is an example of an API endpoint set candidate.
[0056] For example, the initial candidate generation unit 24 generates an initial API endpoint set including the two API endpoints (1) and (2) shown below, based on the public methods of the AutoML class described above.
[0057] @app post (" / train") ... (1) - def train(model_name , X_train, y_train): instance = AutoML(model_name ) return instance.train(X_train, y_train) @app post (" / predict") ... (2) - def predict(model_name , X): instance = AutoML(model_name) return instance.predict(X) The above API endpoint (1) may be represented as POST / train, and the API endpoint (2) may be represented as POST / predict.
[0058] The initial candidate generation unit 24 adds the generated initial API endpoint set to the candidate set.
[0059] The Web API conversion (generation of Web API code) process by the initial candidate generation unit 24 can be implemented using known methods, and a detailed explanation of these methods will be omitted.
[0060] The initial candidate generation unit 24 stores information of the generated initial API endpoint set candidate set in a predetermined storage area such as the storage unit 10d.
[0061] The static analysis unit 25 analyzes the initial API endpoint set generated by the initial candidate generation unit 24. For example, the static analysis unit 25 counts the number of API endpoints included in the initial API endpoint set.
[0062] The initial API endpoint set described above includes two API endpoints, POST / train and POST / predict, so the number of API endpoints is two.
[0063] Furthermore, the static analysis unit 25 counts the minimum and maximum number of arguments for each element (API endpoint) of the initial API endpoint set.
[0064] In the initial API endpoint set described above, the number of arguments for POST / train is 3, and the number of arguments for POST / predict is 2. Therefore, the minimum number of arguments for the static analysis unit 25 in the initial API endpoint set described above is 2, and the maximum number is 3.
[0065] In other words, the static analysis unit 25 analyzes the number of API endpoints and arguments included in the initial API endpoint set.
[0066] The static analysis unit 25 stores the number of API endpoints included in the initial API endpoint set, as well as the minimum and maximum number of arguments for each element (API endpoint) in the initial API endpoint set, in a predetermined storage area such as the storage unit 10d.
[0067] The additional candidate generation unit 26 compares the results of the static analysis performed by the static analysis unit 25, i.e., the number of API endpoints and arguments included in the initial API endpoint set, with the user's desired conditions.
[0068] If the number of API endpoints or arguments included in the initial API endpoint set does not meet the user's requirements, the additional candidate generation unit 26 generates an API endpoint set that meets the user's requirements by splitting or merging the APIs included in the initial API endpoint set.
[0069] For example, if the number of API endpoints included in the initial API endpoint set is less than the user's desired number (more specifically, the lower limit of the number of endpoints entered by the user via the granularity adjustment user interface 22), the additional candidate generation unit 26 increases the number of API endpoints by splitting the APIs included in the initial API endpoint set.
[0070] Furthermore, if the number of API endpoints included in the initial API endpoint set is greater than the user's desired number (more specifically, the upper limit of the number of endpoints entered by the user via the granularity adjustment user interface 22), the additional candidate generation unit 26 reduces the number of API endpoints by combining the APIs included in the initial API endpoint set.
[0071] Furthermore, for each element (API) included in the initial API endpoint set, if the number of arguments included in each API is less than the number desired by the user (more specifically, the lower limit of the number of arguments entered by the user via the granularity adjustment user interface 22), the additional candidate generation unit 26 increases the number of arguments by splitting the API.
[0072] Furthermore, for each element (API) included in the initial API endpoint, if the number of arguments included in each API is greater than the number requested by the user (more specifically, the upper limit of the number of arguments entered by the user via the granularity adjustment user interface 22), the additional candidate generation unit 26 reduces the number of arguments by combining APIs.
[0073] Furthermore, API partitioning may be performed using various known method partitioning techniques (see, for example, Non-Patent Document 1). API coupling may also be performed using known method coupling techniques, such as method inlining. Since these method partitioning and coupling techniques are known, their respective explanations are omitted.
[0074] In other words, if the additional candidate generation unit 26 does not meet the user's desired conditions, it generates a set of additional candidates by splitting or merging APIs included in the initial API endpoint set.
[0075] The additional candidate generation unit 26 adds the API endpoint sets after splitting and the API endpoint sets after merging to the candidate set.
[0076] For example, with respect to the initial API endpoint set including POST / train and POST / predict mentioned above, the additional candidate generation unit 26 generates a candidate set as exemplified below. This candidate set includes the initial API endpoint set (element 1) plus a post-combined API endpoint set (element 2) generated by combining APIs.
[0077] Element 1: Initial API endpoint set - post / train (3 arguments) - post / predict (2 arguments) Element 2: Combined API endpoint set - post / train_predict (5 arguments) In other words, the additional candidate generation unit 26 generates an API endpoint set set (candidate set) that includes multiple API endpoint sets that satisfy the generation conditions. The additional candidate generation unit 26 stores the information of the generated candidate set of API endpoint sets in a predetermined storage area such as the storage unit 10d.
[0078] The Web API execution unit 3 functions as a filtering unit 31, and the filtering unit 31 functions as a serialization cost measurement processing unit 32.
[0079] The serialization cost measurement processing unit 32 calculates the serialization cost (time) for each endpoint included in the API endpoint set included in the candidate set.
[0080] Specifically, the serialization cost measurement processing unit 32 temporarily rewrites the serialization function implemented in the WebAPI framework of each API endpoint to execute the following processes P1 to P3.
[0081] Process P1: Record the current time. Process P2: Execute the original serialization function. Process P3: Record the difference between the current time and the time recorded in Process P1 as the execution time. Then, the serialization cost measurement processing unit 32 executes the unit test (test program) stored by the initial setup unit 21 for each endpoint included in the API endpoint set included in the candidate set. This allows the serialization cost to be determined for each API endpoint.
[0082] The serialization cost measurement processing unit 32 performs serialization tests on the API endpoints included in the API endpoint sets included in the candidate set (API endpoint set set).
[0083] Furthermore, the serialization cost measurement processing unit 32 sets the execution time to ∞ (infinity) for API endpoint sets where serialization errors occurred as a result of running the unit test. Note that instead of setting the execution time to ∞ for API endpoint sets where serialization errors occurred, the serialization cost measurement processing unit 32 may, for example, set a flag, and can be modified as appropriate.
[0084] The filtering unit 31 removes API endpoint sets that resulted in serialization errors from the candidate set as a result of running the unit tests.
[0085] The WebAPI execution unit 3 sends information representing the candidate set after filtering by the filtering unit 31, that is, the candidate set from which API endpoint sets that resulted in serialization errors have been removed (filtered candidate set), to the granularity adjustment user interface 22.
[0086] The WebAPI execution unit 3 excludes API endpoint sets that have resulted in errors from the output of the granularity adjustment user interface 22 as a result of the serialization test.
[0087] Furthermore, the WebAPI execution unit 3 also sends the number of endpoints, the number of arguments, and the serialization cost for the candidate set to the granularity adjustment user interface 22.
[0088] Figures 4 and 5 illustrate an example of a granularity adjustment user interface 22 in an information processing device 1 according to one embodiment.
[0089] The particle size adjustment user interface 22 illustrated in Figures 4 and 5 is formed as a screen displayed by a browser and has a condition input section 221 and a presentation section 222.
[0090] The condition input section 221 is a screen for the user to input desired conditions (number of API endpoints, number of arguments).
[0091] In the granularity adjustment user interface 22 illustrated in Figures 4 and 5, the condition input unit 221 includes a first condition input unit 221a for inputting the number of API endpoints and a second condition input unit 221b for inputting the number of arguments.
[0092] In the first condition input unit 221a and the second condition input unit 221b illustrated in Figures 4 and 5, the number of API endpoints and the number of arguments can be input using bars superimposed on a number line. The user can then input the number of API endpoints and the number of arguments as a data range by setting the left end of the bars on the number line as the lower limit and the right end as the upper limit, respectively, using a mouse or the like.
[0093] In the example shown in Figure 4, the first condition input unit 221a is set to a data range for the number of API endpoints, with a lower limit of 1 and an upper limit of 3. The second condition input unit 221b is set to a data range for the number of arguments, with a lower limit of 2 and an upper limit of 6.
[0094] Furthermore, in the example shown in Figure 5, the first condition input unit 221a is set to a data range with a lower limit of 2 and an upper limit of 3 as the number of API endpoints. Also, the second condition input unit 221b is set to a data range with a lower limit of 2 and an upper limit of 6 as the number of arguments.
[0095] Furthermore, the user may set the upper and lower limits to the same value, thereby setting the number of API endpoints and the number of arguments as pinpoint values instead of entering them as a range. Alternatively, the user may enter only one of the number of API endpoints or the number of arguments in the condition input section 221.
[0096] After the user sets the desired number of API endpoints and the number of arguments in the first condition input section 221a and the second condition input section 221b in the condition input section 221, they click the generation instruction input button 221c to confirm the set desired conditions, which are then sent to the candidate generation section 23.
[0097] The presentation unit 222 is a screen for presenting the candidate set generated by the Web API generation unit 2 to the user.
[0098] In the granularity adjustment user interface 22 illustrated in Figure 4, one API endpoint set (API set #1) is shown on the display unit 222 (see arrow P1). This API set #1 includes two API endpoints (see arrows P2 and P3) and metadata (see arrow P4).
[0099] In the example shown in Figure 4, the metadata includes the number of endpoints, the number of arguments, and the serialization cost. The number of arguments includes the maximum and minimum number of arguments for each of the multiple (two in the example shown in Figure 4) API endpoints included in this API set #1. The serialization cost used is the serialization cost measured by the serialization cost measurement processing unit 32.
[0100] Furthermore, in the granularity adjustment user interface 22 illustrated in Figure 5, two API endpoint sets (API set #1, API set #2) are shown on the display unit 222 (see arrows P1, P5). API set #1 includes two API endpoints (see arrows P2, P3) and metadata (see arrow P4), similar to Figure 4.
[0101] API set #2 includes one API endpoint (see arrow P6) and metadata (see arrow P7). Since API set #2 has only one API endpoint, it does not meet the user's requirements.
[0102] Therefore, in the example shown in Figure 5, the message "The number of API endpoints does not meet the requirements" is displayed in association with API set #2 (see arrow P8).
[0103] Furthermore, the display of API sets that do not meet the user's desired conditions is not limited to Figure 5 and can be modified as appropriate. For example, the display color for API set #2 may be changed, or an icon indicating that the conditions are not met may be displayed, and various modifications can be made.
[0104] Furthermore, the granularity adjustment user interface 22 may be equipped with an input section for inputting feedback on whether the user is satisfied with the information in the presented API set.
[0105] (B) Operation The processing in the information processing device 1 according to one embodiment configured as described above will be explained in accordance with the flowcharts (steps S1 to S18) shown in Figures 6 to 8. Figure 6 shows the processing in steps S1 to S5, Figure 7 shows the processing in steps S6 to S10, and Figure 8 shows the processing in steps S11 to S18.
[0106] Before this process begins, the developer inputs the source code and unit tests, and the initial setup unit 21 stores these input source code and unit tests (test programs) in a predetermined storage area of the storage unit 10d.
[0107] In step S1, the user inputs at least one of the desired number of API endpoints and the number of arguments via the granularity adjustment user interface 22.
[0108] In step S2, the candidate generation unit 23 initializes the candidate set with an empty set.
[0109] In step S3, the initial candidate generation unit 24 extracts and lists all public methods included in the target source code.
[0110] In step S4, the initial candidate generation unit 24 generates an initial API endpoint set by combining the public methods and constructor methods of all the enumerated public methods.
[0111] In step S5, the initial candidate generation unit 24 adds the generated initial API endpoint set to the candidate set.
[0112] In step S6, the static analysis unit 25 counts the number of API endpoints included in the initial API endpoint set generated by the initial candidate generation unit 24.
[0113] In step S7, the static analysis unit 25 counts the minimum and maximum number of arguments for each element (API endpoint) of the initial API endpoint set.
[0114] In step S8, the additional candidate generation unit 26 compares the number of API endpoints and the number of arguments included in the initial API endpoint set with the user's desired conditions. The additional candidate generation unit 26 then checks whether the minimum and maximum number of API endpoint sets or the number of arguments included in the API endpoint set satisfy the desired conditions.
[0115] If the verification results show that the minimum and maximum number of arguments in the API endpoint set do not meet the desired conditions (see No route in step S8), proceed to step S9.
[0116] In step S9, the additional candidate generation unit 26 generates an API endpoint set that satisfies the user's desired conditions by splitting and merging the APIs included in the initial API endpoint set.
[0117] In step S10, the additional candidate generation unit 26 adds the API endpoint set after splitting and the API endpoint set after merging to the candidate set. Then, the process returns to step S8.
[0118] If the results of the verification in step S8 show that the minimum and maximum number of arguments in the API endpoint set meet the desired conditions (see the Yes route in step S8), proceed to step S11.
[0119] In step S11, the serialization cost measurement processing unit 32 temporarily rewrites the serialization function implemented in the Web API framework of each API endpoint to execute the above processes P1 to P3.
[0120] In step S12, the serialization cost measurement processing unit 32 causes the initial setup unit 21 to execute the unit test stored for each endpoint included in the API endpoint set included in the candidate set.
[0121] In step S13, the serialization cost measurement processing unit 32 checks whether a serialization error has occurred. If a serialization error has occurred (see the Yes route in step S13), in step S14, the serialization cost measurement processing unit 32 sets the execution time to ∞ for the API endpoint set where the serialization error occurred.
[0122] Furthermore, if no serialization error occurs (see No route in step S13), in step S15, the serialization cost measurement processing unit 32 records the measured execution time as it is, in association with the API endpoint set.
[0123] In step S16, the filtering unit 31 removes API endpoint sets for which the execution time is set to ∞, i.e., API endpoint sets in which a serialization error occurred, from the candidate set.
[0124] In step S17, the Web API execution unit 3 sends information representing the candidate set after filtering by the filtering unit 31, along with the number of endpoints, the number of arguments, and the serialization cost, to the granularity adjustment user interface 22, which then displays the candidate set (API endpoint set set), the number of endpoint sets, the number of arguments, and the serialization cost on the presentation unit 222. This presents the candidate set (API endpoint set set), the number of endpoint sets, the number of arguments, and the serialization cost to the user.
[0125] The user provides feedback via this input unit, indicating whether or not they are satisfied with the information in the presented API set, through an input unit provided in the granularity adjustment user interface 22.
[0126] In step S18, the Web API generation unit 2 checks the content of the user's feedback regarding the API set information presented in the granularity adjustment user interface 22.
[0127] If the user is satisfied with the information presented in the API set (see the Yes route in step S18), the process terminates. If the user is not satisfied (see the No route in step S18), the process returns to step S1.
[0128] (C) Effects As described above, according to the information processing device 1 as an example of the embodiment, the user can input information of the desired granularity (number of API endpoints, number of arguments) to the Web API via the granularity adjustment user interface 22.
[0129] The initial candidate generation unit 24 extracts all methods included in the source code of the Web application and uses the extracted methods to generate an initial API endpoint set (API endpoint set candidate) containing one or more API endpoints. If this generated initial API endpoint set does not meet the user's desired conditions (generation conditions), the additional candidate generation unit 26 generates an API endpoint set that meets the desired conditions by performing at least one of the following on the APIs included in the initial API endpoint set: splitting the API code and merging the API code. By outputting the API endpoint set thus generated via the granularity adjustment user interface 22, the user can obtain API endpoints of the desired granularity.
[0130] Furthermore, in this process, users can obtain the API endpoint without waiting for work from developers, making it highly convenient.
[0131] In conventional methods, it is difficult to determine the appropriate API endpoint granularity. Specifically, while a small number of endpoints makes it easy to use, it is difficult to control the fine granularity because all arguments are passed together. On the other hand, while a large number of endpoints allows for fine granularity control because arguments are passed with each call, it results in a trade-off where the number of calls increases and it becomes cumbersome. In this information processing device 1, the user can easily obtain API endpoints that satisfy the desired granularity by determining the granularity (number of endpoints and number of arguments) and combining or splitting the API code.
[0132] A set of API endpoints is generated using methods included in the source code of the web application, and since this generated set of API endpoints satisfies the number of arguments desired by the user, the web application can be accessed via the API endpoints using the client-side language.
[0133] Since the source code of the web application is used as input and the API endpoint set is automatically generated, costs for developers and others can be reduced.
[0134] By excluding API endpoint sets where a serialization error occurred during the serialization cost calculation by the serialization cost measurement processing unit 32 from the output target from the granularity adjustment user interface 22, users can easily obtain the API endpoint set of their desired granularity by checking the granularity adjustment user interface 22, thus providing high convenience. Furthermore, it improves user confidence.
[0135] Furthermore, the granularity adjustment user interface 22 outputs (presents) information indicating API endpoints that do not meet the user's desired conditions, along with information indicating that the desired conditions (e.g., the number of API endpoints) are not met. This allows the user to review their desired conditions, making it highly convenient.
[0136] (D) The technologies disclosed in other parts are not limited to the embodiments described above and can be implemented in various ways without departing from the spirit of these embodiments. Each configuration and each process of these embodiments can be selected or combined as needed.
[0137] Furthermore, the above disclosure makes it possible for those skilled in the art to implement and manufacture this embodiment.
[0138] 1 Information Processing Unit 2 Web API Generation Unit 21 Initial Setup Unit 22 Granularity Adjustment User Interface 221 Condition Input Unit 222 Presentation Unit 221a First Condition Input Unit 221b Second Condition Input Unit 221c Generation Instruction Input Button 23 Candidate Generation Unit 24 Initial Candidate Generation Unit 25 Static Analysis Unit 26 Additional Candidate Generation Unit 3 Web API Execution Unit 31 Filtering Unit 32 Serialization Cost Measurement Processing Unit 10 Computer 10a Processor 10b Graphics Processing Unit 10c Memory 10d Storage Unit 10e IF Unit 10f IO Unit 10g Read Unit 10h Program 10i Recording Medium 10j Bus
Claims
1. An information processing program characterized by causing a computer to perform the following processes: accept generation conditions, extract methods contained in the source code of a web application, generate a candidate API endpoint set containing one or more API (Application Programming Interface) endpoints using the extracted methods, generate an API endpoint set that satisfies the generation conditions by performing at least one of API code splitting and API code merging on the APIs contained in the candidate API endpoint set, and output an API endpoint set that satisfies the generation conditions.
2. The information processing program according to claim 1, wherein the process for generating an API endpoint set that satisfies the generation conditions is to generate an API endpoint set collection that includes multiple API endpoint sets that satisfy the generation conditions, further execute a serialization test on the API endpoints included in the API endpoint set included in the API endpoint set collection, and, as a result of the serialization test, cause the computer to execute a process to exclude API endpoint sets that have resulted in errors from being output in the output process.
3. The information processing program according to claim 1 or 2, characterized in that the generation conditions include at least one of the number of API endpoints and the number of arguments.
4. The information processing program according to claim 1 or 2, characterized in that, in the output process, it outputs information indicating an API endpoint that does not satisfy the generation conditions, together with information indicating that the generation conditions are not satisfied.
5. An information processing device characterized by having a control unit that performs the following processes: accept generation conditions, extract methods included in the source code of a web application, generate a candidate API endpoint set including one or more API (Application Programming Interface) endpoints using the extracted methods, generate an API endpoint set that satisfies the generation conditions by performing at least one of splitting API code and combining API code on the APIs included in the candidate API endpoint set, and output an API endpoint set that satisfies the generation conditions.
6. The information processing apparatus according to claim 5, wherein the control unit performs a process to generate an API endpoint set that satisfies the generation conditions, which involves generating an API endpoint set collection that includes a plurality of API endpoint sets that satisfy the generation conditions, and further performs a serialization test on the API endpoints included in the API endpoint sets included in the API endpoint set collection, and performs a process to exclude API endpoint sets that have resulted in errors from being output in the output process.
7. The information processing apparatus according to claim 5 or 6, characterized in that the generation conditions include at least one of the number of API endpoints and the number of arguments.
8. The information processing apparatus according to claim 5 or 6, characterized in that, in the output process, information indicating an API endpoint that does not satisfy the generation conditions is output together with information indicating that the generation conditions are not satisfied.