Interface management method, system, product, device and readable storage medium

By automatically comparing and recording interface definition information and generating a change list, the problem of complexity and low efficiency of interface change identification is solved, and the efficiency of interface adaptation and testing is improved.

CN118860906BActive Publication Date: 2024-12-20INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411347341.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2024-12-20
Estimated Expiration
2044-09-26

AI Technical Summary

Technical Problem

During the iteration of the artificial intelligence platform version, due to changes in the interface, testers need to manually compare interface differences and rewrite test cases, which is prone to errors and omissions, which increases the difficulty of test case updates and reduces the efficiency of interface adaptation.

Method used

By reading the interface definition information of the reference version and the comparison version from the preset storage space, a change list is generated, and the addition, deletion and modification of the interface is automatically identified and recorded, and the change information is automatically generated to simplify the adaptation operation.

Benefits of technology

It reduces the complexity of identification of interface changes, improves the efficiency of interface adaptation and testing, ensures that interface changes are clear and clear, and facilitates testers to perform adaptation operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860906B_ABST
    Figure CN118860906B_ABST
Patent Text Reader

Abstract

The present invention discloses an interface management method, system, product, device and readable storage medium, which relates to the field of computer systems. In order to solve the problem of difficulty in updating test cases and low interface adaptation efficiency, the interface management method includes reading first interface definition information corresponding to each application module in a reference version and second interface definition information corresponding to each application module in a comparison version from a preset storage space; for each application module, determining a first request list based on the first interface definition information, and determining a second request list based on the second interface definition information; performing a comparison operation on the interface in the first request list and the interface in the second request list corresponding to each application module, determining the changed interface of the application module according to the comparison result, and generating a change list based on the change information of the changed interface, so as to perform an adaptation operation based on the change list. The present invention can reduce the difficulty of updating test cases and improve the efficiency of interface adaptation and testing work.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer systems, and in particular to an interface management method, system, product, device and readable storage medium. Background Art

[0002] The interface defines the communication specifications and conventions between different modules. During the version iteration process of the artificial intelligence platform development, the interface will continue to change due to various reasons such as the upgrade of the technical architecture, the adjustment of business logic, or the improvement of security performance, including the addition, modification, and deletion of interfaces. During the version iteration process, due to changes in the interface, testers need to re-adapt test cases according to the new interface specifications. At present, this process relies on testers to manually compare the interface differences before and after the version update and rewrite the test cases accordingly. However, manual comparison is prone to errors and omissions, and it is difficult to fully identify changes in the interface, which increases the difficulty of updating test cases and reduces the efficiency of interface adaptation and testing.

[0003] Therefore, how to provide a solution to the above technical problems is a problem that those skilled in the art need to solve at present. Summary of the invention

[0004] The purpose of the present invention is to provide an interface management method, system, product, device and readable storage medium, which can reduce the difficulty of updating test cases and improve the efficiency of interface adaptation and testing work.

[0005] In order to solve the above technical problems, the present invention provides an interface management method, comprising:

[0006] Reading from a preset storage space the first interface definition information corresponding to each application module in the reference version and the second interface definition information corresponding to each application module in the comparison version;

[0007] For each of the application modules, determine a first request list based on the first interface definition information, and determine a second request list based on the second interface definition information, wherein the first request list includes all interfaces of the application module in the reference version, and the second request list includes all interfaces of the application module in the comparison version;

[0008] A comparison operation is performed on the interfaces in the first request list and the interfaces in the second request list corresponding to each of the application modules, and the changed interfaces of the application modules are determined according to the comparison results. A change list is generated based on the change information of the changed interfaces, so as to perform an adaptation operation based on the change list.

[0009] Before reading the first interface definition information corresponding to each application module in the reference version and the second interface definition information corresponding to each application module in the comparison version from the preset storage space, the interface management method further includes:

[0010] For each of the application modules, obtaining interface definition information of the application module in each version;

[0011] The interface definition information of each version is stored in the preset storage space in a preset data exchange format, and the reference version and the comparison version are two versions determined from all the versions based on a user selection instruction.

[0012] Wherein, for each of the application modules, the process of obtaining the interface definition information of the application module in each version includes:

[0013] Generate an interface corresponding to each of the application modules to obtain a uniform resource identifier;

[0014] A request is sent to the interface acquisition uniform resource identifier corresponding to each of the application modules to obtain the interface definition information of each of the application modules in each version.

[0015] Wherein, the interface management method further includes:

[0016] Creating an interface information table in the preset storage space, wherein each data storage column corresponding to the interface information table includes an independent label, the application module, version, interface definition content and information generation time;

[0017] The process of storing the interface definition information of each version in the preset storage space in a preset data exchange format includes:

[0018] The interface definition information of each version is written into the corresponding data storage column in a preset data exchange format.

[0019] The process of determining, for each of the application modules, a first request list based on the first interface definition information and a second request list based on the second interface definition information includes:

[0020] For each of the application modules, deserialize the first interface definition information to obtain a first interface definition object, and deserialize the second interface definition information to obtain a second interface definition object;

[0021] The first interface definition object includes the first request list, and the second interface definition object includes the second request list.

[0022] The process of comparing the interface in the first request list and the interface in the second request list corresponding to each of the application modules, determining the changed interface of the application module according to the comparison result, and generating the changed list based on the changed information of the changed interface includes:

[0023] For each of the application modules, determine whether the application module has a first interface and / or a second interface; the first interface is an interface that exists in the first request list and does not exist in the second request list, and the second interface is an interface that does not exist in the first request list and exists in the second request list;

[0024] If any of the application modules has the first interface, determine the first interface as a changed interface of the application module, and write the changed information of the first interface into a deleted interface list;

[0025] If any of the application modules has the second interface, determine the second interface as a changed interface of the application module, and write the changed information of the second interface into a newly added interface list;

[0026] A change list is obtained based on the deleted interface list and the newly added interface list.

[0027] Wherein, after obtaining the change list based on the deleted interface list and the newly added interface list, the interface management method further includes:

[0028] In the change list, a first remark is added to the first interface, and a second remark is added to the second interface, so that an adaptation operation is performed based on the first remark and / or the second remark in the change list.

[0029] The process of comparing the interface in the first request list and the interface in the second request list corresponding to each application module and determining the changed interface of the application module according to the comparison result further includes:

[0030] For each of the application modules, determining whether the application module has a third interface; the third interface is an interface that exists in both the first request list and the second request list;

[0031] If so, determining whether there is change information of the third interface according to the first interface definition object and the second interface definition object;

[0032] When there is change information of the third interface, determining the third interface as the change interface of the application module, and writing the change information of the third interface into the modified interface list;

[0033] The process of obtaining a change list based on the deleted interface list and the newly added interface list includes:

[0034] A change list is obtained based on the deleted interface list, the newly added interface list and the modified interface list.

[0035] Wherein, the first interface definition object includes a first interface parameter definition list and a first interface return information definition, and the second interface definition object includes a second interface parameter definition list and a second interface return information definition;

[0036] The process of judging whether there is change information of the third interface according to the first interface definition object and the second interface definition object includes:

[0037] Determining whether the first interface parameter definition list and the second interface parameter definition list are the same;

[0038] If they are not the same, determining that there is change information of the third interface;

[0039] If they are the same, determining that there is no change information of the third interface;

[0040] Determine whether the first interface return information definition and the second interface return information definition are the same;

[0041] If not, determining that there is change information of the third interface;

[0042] If so, it is determined that there is no change information for the third interface.

[0043] The process of reading the first interface definition information corresponding to each application module in the reference version and the second interface definition information corresponding to each application module in the comparison version from the preset storage space includes:

[0044] When the code construction of any business module of the new version is completed, the first interface definition information corresponding to the application module in the reference version and the second interface definition information corresponding to the application module in the new version are read from the preset storage space;

[0045] After determining the changed interface of the application module according to the comparison result, the interface management method further includes:

[0046] A notification corresponding to the changed interface is generated.

[0047] The process of generating a notification corresponding to the changed interface includes:

[0048] Obtaining a uniform resource identifier corresponding to each of the change interfaces;

[0049] Pull the front-end code and automated test code to generate a code file list;

[0050] Traversing the code file list according to the uniform resource identifier, determining whether there is a reference to a string segment of the uniform resource identifier in the code file;

[0051] If so, a notification corresponding to the changed interface is generated.

[0052] In order to solve the above technical problems, the present invention also provides an interface management system, comprising:

[0053] A first acquisition module, configured to read, from a preset storage space, first interface definition information corresponding to each application module in the reference version and second interface definition information corresponding to each application module in the comparison version;

[0054] A first determining module is configured to determine, for each of the application modules, a first request list based on the first interface definition information, and a second request list based on the second interface definition information, wherein the first request list includes all interfaces of the application module in the reference version, and the second request list includes all interfaces of the application module in the comparison version;

[0055] A generation module is used to compare the interfaces in the first request list and the interfaces in the second request list corresponding to each of the application modules, determine the changed interfaces of the application modules according to the comparison results, and generate a change list based on the change information of the changed interfaces so as to perform adaptation operations based on the change list.

[0056] To solve the above technical problems, the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the interface management method as described in any one of the above when executed by a processor.

[0057] In order to solve the above technical problems, the present invention further provides an electronic device, comprising:

[0058] Memory for storing computer programs;

[0059] A processor is used to implement the steps of the interface management method as described in any one of the above when executing the computer program.

[0060] To solve the above technical problems, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the interface management method as described in any one of the above are implemented.

[0061] The present application provides an interface management method, which stores the interface system of each application module in each version in a preset storage space, realizes the archiving and management of each version of interface information during the platform product development process, and obtains the changed interface of the application module by comparing the interface definition information of the reference version and the comparison version of the same application module. The interface changes of each application module are independently identified, which reduces the complexity of identification and improves the identification efficiency. A change list including the change information of all changed interfaces is automatically generated, so that the interface changes of each application module are clear and understandable, which is convenient for testers to perform corresponding adaptation operations according to the change list, reduces the difficulty of updating test cases, and improves the efficiency of interface adaptation and testing.

[0062] The present application also provides an interface management system, a computer program product, an electronic device and a computer-readable storage medium, which have the same beneficial effects as the above-mentioned interface management method. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0064] Figure 1 A flowchart of the steps of an interface management method provided by the present invention;

[0065] Figure 2 A flowchart of interface definition information comparison provided by the present invention;

[0066] Figure 3 A flowchart of another interface management method provided by the present invention;

[0067] Figure 4 A timing diagram of an interface management method provided by the present invention;

[0068] Figure 5 An interface management architecture diagram provided by the present invention;

[0069] Figure 6 A schematic diagram of the structure of an interface management system provided by the present invention;

[0070] Figure 7 A schematic diagram of the structure of an electronic device provided by the present invention;

[0071] Figure 8 This is a schematic diagram of the structure of a computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION

[0072] The core of the present invention is to provide an interface management method, system, product, device and readable storage medium, which can reduce the difficulty of updating test cases and improve the efficiency of interface adaptation and testing work.

[0073] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0074] First, please refer to Figure 1 , the present application provides an interface management method, the interface management method comprising:

[0075] S101: Reading first interface definition information corresponding to each application module in the reference version and second interface definition information corresponding to each application module in the comparison version from a preset storage space;

[0076] In this embodiment, the application module may specifically be an application module in any artificial intelligence platform. Based on the different goals, functions and requirements of different artificial intelligence platforms, the application module includes but is not limited to a monitoring module, a user management module, a data processing module, a security module, a log module, etc. Each application module includes at least one interface for interacting with other modules, including but not limited to a data interface, a service interface, a management interface, a control interface, a status interface, etc. When the artificial intelligence platform is updated, the interface call of the application module will be adaptively adjusted.

[0077] It can be understood that the preset storage space stores the interface definition information corresponding to each application module in each version for subsequent direct reading. As an optional embodiment, since MySQL (My Structured Query Language, relational database management system) is convenient for storing and managing various types of data, such as structured data, configuration data, log data, etc., MySQL can be selected as the preset storage space in this embodiment. Considering that the interface definition information includes but is not limited to the interface name, URL (Uniform Resource Locator, Uniform Resource Locator), request parameters, response format and other information, MySQL can effectively organize and manage these interface definition information, and operate these data through SQL (Structured Query Language, Structured Query Language) query language, so as to realize the archiving and management of each version of the interface definition information in the process of artificial intelligence platform product development, and improve the reliability and effectiveness of interface definition information management.

[0078] In this embodiment, each application module has first interface definition information in the reference version, and the application module has second interface definition information in the comparison version. The reference version and the comparison version can be any two versions specified by the user to be compared. For example, if the user wants to compare which interfaces have been changed in the fifth version V5 compared to the fourth version V4, then the reference version is V4 and the comparison version is V5. In some application scenarios, the comparison version is the current latest version, and the reference version is the previous version of the latest version. For example, if the current latest version is V5, then the reference version can be V4.

[0079] S102: For each application module, determine a first request list based on the first interface definition information, and determine a second request list based on the second interface definition information, wherein the first request list includes all interfaces of the application module in the reference version, and the second request list includes all interfaces of the application module in the comparison version;

[0080] In this embodiment, when interface change identification is performed, identification is performed on an application module basis, and the identification method of each application module is the same. An application module is used as an example for explanation below. First, a first request list is determined based on the first interface definition information of the application module. The first request list is an interface request URI (Uniform Resource Identifier) ​​list of the application module. The interface request URI list includes information about all interfaces of the application module in the reference version, such as interface A, interface B, and interface C. The second request list is also an interface request URI list of the application module. The interface request URI list includes information about all interfaces of the application module in the comparison version, such as interface A, interface E, and interface F.

[0081] S103: Compare the interfaces in the first request list and the interfaces in the second request list corresponding to each application module, determine the changed interfaces of the application module according to the comparison results, generate a change list based on the change information of the changed interfaces, so as to perform adaptation operations based on the change list.

[0082] In this embodiment, the interfaces in the first request list and the interfaces in the second request list corresponding to the application module are traversed and compared to determine the changed interface of the application module. The changed interface is the interface of the application module that has changed in the comparison version compared to the reference version. For example, the application module does not include interface E in the reference version, but includes interface E in the comparison version, then interface E is the changed interface of the application module.

[0083] After obtaining the change interface of all application modules, a change list is generated according to the change information of the change interface. Testers can perform corresponding adaptation operations according to the change list, and the adaptation operation is not limited to recompiling test cases, etc. Among them, the change information includes but is not limited to the request method, interface URL, application module, responsible person (developer who developed the application module), header (request header) parameter definition, input parameter definition, input parameter body (request body) definition, output parameter definition, input parameter change, output parameter change.

[0084] As an optional embodiment, the interface definition information and change information can be generated into an Excel result file by calling the export interface for the interface caller to view.

[0085] It can be seen that in this embodiment, the interface system of each application module in each version is stored in the preset storage space, which realizes the archiving and management of each version of interface information during the platform product development process, and obtains the changed interface of the application module by comparing the interface definition information of the reference version and the comparison version of the same application module. The interface changes of each application module are independently identified, which reduces the complexity of identification and improves the identification efficiency. A change list including the change information of all changed interfaces is automatically generated, so that the interface changes of each application module are clear and convenient for testers to perform corresponding adaptation operations according to the change list, which reduces the difficulty of updating test cases and improves the efficiency of interface adaptation and testing.

[0086] Based on the above embodiments:

[0087] In an exemplary embodiment, before reading the first interface definition information corresponding to each application module in the reference version and the second interface definition information corresponding to each application module in the comparison version from the preset storage space, the interface management method further includes:

[0088] For each application module, obtain the interface definition information of the application module in each version;

[0089] The interface definition information of each version is stored in a preset storage space in a preset data exchange format, and the reference version and the comparison version are two versions determined from all versions based on the user selection instruction.

[0090] In this embodiment, first, for each application module, the interface definition information of the application module in each version is stored in the MySQL database in the JSON string format. JSON is a lightweight data exchange format that can easily store unstructured data, including complex nested objects and arrays. This allows the database to store various complex data structures without pre-defining a fixed table structure. Accordingly, MySQL provides support for the JSON data type, including indexing, querying, and updating operations, which allows JSON data to be operated like ordinary columns without parsing the JSON string into other formats, providing an efficient and flexible data storage solution for interface management.

[0091] In addition, using the same format to store multiple versions of interface definition information can ensure the consistency of interface definition, facilitate management and maintenance, and the unified format allows the interface definition information between different versions to be interoperable, which is convenient for comparison and migration between different versions. There is no need to create a different storage structure for each version, which simplifies the complexity of data storage and management. In an exemplary embodiment, for each application module, the process of obtaining the interface definition information of the application module in each version includes:

[0092] Generate an interface corresponding to each application module to obtain a uniform resource identifier;

[0093] A request is sent to the interface acquisition uniform resource identifier corresponding to each application module to obtain the interface definition information of each application module in each version.

[0094] In this embodiment, the interface corresponding to each application module is generated to obtain the uniform resource identifier URI. For example, to obtain the interface definition information of the monitoring module (monitor), the corresponding URI is https: / / ip:port / monitor / v2 / api-docs. The interface definition information of the monitoring module can be obtained by requesting the above URI. The same is true for other application modules. It can be understood that the interface definition information of each application module can be accessed through an independent URI path, which helps to improve the quality and efficiency of interface management. In addition, further, the URI of the interface definition information can be integrated into the CI / CD (Continuous Integration / Continuous Deployment) process to automatically obtain and process the interface definition information and improve development efficiency. In an exemplary embodiment, the interface management method also includes:

[0095] Create an interface information table in a preset storage space, where each data storage column corresponding to the interface information table includes an independent label, application module, version, interface definition content, and information generation time;

[0096] The process of storing the interface definition information of each version in a preset data exchange format in a preset storage space includes:

[0097] The interface definition information of each version is written into the corresponding data storage column in a preset data exchange format.

[0098] In this embodiment, the above interface definition information is stored in the interface information table (t_swagger_definition) corresponding to MySQL in JSON string format, divided by version and application module. The data storage columns corresponding to the interface information table t_swagger_definition include: ID, application module, version, interface definition content, and generation time, wherein ID refers to the label of an interface definition information in json string format, and the interface definition content includes request method, interface URL, responsible person, Header parameter definition, input parameter definition, input parameter body definition, output parameter definition, etc. The generation time specifically refers to the acquisition time of the interface definition information. When selecting the corresponding interface definition information later, the interface definition information corresponding to the comparison version and the reference version can be matched and read directly from MySQL according to the application module information and version information.

[0099] As an optional embodiment, an interface information table can be established in MySQL for each application module, so that the interface definition information of each version of the application module is stored in the interface information table corresponding to the application module in a one-to-one correspondence in the JSON string format. In addition, the number of versions that can be stored in the interface information table can be set. When the number of versions reaches the target value, the interface definition information of the corresponding version is deleted in the order of storage time from first to last. By establishing an interface information table for each application module, modular management of interface definition information is achieved. This helps to clearly distinguish and maintain the interface definition information of different application modules. On this basis, this helps to track and compare the interface definition information of different versions, which is convenient for version control and change management. By setting the number of versions that can be stored in the interface information table, the use of storage space can be flexibly controlled to avoid performance problems caused by data expansion. When the number of versions reaches the preset target value, the old version is automatically deleted in the order of storage time from first to last, realizing the automation of interface management process, reducing manual intervention, and improving management efficiency. At the same time, by setting the number of versions and automatically deleting the old version, the potential threat of the old version data to the system security, such as the vulnerability or configuration error in the old version, can be avoided.

[0100] In an exemplary embodiment, for each application module, a process of determining a first request list based on first interface definition information and determining a second request list based on second interface definition information includes:

[0101] For each application module, deserialize the first interface definition information to obtain a first interface definition object, and deserialize the second interface definition information to obtain a second interface definition object;

[0102] The first interface definition object includes a first request list, and the second interface definition object includes a second request list.

[0103] In this embodiment, in order to facilitate storage, the interface definition information of each application module is stored in the MySQL database in the JSON string format by version and module. Considering that the JSON string format is not convenient for comparison between versions, in this embodiment, the first interface definition information and the second interface definition information in the JSON string format stored in the MySQL database are read in the form of a data stream, and the first interface definition information and the second interface definition information are deserialized to obtain the first interface definition object and the second interface definition object respectively. The contents included in the interface definition objects are shown in Table 1.

[0104] Table 1 Interface definition object internal table

[0105]

[0106] In an exemplary embodiment, a comparison operation is performed on the interface in the first request list and the interface in the second request list corresponding to each application module, and a changed interface of the application module is determined according to the comparison result. The process of generating a changed list based on the change information of the changed interface includes:

[0107] For each application module, determine whether the application module has a first interface and / or a second interface; the first interface is an interface that exists in the first request list but does not exist in the second request list, and the second interface is an interface that does not exist in the first request list but exists in the second request list;

[0108] If any application module has the first interface, determine the first interface as a changed interface of the application module, and write the changed information of the first interface into the deleted interface list;

[0109] If any application module has a second interface, the second interface is determined as a changed interface of the application module, and the change information of the second interface is written into the newly added interface list;

[0110] Get the change list based on the deleted interface list and the added interface list.

[0111] Reference Figure 2 As shown, the interface request URI list in the first interface definition object (oldpaths, in Figure 2 The interface (represented by ops in the ) and the interface request URI list in the second interface definition object (newpaths, in Figure 2 If the interface exists in ops but not in nps, the interface is determined as the first interface (deleted interface), that is, a changed interface of the application module. If the interface does not exist in ops but exists in nps, the interface is determined as the second interface (newly added interface), that is, a changed interface of the application module. If the first interface exists in any application module, a deleted interface list is established, and the change information of the first interface in each application module is written into the deleted interface list. If the second interface exists in any application module, a newly added interface list is established, and the change information of the first interface in each application module is written into the newly added interface list. The change list is obtained according to the newly added interface list and the deleted interface list.

[0112] In an exemplary embodiment, after obtaining the change list based on the deleted interface list and the newly added interface list, the interface management method further includes:

[0113] In the change list, a first note is added to the first interface and a second note is added to the second interface, so that an adaptation operation is performed based on the first note and / or the second note in the change list.

[0114] To facilitate the viewing by testers or callers, this embodiment also adds notes to the newly added interface and the deleted interface respectively, and accordingly, the change information also includes notes.

[0115] In an exemplary embodiment, if Figure 2 As shown, the process of comparing the interface in the first request list and the interface in the second request list corresponding to each application module and determining the changed interface of the application module according to the comparison result also includes:

[0116] For each application module, determine whether the application module has a third interface; the third interface is an interface that exists in both the first request list and the second request list;

[0117] If so, determining whether there is change information of the third interface according to the first interface definition object and the second interface definition object;

[0118] When there is change information on the third interface, the third interface is determined as a change interface of the application module, and the change information on the third interface is written into the modified interface list;

[0119] The process of obtaining the change list based on the deleted interface list and the added interface list includes:

[0120] Get the change list based on the deleted interface list, the added interface list and the modified interface list;

[0121] In an exemplary embodiment, as shown in Table 1, the first interface definition object includes a first interface parameter definition list and a first interface return information definition, and the second interface definition object includes a second interface parameter definition list and a second interface return information definition;

[0122] The process of judging whether there is change information of the third interface according to the first interface definition object and the second interface definition object includes:

[0123] Determine whether the first interface parameter definition list and the second interface parameter definition list are the same;

[0124] If they are not the same, it is determined that there is change information in the third interface;

[0125] If they are the same, it is determined that there is no change information on the third interface;

[0126] Determine whether the first interface return information definition and the second interface return information definition are the same;

[0127] If not, determining that there is change information on the third interface;

[0128] If so, it is determined that there is no change information on the third interface.

[0129] In this embodiment, considering that the interface change also involves interface modification, that is, the paths in both versions include the interface, this interface is determined as the third interface, and then the changes in the parameters in the interface (Parameters in Table 1) and the returned object information (Definitions in Table 1) are determined respectively. The process of modifying the parameters in the interface and the returned object is similar to the comparison process of the Paths list set. Finally, the final change list is generated, refer to Figure 3 The change list is based on the interface list of the reference version, and records the new additions, modifications, and deletions after comparison with the interface list of the comparison version.

[0130] In an exemplary embodiment, the process of reading the first interface definition information corresponding to each application module in the reference version and the second interface definition information corresponding to each application module in the comparison version from the preset storage space includes:

[0131] When the code construction of any business module of the new version is completed, the first interface definition information corresponding to the application module in the reference version and the second interface definition information corresponding to the application module in the new version are read from the preset storage space;

[0132] After determining the changed interface of the application module according to the comparison result, the interface management method further includes:

[0133] Generates notifications corresponding to changed interfaces.

[0134] In order to enable the interface changes to be processed in a timely manner, the triggering of the interface comparison action can be triggered by continuous integration CI / CD. When building a new version of the code, the interface definition information of the previous version initialized in MySQL and the interface definition information of the current version are obtained, the interface information is compared, and the generated interface information comparison result is notified to the relevant interface caller. In an exemplary embodiment, the process of generating a notification corresponding to the changed interface includes:

[0135] Get the uniform resource identifier corresponding to each changed interface;

[0136] Pull the front-end code and automated test code to generate a code file list;

[0137] Traverse the code file list according to the uniform resource identifier, and determine whether there is a reference to the string fragment of the uniform resource identifier in the code file;

[0138] If so, a notification corresponding to the changed interface is generated.

[0139] Specifically, first store the interface definition information of each historical version in the t_swagger_definition table of the MySQL database by module. In Jenkins, when a new version of the business module code is built, the pipeline of the corresponding business module will be triggered. In the corresponding pipeline, after the business module code is built, the Docker image is generated and the service is restarted, a new trigger is added to the pipeline to call the above-mentioned interface information comparison interface, and pass in the historical version number and new version number to be compared, as well as the corresponding module name. Obtain detailed information on interface changes by calling the interface information comparison interface, then traverse the interface to obtain the URI information corresponding to each changed interface, and then pull the front-end code and automated test code. According to the URI information, traverse the code file list to determine whether there is a reference to the uri string fragment in the file. If so, notify the corresponding front-end R&D personnel or testers to achieve timely notification of interface change information. For specific timing diagrams, refer to Figure 4 shown.

[0140] Reference Figure 5 As shown, in this application, the JSON format information of each version of the interface definition is obtained by calling swagger uri, and it is stored in the MySQL relational database, thereby realizing the archiving and management of each version of the interface information during the development of the artificial intelligence platform product. Using the interface information comparison component swagger-compare, by receiving the interface definition information of the two versions to be compared, the interface information is compared, the interface definition and change information are generated, and it can be exported as an excel file. Thereby realizing the comparison of the interface changes between any two versions of the product, and generating the corresponding change result information, it is convenient for the research and development and test personnel related to product development to view. When there is a new version of the interface change, it is triggered by continuous integration cicd. When the new version of the code is built, the interface definition information of the previous version initialized in MySQL and the interface definition information of the current version are obtained, and the interface information comparison is completed through swagger-compare, and the generated interface information comparison results are notified to the relevant interface caller, and a reminder message is sent to the developer or relevant personnel. This can help developers to understand the changes in the interface in a timely manner, so as to make corresponding adjustments and optimizations, and ensure that the interface changes can be processed in a timely manner.

[0141] Second, please refer to Figure 6 The present invention also provides an interface management system, comprising:

[0142] A first acquisition module 11 is used to read first interface definition information corresponding to each application module in the reference version and second interface definition information corresponding to each application module in the comparison version from a preset storage space;

[0143] A first determining module 12 is used to determine, for each application module, a first request list based on the first interface definition information and a second request list based on the second interface definition information, wherein the first request list includes all interfaces of the application module in the reference version and the second request list includes all interfaces of the application module in the comparison version;

[0144] The generation module 13 is used to compare the interfaces in the first request list and the interfaces in the second request list corresponding to each application module, determine the changed interface of the application module according to the comparison result, and generate a change list based on the change information of the changed interface so as to perform adaptation operations based on the change list.

[0145] It can be seen that in this embodiment, the interface system of each application module in each version is stored in the preset storage space, which realizes the archiving and management of each version of interface information during the platform product development process, and obtains the changed interface of the application module by comparing the interface definition information of the reference version and the comparison version of the same application module. The interface changes of each application module are independently identified, which reduces the complexity of identification and improves the identification efficiency. A change list including the change information of all changed interfaces is automatically generated, so that the interface changes of each application module are clear and convenient for testers to perform corresponding adaptation operations according to the change list, which reduces the difficulty of updating test cases and improves the efficiency of interface adaptation and testing.

[0146] In an exemplary embodiment, before reading the first interface definition information corresponding to each application module in the reference version and the second interface definition information corresponding to each application module in the comparison version from the preset storage space, the interface management system further includes:

[0147] The second acquisition module is used to acquire the interface definition information of each application module in each version;

[0148] The storage module is used to store the interface definition information of each version in a preset storage space in a preset data exchange format, and the reference version and the comparison version are two versions determined from all versions based on the user selection instruction.

[0149] In an exemplary embodiment, for each application module, the process of obtaining the interface definition information of the application module in each version includes:

[0150] Generate an interface corresponding to each application module to obtain a uniform resource identifier;

[0151] A request is sent to the interface acquisition uniform resource identifier corresponding to each application module to obtain the interface definition information of each application module in each version.

[0152] In an exemplary embodiment, the interface management system further includes:

[0153] A creation module is used to create an interface information table in a preset storage space, wherein each data storage column corresponding to the interface information table includes an independent label, an application module, a version, an interface definition content, and an information generation time;

[0154] The process of storing the interface definition information of each version in a preset data exchange format in a preset storage space includes:

[0155] The interface definition information of each version is written into the corresponding data storage column in a preset data exchange format.

[0156] In an exemplary embodiment, for each application module, a process of determining a first request list based on first interface definition information and determining a second request list based on second interface definition information includes:

[0157] For each application module, deserialize the first interface definition information to obtain a first interface definition object, and deserialize the second interface definition information to obtain a second interface definition object;

[0158] The first interface definition object includes a first request list, and the second interface definition object includes a second request list.

[0159] In an exemplary embodiment, a comparison operation is performed on the interface in the first request list and the interface in the second request list corresponding to each application module, and a changed interface of the application module is determined according to the comparison result. The process of generating a changed list based on the change information of the changed interface includes:

[0160] For each application module, determine whether the application module has a first interface and / or a second interface; the first interface is an interface that exists in the first request list but does not exist in the second request list, and the second interface is an interface that does not exist in the first request list but exists in the second request list;

[0161] If any application module has the first interface, determine the first interface as a changed interface of the application module, and write the changed information of the first interface into the deleted interface list;

[0162] If any application module has a second interface, the second interface is determined as a changed interface of the application module, and the change information of the second interface is written into the newly added interface list;

[0163] Get the change list based on the deleted interface list and the added interface list.

[0164] In an exemplary embodiment, the interface management system further includes:

[0165] The adding module is used to add a first note to the first interface and a second note to the second interface in the change list after obtaining the change list based on the deleted interface list and the newly added interface list, so as to perform an adaptation operation based on the first note and / or the second note in the change list.

[0166] In an exemplary embodiment, a comparison operation is performed on the interface in the first request list and the interface in the second request list corresponding to each application module, and a process of determining the changed interface of the application module according to the comparison result further includes:

[0167] For each application module, determine whether the application module has a third interface; the third interface is an interface that exists in both the first request list and the second request list;

[0168] If so, determining whether there is change information of the third interface according to the first interface definition object and the second interface definition object;

[0169] When there is change information on the third interface, the third interface is determined as a change interface of the application module, and the change information on the third interface is written into the modified interface list;

[0170] The process of obtaining the change list based on the deleted interface list and the added interface list includes:

[0171] A change list is obtained based on the deleted interface list, the added interface list and the modified interface list.

[0172] In an exemplary embodiment, the first interface definition object includes a first interface parameter definition list and a first interface return information definition, and the second interface definition object includes a second interface parameter definition list and a second interface return information definition;

[0173] The process of judging whether there is change information of the third interface according to the first interface definition object and the second interface definition object includes:

[0174] Determine whether the first interface parameter definition list and the second interface parameter definition list are the same;

[0175] If they are not the same, it is determined that there is change information in the third interface;

[0176] If they are the same, it is determined that there is no change information on the third interface;

[0177] Determine whether the first interface return information definition and the second interface return information definition are the same;

[0178] If not, determining that there is change information on the third interface;

[0179] If so, it is determined that there is no change information on the third interface.

[0180] In an exemplary embodiment, the process of reading the first interface definition information corresponding to each application module in the reference version and the second interface definition information corresponding to each application module in the comparison version from the preset storage space includes:

[0181] When the code construction of any business module of the new version is completed, the first interface definition information corresponding to the application module in the reference version and the second interface definition information corresponding to the application module in the new version are read from the preset storage space;

[0182] After determining the changed interface of the application module according to the comparison results, the interface management system also includes:

[0183] The prompt module is used to generate notifications corresponding to the changed interfaces.

[0184] In an exemplary embodiment, the process of generating a notification corresponding to a changed interface includes:

[0185] Get the uniform resource identifier corresponding to each changed interface;

[0186] Pull the front-end code and automated test code to generate a code file list;

[0187] Traverse the code file list according to the uniform resource identifier, and determine whether there is a reference to the string fragment of the uniform resource identifier in the code file;

[0188] If so, a notification corresponding to the changed interface is generated.

[0189] In a third aspect, the present invention further provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the interface management method described in any one of the embodiments above.

[0190] For an introduction to a computer program product provided by the present invention, please refer to the above embodiments, and this application will not go into details here.

[0191] A computer program product provided by the present invention has the same beneficial effects as the above interface management method.

[0192] Fourth, please refer to Figure 7 The present invention also provides an electronic device, comprising:

[0193] A memory 21, used for storing computer programs;

[0194] The processor 22 is configured to implement the steps of the interface management method described in any one of the above embodiments when executing a computer program.

[0195] The electronic device also includes:

[0196] The input interface 23 is connected to the processor 22 via the communication bus 26, and is used to obtain the computer programs, parameters and instructions imported from the outside, and save them in the memory 21 under the control of the processor 22. The input interface can be connected to an input device to receive parameters or instructions manually input by the user. The input device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the terminal housing.

[0197] The display unit 24 is connected to the processor 22 via the communication bus 26 and is used to display the data sent by the processor 22. The display unit can be a liquid crystal display or an electronic ink display.

[0198] The network port 25 is connected to the processor 22 via the communication bus 26, and is used to communicate with various external terminal devices. The communication technology used in the communication connection can be a wired communication technology or a wireless communication technology, such as mobile high-definition link technology, universal serial bus, high-definition multimedia interface, wireless fidelity technology, Bluetooth communication technology, low-power Bluetooth communication technology, communication technology based on IEEE802.11s, etc.

[0199] For an introduction to an electronic device provided by the present invention, please refer to the above embodiments, and this application will not go into details here.

[0200] The electronic device provided by the present invention has the same beneficial effects as the above interface management method.

[0201] Fifth, please refer to Figure 8 The present invention further provides a computer-readable storage medium 30, on which a computer program 31 is stored. When the computer program 31 is executed by a processor, the steps of the interface management method described in any one of the above embodiments are implemented.

[0202] The computer-readable storage medium 30 may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media 30 that can store program 31 codes.

[0203] For an introduction to a computer-readable storage medium provided by the present invention, please refer to the above embodiments, and this application will not go into details here.

[0204] A computer-readable storage medium provided by the present invention has the same beneficial effects as the above-mentioned interface management method.

[0205] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0206] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An interface management method, characterized in that: include: Reading from a preset storage space the first interface definition information corresponding to each application module in the reference version and the second interface definition information corresponding to each application module in the comparison version; For each of the application modules, determine a first request list based on the first interface definition information, and determine a second request list based on the second interface definition information, wherein the first request list includes all interfaces of the application module in the reference version, and the second request list includes all interfaces of the application module in the comparison version; Comparing the interfaces in the first request list and the interfaces in the second request list corresponding to each of the application modules, determining the changed interfaces of the application modules according to the comparison results, and generating a change list based on the change information of the changed interfaces, so as to perform an adaptation operation based on the change list; the changed interfaces include interfaces that exist in the first request list but not in the second request list and / or interfaces that do not exist in the first request list but exist in the second request list; For each of the application modules, a process of determining a first request list based on the first interface definition information and determining a second request list based on the second interface definition information includes: For each of the application modules, deserialize the first interface definition information to obtain a first interface definition object, and deserialize the second interface definition information to obtain a second interface definition object; The first interface definition object includes the first request list, and the second interface definition object includes the second request list.

2. The interface management method according to claim 1, characterized in that: Before reading the first interface definition information corresponding to each application module in the reference version and the second interface definition information corresponding to each application module in the comparison version from the preset storage space, the interface management method further includes: For each of the application modules, obtaining interface definition information of the application module in each version; The interface definition information of each version is stored in the preset storage space in a preset data exchange format, and the reference version and the comparison version are two versions determined from all the versions based on a user selection instruction.

3. The interface management method according to claim 2, characterized in that: For each of the application modules, the process of obtaining the interface definition information of the application module in each version includes: Generate an interface corresponding to each of the application modules to obtain a uniform resource identifier; A request is sent to the interface acquisition uniform resource identifier corresponding to each of the application modules to obtain the interface definition information of each of the application modules in each version.

4. The interface management method according to claim 2, characterized in that: The interface management method further includes: Creating an interface information table in the preset storage space, wherein each data storage column corresponding to the interface information table includes an independent label, the application module, version, interface definition content and information generation time; The process of storing the interface definition information of each version in the preset storage space in a preset data exchange format includes: The interface definition information of each version is written into the corresponding data storage column in a preset data exchange format.

5. The interface management method according to claim 1, characterized in that: The process of comparing the interface in the first request list and the interface in the second request list corresponding to each of the application modules, determining the changed interface of the application module according to the comparison result, and generating the changed list based on the changed information of the changed interface includes: For each of the application modules, determine whether the application module has a first interface and / or a second interface; the first interface is an interface that exists in the first request list and does not exist in the second request list, and the second interface is an interface that does not exist in the first request list and exists in the second request list; If any of the application modules has the first interface, determine the first interface as a changed interface of the application module, and write the changed information of the first interface into a deleted interface list; If any of the application modules has the second interface, determine the second interface as a changed interface of the application module, and write the changed information of the second interface into a newly added interface list; A change list is obtained based on the deleted interface list and the newly added interface list.

6. The interface management method according to claim 5, characterized in that: After obtaining the change list based on the deleted interface list and the newly added interface list, the interface management method further includes: In the change list, a first remark is added to the first interface, and a second remark is added to the second interface, so that an adaptation operation is performed based on the first remark and / or the second remark in the change list.

7. The interface management method according to claim 5, characterized in that: The process of comparing the interface in the first request list and the interface in the second request list corresponding to each of the application modules, and determining the changed interface of the application module according to the comparison result further includes: For each of the application modules, determining whether the application module has a third interface; the third interface is an interface that exists in both the first request list and the second request list; If so, determining whether there is change information of the third interface according to the first interface definition object and the second interface definition object; When there is change information of the third interface, determining the third interface as the change interface of the application module, and writing the change information of the third interface into the modified interface list; The process of obtaining a change list based on the deleted interface list and the newly added interface list includes: A change list is obtained based on the deleted interface list, the newly added interface list and the modified interface list.

8. The interface management method according to claim 7, characterized in that: The first interface definition object includes a first interface parameter definition list and a first interface return information definition, and the second interface definition object includes a second interface parameter definition list and a second interface return information definition; The process of judging whether there is change information of the third interface according to the first interface definition object and the second interface definition object includes: Determining whether the first interface parameter definition list and the second interface parameter definition list are the same; If they are not the same, determining that there is change information of the third interface; If they are the same, determining that there is no change information of the third interface; Determine whether the first interface return information definition and the second interface return information definition are the same; If not, determining that there is change information of the third interface; If so, it is determined that there is no change information for the third interface.

9. The interface management method according to any one of claims 1 to 8, characterized in that: The process of reading the first interface definition information corresponding to each application module in the reference version and the second interface definition information corresponding to each application module in the comparison version from the preset storage space includes: When the code construction of any business module of the new version is completed, the first interface definition information corresponding to the application module in the reference version and the second interface definition information corresponding to the application module in the new version are read from the preset storage space; After determining the changed interface of the application module according to the comparison result, the interface management method further includes: A notification corresponding to the changed interface is generated.

10. The interface management method according to claim 9, characterized in that: The process of generating a notification corresponding to the changed interface includes: Obtaining a uniform resource identifier corresponding to each of the change interfaces; Pull the front-end code and automated test code to generate a code file list; Traversing the code file list according to the uniform resource identifier, determining whether there is a reference to a string segment of the uniform resource identifier in the code file; If so, a notification corresponding to the changed interface is generated.

11. An interface management system, characterized in that: include: A first acquisition module, configured to read, from a preset storage space, first interface definition information corresponding to each application module in the reference version and second interface definition information corresponding to each application module in the comparison version; A first determining module is configured to determine, for each of the application modules, a first request list based on the first interface definition information, and a second request list based on the second interface definition information, wherein the first request list includes all interfaces of the application module in the reference version, and the second request list includes all interfaces of the application module in the comparison version; A generation module, used to compare the interfaces in the first request list and the interfaces in the second request list corresponding to each of the application modules, determine the changed interfaces of the application modules according to the comparison results, and generate a change list based on the change information of the changed interfaces, so as to perform an adaptation operation based on the change list; the changed interfaces include interfaces that exist in the first request list but not in the second request list and / or interfaces that do not exist in the first request list but exist in the second request list; For each of the application modules, a process of determining a first request list based on the first interface definition information and determining a second request list based on the second interface definition information includes: For each of the application modules, deserialize the first interface definition information to obtain a first interface definition object, and deserialize the second interface definition information to obtain a second interface definition object; The first interface definition object includes the first request list, and the second interface definition object includes the second request list.

12. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the interface management method as described in any one of claims 1-10 are implemented.

13. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the interface management method according to any one of claims 1 to 10 when executing the computer program.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the interface management method according to any one of claims 1 to 10 are implemented.