Interface management method, device, equipment and computer-readable storage medium

Through the interface management method, the troublesome and inefficient problems of application developers in writing interface documents are solved, and the unified format and efficient generation of interface documents are realized.

CN110309099BActive Publication Date: 2025-05-06WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201910584231.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-06-28
Publication Date
2025-05-06
Estimated Expiration
2039-06-28

AI Technical Summary

Technical Problem

Currently, application developers are troublesome to write interface documents. The interface documents are written inefficiently, and the format of the resulting interface documents is not uniform.

Method used

Provide an interface management method, including receiving interface document generation requests, determining interface identity and document type, querying the annotation object storage database to obtain interface annotations and parameter annotations, and processing parameter annotations based on the document type to generate interface documents.

Benefits of technology

It reduces the workload of developers, improves the efficiency of generating interface documents, and makes the generated interface documents uniform format, making it easier for different developers to read.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110309099B_ABST
    Figure CN110309099B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of financial technology (Fintech), and the present invention discloses an interface management method, which includes the following steps: upon receiving an interface document generation request, determining an interface identifier and a document type corresponding to the interface document generation request; querying a preset annotation object storage database, obtaining an interface annotation corresponding to the interface identifier, and determining an interface parameter contained in the interface annotation; obtaining a parameter annotation corresponding to each interface parameter in the annotation object storage database, and processing the parameter annotation according to the document type to generate an interface document. The present invention also discloses an interface management device, an apparatus, and a computer-readable storage medium. The present invention generates an interface document in a unified format.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of financial technology (Fintech), and in particular to an interface management method, device, equipment and computer-readable storage medium. Background Art

[0002] With the rapid development of Internet technology, especially Internet financial technology (Fintech), more and more technologies are applied in the financial field, making the traditional financial industry gradually transform into financial technology (Finteh), and interface management technology is no exception. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology; that is, there are more and more financial business applications. Before the development of current financial business applications, application developers are required to pre-define the interface documents of the applications. The writing of interface documents is relatively troublesome, which increases the workload of developers, and the interface documents written by different application developers cannot be unified. Summary of the invention

[0003] The main purpose of the present invention is to propose an interface management method, device, equipment and computer-readable storage medium, aiming to solve the technical problems that the current application developers have to deal with the troublesome operation of writing interface documents, the low efficiency of interface document writing, and the inconsistent format of the written interface documents.

[0004] To achieve the above object, the present invention provides an interface management method, which comprises the following steps:

[0005] Upon receiving an interface document generation request, determining an interface identifier and a document type corresponding to the interface document generation request;

[0006] Query a preset annotation object storage database to obtain the interface annotation corresponding to the interface identifier;

[0007] Determine the interface parameters contained in the interface annotation, and obtain the parameter annotation corresponding to each of the interface parameters in the annotation object storage database;

[0008] The parameter annotation is processed according to the document type to generate an interface document.

[0009] Optionally, before the step of determining the interface identifier and document type corresponding to the interface document generation request when receiving the interface document generation request, the step includes:

[0010] When an interface definition request is received, an interface definition window is output to prompt the developer to input interface annotations of each interface, wherein the interface annotations include: interface ID, interface name and interface type;

[0011] Receiving interface annotations of each interface input based on the interface definition window, obtaining interface parameters contained in the interface annotations, and outputting a parameter definition window to prompt the developer to input parameter annotations of each interface parameter, wherein the parameter annotations include: field name, field description, field type, field length, and whether it is required to be input;

[0012] When it is detected that the interface definition is completed, the interface annotation and the parameter annotation corresponding to each interface are obtained, and the interface annotation and the parameter annotation are saved to a preset annotation object storage database.

[0013] Optionally, the step of processing the parameter annotation according to the document type to generate an interface document includes:

[0014] If the document type is an EXCEL type, then the parameter annotations are combined into a string sequence, and the string sequences are written into an EXCEL template to generate an interface document in an EXCEL format;

[0015] If the document type is Markdown type, each parameter annotation is converted into a text string according to the Markdown format, and each text string is written into the Showdoc template to generate an interface document in the Showdoc format.

[0016] Optionally, the interface management method includes:

[0017] Upon receiving an interface parameter verification request, obtaining a target interface parameter to be verified corresponding to the interface parameter verification request;

[0018] Query a preset annotation object storage database to obtain the target parameter annotation corresponding to the target interface parameter, and determine whether the target interface parameter conforms to the target parameter annotation;

[0019] If the target interface parameters conform to the target parameter annotations, the output parameter verification passes;

[0020] If the target interface parameters do not conform to the target parameter annotations, the output parameter check fails.

[0021] Optionally, the interface management method further includes:

[0022] Upon receiving an interface test request, obtaining a target interface identifier to be tested corresponding to the interface test request;

[0023] Query a preset annotation object storage database to obtain the interface annotation and parameter annotation corresponding to the target interface identifier;

[0024] Configure a parameter generator according to the interface annotation and the parameter annotation, and generate an interface test value through the parameter generator;

[0025] The target interface corresponding to the target interface identifier is tested according to the interface test value to obtain an interface test result, and a test report including the interface test result is generated.

[0026] Optionally, the step of configuring a parameter generator according to the interface annotation and the parameter annotation, and generating an interface test value through the parameter generator includes:

[0027] Determine the interface level of the interface corresponding to the target interface identifier according to the interface annotation;

[0028] If the interface level is the first level, generating a fixed parameter generator according to the parameter annotation configuration, and generating a first interface test value through the fixed parameter generator;

[0029] If the interface level is the second level, a random parameter generator is generated according to the parameter annotation configuration, and a second interface test value is generated by the random parameter generator;

[0030] If the interface level is the third level, a model parameter generator is generated according to the parameter annotation configuration, and a third interface test value is generated through the model parameter generator.

[0031] Optionally, the step of testing the target interface corresponding to the target interface identifier according to the interface test value, obtaining an interface test result, and generating a test report including the interface test result includes:

[0032] Obtain the number of interfaces corresponding to the target interface identifier;

[0033] When the number of interfaces is greater than a preset threshold, submitting the test task thread carrying the interface test value to the thread pool;

[0034] Execute each of the test task threads in the thread pool, obtain the interface test results of the target interfaces corresponding to each of the target interface identifiers, and generate a test report corresponding to the interface test results.

[0035] In addition, to achieve the above object, the present invention further provides an interface management device, the interface management device comprising:

[0036] A request receiving module, used for determining the interface identifier and document type corresponding to the interface document generation request upon receiving the interface document generation request;

[0037] A first acquisition module is used to query a preset annotation object storage database to acquire the interface annotation corresponding to the interface identifier;

[0038] A second acquisition module is used to determine the interface parameters contained in the interface annotation, and obtain the parameter annotation corresponding to each of the interface parameters in the annotation object storage database;

[0039] A document generation module is used to process the parameter annotation according to the document type to generate an interface document.

[0040] Optionally, the interface management device includes:

[0041] The interface definition module is used to output an interface definition window when receiving an interface definition request to prompt the developer to input interface annotations of each interface, wherein the interface annotations include: interface ID, interface name and interface type;

[0042] A parameter definition module, used to receive the interface annotation of each interface input based on the interface definition window, obtain the interface parameters contained in the interface annotation, and output a parameter definition window to prompt the developer to input the parameter annotation of each interface parameter, wherein the parameter annotation includes: field name, field description, field type, field length and whether it is required to be input;

[0043] The data saving module is used to obtain the interface annotations and the parameter annotations corresponding to each interface when it is detected that the interface definition is completed, and save the interface annotations and the parameter annotations to a preset annotation object storage database.

[0044] Optionally, the document generation module includes:

[0045] The first generating unit is used for combining the parameter annotations into a string sequence if the document type is an EXCEL type, and writing the string sequence into an EXCEL template to generate an interface document in an EXCEL format;

[0046] The second generating unit is used for converting each parameter annotation into a text string according to the Markdown format if the document type is the Markdown type, and writing each text string into the Showdoc template to generate an interface document in the Showdoc format.

[0047] Optionally, the interface management device includes:

[0048] A parameter verification module, configured to, upon receiving an interface parameter verification request, obtain a target interface parameter to be verified corresponding to the interface parameter verification request;

[0049] A query and judgment module, used for querying a preset annotation object storage database, obtaining a target parameter annotation corresponding to the target interface parameter, and judging whether the target interface parameter conforms to the target parameter annotation;

[0050] A first determination module, configured to determine that the output parameter verification is passed if the target interface parameter conforms to the target parameter annotation;

[0051] The second determination module is used to determine that the output parameter check fails if the target interface parameter does not conform to the target parameter annotation.

[0052] Optionally, the interface management device includes:

[0053] The interface test module is used to obtain the target interface identifier to be tested corresponding to the interface test request when receiving the interface test request;

[0054] An annotation acquisition module is used to query a preset annotation object storage database to obtain the interface annotation and parameter annotation corresponding to the target interface identifier;

[0055] A test value generation module, used to configure a parameter generator according to the interface annotation and the parameter annotation, and generate an interface test value through the parameter generator;

[0056] The report generating module is used to test the target interface corresponding to the target interface identifier according to the interface test value, obtain the interface test result, and generate a test report including the interface test result.

[0057] Optionally, the test value generating module includes:

[0058] A level determination unit, configured to determine an interface level of an interface corresponding to the target interface identifier according to the interface annotation;

[0059] A first generating unit, configured to generate a fixed parameter generator according to the parameter annotation configuration if the interface level is the first level, and generate a first interface test value through the fixed parameter generator;

[0060] A second generating unit is used for generating a random parameter generator according to the parameter annotation configuration if the interface level is the second level, and generating a second interface test value through the random parameter generator;

[0061] The third generating unit is used to generate a model parameter generator according to the parameter annotation configuration if the interface level is the third level, and generate a third interface test value through the model parameter generator.

[0062] Optionally, the report generating module includes:

[0063] A quantity acquisition unit, used to acquire the number of interfaces corresponding to the target interface identifier;

[0064] A task submission unit, used for submitting the test task thread carrying the interface test value to the thread pool when the number of the interfaces is greater than a preset threshold;

[0065] The task execution unit is used to execute each of the test task threads in the thread pool, obtain the interface test results of the target interfaces corresponding to each of the target interface identifiers, and generate a test report corresponding to the interface test results.

[0066] In addition, to achieve the above-mentioned purpose, the present invention also provides an interface management device, which includes: a memory, a processor, and an interface management program stored in the memory and executable on the processor, and the interface management program implements the steps of the interface management method described above when executed by the processor.

[0067] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which an interface management program is stored, and when the interface management program is executed by a processor, the steps of the interface management method described above are implemented.

[0068] The present invention provides an interface management method, apparatus, device and computer-readable storage medium. In an embodiment of the present invention, when receiving an interface document generation request, the interface management device determines the interface identifier and document type corresponding to the interface document generation request; queries a preset annotation object storage database, obtains the interface annotation corresponding to the interface identifier, and determines the interface parameters contained in the interface annotation; obtains the parameter annotation corresponding to each of the interface parameters in the annotation object storage database, and processes the parameter annotation according to the document type to generate an interface document. In this embodiment, the interface management device obtains the interface annotation in the annotation object storage database, and accurately obtains the interface parameters corresponding to the interface and the parameter annotation corresponding to the interface parameters according to the interface annotation, and generates a standardized interface document using the parameter annotation; in the embodiment of the present invention, developers are not required to manually edit the interface document, which reduces the workload of developers and improves the efficiency of interface document generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;

[0070] Figure 2 This is a flow chart of the first embodiment of the interface management method of the present invention;

[0071] Figure 3 This is a flow chart of a third embodiment of the interface management method of the present invention;

[0072] Figure 4 It is a schematic diagram of functional modules of an embodiment of an interface management device of the present invention.

[0073] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0074] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0075] like Figure 1 As shown, Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.

[0076] The interface management device in the embodiment of the present invention may be a PC or a server.

[0077] like Figure 1 As shown, the interface management device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0078] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation of the device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0079] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an interface management program.

[0080] exist Figure 1In the device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the interface management program stored in the memory 1005 and execute the operations in the following interface management method.

[0081] Based on the above hardware structure, an embodiment of the interface management method of the present invention is proposed.

[0082] The first embodiment of the interface management method of the present invention includes:

[0083] Upon receiving an interface document generation request, determining an interface identifier and a document type corresponding to the interface document generation request;

[0084] Query a preset annotation object storage database to obtain the interface annotation corresponding to the interface identifier;

[0085] Determine the interface parameters contained in the interface annotation, and obtain the parameter annotation corresponding to each of the interface parameters in the annotation object storage database;

[0086] The parameter annotation is processed according to the document type to generate an interface document.

[0087] In this embodiment, the software developer predefines the formats of all interfaces and all interface parameters, specifically including:

[0088] Step a1, when receiving an interface definition request, output an interface definition window to prompt the developer to input interface annotations of each interface, wherein the interface annotations include: interface ID (identification interface identifier), interface name and interface type;

[0089] Step a2, receiving the interface annotation of each interface input based on the interface definition window, obtaining the interface parameters contained in the interface annotation, and outputting a parameter definition window to prompt the developer to input the parameter annotation of each interface parameter, wherein the parameter annotation includes: field name, field description, field type, field length and whether it is required to be input;

[0090] Step a3, when it is detected that the interface definition is completed, the interface annotation and the parameter annotation corresponding to each interface are obtained, and the interface annotation and the parameter annotation are saved to a preset annotation object storage database.

[0091] In this embodiment, the interface management device prompts the developer to define standardized interface annotations through the interface definition window, prompts the developer to define standardized parameter annotations through the parameter definition window, and saves the standardized interface annotations and parameter annotations to a preset annotation object storage database; the preset annotation object storage database stores the formats of all interfaces and all interface parameters, so as to generate an interface document in a unified format according to the standardized interface annotations and parameter annotations, specifically:

[0092] Reference Figure 2 , Figure 2 This is a flow chart of a first embodiment of an interface management method of the present invention, wherein the interface management method comprises:

[0093] Step S10: upon receiving an interface document generation request, determining an interface identifier and a document type corresponding to the interface document generation request.

[0094] The interface management method of this embodiment is applied to an interface management device, which can be set in a financial institution (bank, insurance, securities, etc.) in the financial industry. The interface management device receives an interface document generation request, and the triggering method of the interface document generation request is not specifically limited, that is, the interface document generation request can be actively triggered by the user, for example, a software developer triggers an interface document generation request based on a predefined interface; in addition, the interface document generation request can also be automatically triggered, for example, when the interface management device detects that the interface definition is completed, it automatically triggers the interface document generation request.

[0095] When the interface management device receives an interface document generation request, the interface management device obtains the interface identifier and document type corresponding to the interface document generation request. The interface identifier refers to the identification information for identifying the interface. The number of interfaces involved in the interface document generation request is not specifically limited, that is, the interface can be one or more; the document type includes TXT type, EXCEL type, or Showdoc type.

[0096] Step S20, querying a preset annotation object storage database, obtaining the interface annotation corresponding to the interface identifier, and determining the interface parameters contained in the interface annotation.

[0097] The interface management device traverses the preset annotation object storage database to obtain the interface annotation corresponding to the interface identifier, where the interface annotation includes but is not limited to the interface ID, interface name and interface type, so that the interface management device determines the interface parameters corresponding to the interface identifier based on the obtained interface annotation, and generates the interface document based on the parameter annotation corresponding to the interface parameters.

[0098] Step S30, determining the interface parameters contained in the interface annotation, and obtaining the parameter annotation corresponding to each of the interface parameters in the annotation object storage database;

[0099] The interface management device determines the interface parameters included in the interface annotation, specifically including:

[0100] Implementation method 1: The interface annotation includes an interface ID and an interface parameter mapping table. After the interface management device obtains the interface annotation, the interface management device queries the interface ID and the interface parameter mapping table to obtain the interface parameters included in the interface annotation.

[0101] Implementation method 2: An interface parameter set is set in the interface annotation, and the interface management device obtains each interface parameter contained in the interface parameter set;

[0102] For example, the interface management device determines, based on the interface annotation of the bank account balance query interface, that the interface annotation includes a bank account parameter, a verification code parameter, and the like.

[0103] In this embodiment, a predefined standardized interface annotation is obtained by querying a preset annotation object storage database, and the interface parameters corresponding to the interface are determined according to the interface annotation. Then, the interface management device obtains the parameter annotation corresponding to the interface parameter in the annotation object storage database to generate a standardized interface document according to the parameter annotation, that is,

[0104] Step S40: Process the parameter annotation according to the document type to generate an interface document

[0105] The interface management device determines whether the document type is an EXCEL type or a Markdown type (Markdown is a lightweight markup language) to generate a corresponding interface document, specifically including:

[0106] Step b1, if the document type is EXCEL type, then combine the parameter annotations into a string sequence, and write the string sequence into an EXCEL template to generate an interface document in EXCEL format;

[0107] Step b2: If the document type is Markdown type, each parameter annotation is converted into a text string according to the Markdown format, and each text string is written into the Showdoc template to generate an interface document in the Showdoc format.

[0108] This embodiment specifically provides two methods for generating interface documents for document types, that is, if the document type is an EXCEL type, the interface management device combines the parameter annotations corresponding to each interface parameter into a string sequence, the interface management device adds the string sequence to a row of an EXCEL cell, and the interface management device writes a row of each EXCEL cell into an EXCEL template to generate an interface document in an EXCEL format; if the document type is a Markdown type, the interface management device generates a text string in the Markdown format for the parameter annotations corresponding to each interface parameter, and writes the generated text string into a Showdoc template to generate an interface document in a Showdoc format.

[0109] In this embodiment, the interface management device obtains the interface annotation in the annotation object storage database, and accurately obtains the interface parameters corresponding to the interface and the parameter annotations corresponding to the interface parameters based on the interface annotations, and generates a standardized interface document using the parameter annotations; in this embodiment of the present invention, there is no need for developers to manually edit interface documents, which reduces the workload of developers and improves the efficiency of interface document generation.

[0110] The above-mentioned interface document generation method is adopted in financial institutions such as banks, so that the format of the generated interface documents is unified, the workload of financial structure application developers is reduced, and the efficiency of interface document generation is improved. At the same time, the interface documents in a unified format can be easily read by different developers in different financial institutions.

[0111] Furthermore, based on the first embodiment of the interface management method of the present invention, a second embodiment of the interface management method of the present invention is proposed.

[0112] The difference between this embodiment and the first embodiment is that this embodiment specifically describes the interface parameter test using the generated standardized interface document, specifically including:

[0113] When an interface parameter verification request is received, a target interface parameter to be verified corresponding to the interface parameter verification request is obtained.

[0114] The interface management device interface parameter verification request, wherein the triggering method of the interface parameter verification request is not specifically limited, that is, the interface parameter verification request can be actively triggered by the user, for example, each time the interface developer sets an interface parameter, he clicks the "interface parameter verification" button to trigger the interface parameter verification request; in addition, the interface parameter verification request can also be automatically triggered, for example, the user sends a bank account balance query instruction to the bank business processor, and the interface management device in front of the bank business processor intercepts the bank account balance query instruction and obtains the interface parameters in the bank account balance query instruction (the interface parameters include: bank card account number and customer phone number, etc.), and automatically triggers the interface parameter verification request.

[0115] When the interface management device receives the interface parameter verification request, the interface management device obtains the target interface parameter to be verified corresponding to the interface parameter verification request to verify the target interface parameter, specifically:

[0116] A preset annotation object storage database is queried to obtain the target parameter annotation corresponding to the target interface parameter, and it is determined whether the target interface parameter conforms to the target parameter annotation.

[0117] The interface management device queries the preset annotation object storage database to obtain the target parameter annotation corresponding to the target interface parameter. Then, the interface management device determines whether the target interface parameter to be verified conforms to the target parameter annotation. For example, the interface management device obtains the interface parameter as bank card 6217xxxx xxxx395. The interface management device obtains the parameter annotation corresponding to the bank card account number: field name: bank card account number, field length 19 digits, field type number, required input. The interface management device determines whether 6217xxxx xxxx395 conforms to the target parameter annotation to output the parameter verification result.

[0118] The interface parameter verification scheme in this embodiment is applied in the financial field. By verifying the interface parameters, operation requests with irregular interface parameters can be effectively intercepted, and the amount of operation requests can be reduced, thereby improving the efficiency of financial business processing operations.

[0119] If the target interface parameters conform to the target parameter annotations, the output parameter verification passes.

[0120] If the target interface parameter conforms to the target parameter annotation, that is, the field name, field description, field type and field length corresponding to the target interface parameter are the same as the field name, field description, field type and field length in the target parameter annotation, the interface management device output parameter verification passes.

[0121] If the target interface parameters do not conform to the target parameter annotations, the output parameter check fails.

[0122] If the target interface parameters do not conform to the target parameter annotations, that is, the field name, field description, field type and field length corresponding to the target interface parameters are different from any one or more of the field name, field description, field type and field length in the target parameter annotations, the interface management device output parameter verification fails.

[0123] In this embodiment, when the interface management device receives an interface parameter verification request, the interface management device obtains the target interface parameters corresponding to the interface parameter verification request, and obtains the interface annotations corresponding to the target interface parameters in the interface document, so as to verify the interface parameters according to the interface annotations. In this embodiment, when the interface parameters are verified using the parameter annotations in the standardized interface document, on the one hand, it can ensure that the interface parameter verification is more comprehensive, and on the other hand, the interface management device can return the verification results of the interface parameters according to its parameter annotations, thereby effectively avoiding the situation where the verification results are returned in an irregular manner.

[0124] Further, refer to Figure 3 Based on the above-mentioned embodiments of the interface management method of the present invention, a third embodiment of the interface management method of the present invention is proposed.

[0125] The difference between this embodiment and the above embodiment is that this embodiment specifically describes the use of standardized interface annotations and parameter annotations to perform interface testing, specifically including:

[0126] Step S50: upon receiving an interface test request, obtaining a target interface identifier to be tested corresponding to the interface test request.

[0127] The interface management device receives an interface test request, and the triggering method for receiving the interface test request is not specifically limited, that is, the receiving interface test request can be actively triggered by the user, for example, the developer actively triggers the interface test request after developing a new interface; in addition, the receiving interface test request can also be automatically triggered, for example, when the interface management device detects a newly added interface, it automatically triggers the interface test request.

[0128] When the interface management device receives the interface test request, the interface management device obtains the target interface identifier to be tested corresponding to the interface test request to test the interface corresponding to the target interface identifier, specifically:

[0129] Step S60, querying a preset annotation object storage database to obtain the interface annotation and parameter annotation corresponding to the target interface identifier.

[0130] The interface management device queries a preset annotation object storage database, and obtains the interface annotation and parameter annotation corresponding to the target interface identifier, so as to automatically generate an interface test value corresponding to the target interface identifier according to the interface annotation and parameter annotation, and perform interface testing using the generated interface test value.

[0131] Step S70, configuring a parameter generator according to the interface annotation and the parameter annotation, and generating an interface test value through the parameter generator;

[0132] Specifically, it includes:

[0133] Step c1, determining the interface level of the interface corresponding to the target interface identifier according to the interface annotation;

[0134] Step c2: if the interface level is the first level, generating a fixed parameter generator according to the parameter annotation configuration, and generating a first interface test value through the fixed parameter generator;

[0135] Step c3: if the interface level is the second level, a random parameter generator is generated according to the parameter annotation configuration, and a second interface test value is generated by the random parameter generator;

[0136] Step c4: if the interface level is the third level, a model parameter generator is generated according to the parameter annotation configuration, and a third interface test value is generated through the model parameter generator.

[0137] The interface management device determines the interface level of the interface corresponding to the target interface identifier according to the interface annotation. Specifically, the interface management device obtains the interface type in the interface annotation, where the interface type can be divided according to different properties. For example, the interface type is divided into financial data input interface, financial data verification interface, etc. according to the interface business scenario. The interface management device determines the interface level of the interface corresponding to the target interface identifier according to the interface type.

[0138] If the interface level is the first level, that is, the interface management device determines that the impact range of the interface is small, the interface management device generates a fixed parameter generator according to the parameter annotation configuration (a fixed parameter generator refers to an algorithm used to generate a unique interface test value), and generates a first interface test value through the fixed parameter generator. For example, for a date verification interface in a financial institution, the interface management device configures a fixed parameter generator, and generates a fixed date corresponding to the current time as the first interface test value through the fixed parameter generator.

[0139] If the interface level is the second level, that is, the interface management device determines that the impact range of the interface is moderate, the interface management device generates a random parameter generator according to the parameter annotation configuration (the random parameter generator refers to the algorithm used to generate random interface test values), and generates a second interface test value through the random parameter generator. For example, for a bank card account verification interface in a financial institution, the interface management device configures a random parameter generator, and generates a bank card number as the second interface test value through the random parameter generator.

[0140] If the interface level is the third level, that is, the interface management device determines that the impact range of the interface is large, the interface management device generates a model parameter generator according to the parameter annotation configuration (the model parameter generator refers to a parameter generation algorithm that can intelligently generate different interface parameter values), and generates a third interface test value through the model parameter generator. For example, for a transfer amount verification interface in a financial institution, the interface management device configures the model parameter generator, and generates a transfer amount as the third interface test value through the model parameter generator.

[0141] Step S80, testing the target interface corresponding to the target interface identifier according to the interface test value, obtaining an interface test result, and generating a test report including the interface test result.

[0142] The interface management device tests the target interface corresponding to the target interface identifier according to the interface test value, that is, the interface management device inputs the generated interface test value into the interface corresponding to the target interface identifier, performs an interface test to obtain an interface test result, and the interface management device inputs the generated interface test result into a preset report template to generate a test report including the interface test result.

[0143] In this embodiment, the interface management device queries the preset annotation object storage database, obtains the interface annotation and parameter annotation corresponding to the target interface identifier, and performs interface testing based on the interface annotation and parameter annotation. In this embodiment, batch interfaces can be tested to ensure that all interfaces are tested, effectively avoiding test omissions.

[0144] Furthermore, based on the third embodiment of the interface management method of the present invention, a fourth embodiment of the interface management method of the present invention is proposed.

[0145] This embodiment is a refinement of step S80 in the third embodiment, and specifically includes:

[0146] Obtain the number of interfaces corresponding to the target interface identifier;

[0147] When the number of interfaces is greater than a preset threshold, submitting the test task thread carrying the interface test value to the thread pool;

[0148] Execute each of the test task threads in the thread pool, obtain the interface test results of the target interfaces corresponding to each of the target interface identifiers, and generate a test report corresponding to the interface test results.

[0149] The interface testing device obtains the number of interfaces corresponding to the target interface identifier and determines whether the number of interfaces is greater than a preset threshold, where the preset threshold can be set according to the specific scenario. For example, the preset threshold is set to 100. If the number of interfaces is less than or equal to the preset threshold, the interface management device performs a single test on the interface corresponding to the target interface identifier.

[0150] When the number of interfaces is greater than a preset threshold, that is, the interface management device determines that the number of interfaces to be tested is large, the interface management device submits the test task thread carrying the interface test value to the thread pool; the interface management device executes each test task thread in the thread pool to obtain the interface test result of the target interface corresponding to each target interface identifier, and the interface management device inputs the generated interface test result into a preset report template and generates a test report corresponding to the interface test result.

[0151] In this embodiment, the interface management device performs batch testing on interfaces by setting a test thread pool, thereby improving the test efficiency of the interface test.

[0152] Reference Figure 4 The present invention also provides an interface management device, the interface management device comprising:

[0153] The request receiving module 10 is used to determine the interface identifier and document type corresponding to the interface document generation request when receiving the interface document generation request;

[0154] A first acquisition module 20 is used to query a preset annotation object storage database to acquire the interface annotation corresponding to the interface identifier;

[0155] A second acquisition module 30 is used to determine the interface parameters contained in the interface annotation, and obtain the parameter annotation corresponding to each of the interface parameters in the annotation object storage database;

[0156] The document generation module 40 is used to process the parameter annotation according to the document type to generate an interface document.

[0157] In one embodiment, the interface management device includes:

[0158] The interface definition module is used to output an interface definition window when receiving an interface definition request to prompt the developer to input interface annotations of each interface, wherein the interface annotations include: interface ID, interface name and interface type;

[0159] A parameter definition module, used to receive the interface annotation of each interface input based on the interface definition window, obtain the interface parameters contained in the interface annotation, and output a parameter definition window to prompt the developer to input the parameter annotation of each interface parameter, wherein the parameter annotation includes: field name, field description, field type, field length and whether it is required to be input;

[0160] The data saving module is used to obtain the interface annotations and the parameter annotations corresponding to each interface when it is detected that the interface definition is completed, and save the interface annotations and the parameter annotations to a preset annotation object storage database.

[0161] In one embodiment, the document generation module 40 includes:

[0162] The first generating unit is used for combining the parameter annotations into a string sequence if the document type is an EXCEL type, and writing the string sequence into an EXCEL template to generate an interface document in an EXCEL format;

[0163] The second generating unit is used for converting each parameter annotation into a text string according to the Markdown format if the document type is the Markdown type, and writing each text string into the Showdoc template to generate an interface document in the Showdoc format.

[0164] In one embodiment, the interface management device includes:

[0165] A parameter verification module, configured to, upon receiving an interface parameter verification request, obtain a target interface parameter to be verified corresponding to the interface parameter verification request;

[0166] A query and judgment module, used for querying a preset annotation object storage database, obtaining a target parameter annotation corresponding to the target interface parameter, and judging whether the target interface parameter conforms to the target parameter annotation;

[0167] A first determination module, configured to determine that the output parameter verification is passed if the target interface parameter conforms to the target parameter annotation;

[0168] The second determination module is used to determine that the output parameter check fails if the target interface parameter does not conform to the target parameter annotation.

[0169] In one embodiment, the interface management device includes:

[0170] The interface test module is used to obtain the target interface identifier to be tested corresponding to the interface test request when receiving the interface test request;

[0171] An annotation acquisition module is used to query a preset annotation object storage database to obtain the interface annotation and parameter annotation corresponding to the target interface identifier;

[0172] A test value generation module, used to configure a parameter generator according to the interface annotation and the parameter annotation, and generate an interface test value through the parameter generator;

[0173] The report generating module is used to test the target interface corresponding to the target interface identifier according to the interface test value, obtain the interface test result, and generate a test report including the interface test result.

[0174] In one embodiment, the test value generating module includes:

[0175] A level determination unit, configured to determine an interface level of an interface corresponding to the target interface identifier according to the interface annotation;

[0176] A first generating unit, configured to generate a fixed parameter generator according to the parameter annotation configuration if the interface level is the first level, and generate a first interface test value through the fixed parameter generator;

[0177] A second generating unit is used for generating a random parameter generator according to the parameter annotation configuration if the interface level is the second level, and generating a second interface test value through the random parameter generator;

[0178] The third generating unit is used to generate a model parameter generator according to the parameter annotation configuration if the interface level is the third level, and generate a third interface test value through the model parameter generator.

[0179] In one embodiment, the report generation module includes:

[0180] A quantity acquisition unit, used to acquire the number of interfaces corresponding to the target interface identifier;

[0181] A task submission unit, used for submitting the test task thread carrying the interface test value to the thread pool when the number of the interfaces is greater than a preset threshold;

[0182] The task execution unit is used to execute each of the test task threads in the thread pool, obtain the interface test results of the target interfaces corresponding to each of the target interface identifiers, and generate a test report corresponding to the interface test results.

[0183] The methods executed by the above-mentioned program modules can refer to the various embodiments of the interface management method of the present invention, and will not be described in detail here.

[0184] The present invention also provides a computer-readable storage medium.

[0185] The computer-readable storage medium of the present invention stores an interface management program, and when the interface management program is executed by a processor, the steps of the interface management method described above are implemented.

[0186] Among them, the method implemented when the interface management program running on the processor is executed can refer to the various embodiments of the interface management method of the present invention, and will not be repeated here.

[0187] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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 system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0188] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0189] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0190] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. An interface management method, characterized in that: The interface management method comprises the following steps: Upon receiving an interface document generation request, determining an interface identifier and a document type corresponding to the interface document generation request; Query a preset annotation object storage database to obtain the interface annotation corresponding to the interface identifier; Determine the interface parameters contained in the interface annotation, and obtain the parameter annotation corresponding to each of the interface parameters in the annotation object storage database; Processing the parameter annotation according to the document type to generate an interface document; The interface management method further includes: Upon receiving an interface test request, obtaining a target interface identifier to be tested corresponding to the interface test request; Query a preset annotation object storage database to obtain the interface annotation and parameter annotation corresponding to the target interface identifier; Configure a parameter generator according to the interface annotation and the parameter annotation, and generate an interface test value through the parameter generator; Testing the target interface corresponding to the target interface identifier according to the interface test value to obtain an interface test result, and generating a test report including the interface test result; The step of configuring a parameter generator according to the interface annotation and the parameter annotation, and generating an interface test value through the parameter generator includes: Determine the interface level of the interface corresponding to the target interface identifier according to the interface annotation; If the interface level is the first level, generating a fixed parameter generator according to the parameter annotation configuration, and generating a first interface test value through the fixed parameter generator; If the interface level is the second level, a random parameter generator is generated according to the parameter annotation configuration, and a second interface test value is generated by the random parameter generator; If the interface level is the third level, a model parameter generator is generated according to the parameter annotation configuration, and a third interface test value is generated through the model parameter generator.

2. The interface management method according to claim 1, characterized in that: Before the step of determining the interface identifier and document type corresponding to the interface document generation request upon receiving the interface document generation request, the method includes: When an interface definition request is received, an interface definition window is output to prompt the developer to input interface annotations of each interface, wherein the interface annotations include: interface ID, interface name and interface type; Receiving interface annotations of each interface input based on the interface definition window, obtaining interface parameters contained in the interface annotations, and outputting a parameter definition window to prompt the developer to input parameter annotations of each interface parameter, wherein the parameter annotations include: field name, field description, field type, field length, and whether it is required to be input; When it is detected that the interface definition is completed, the interface annotation and the parameter annotation corresponding to each interface are obtained, and the interface annotation and the parameter annotation are saved to a preset annotation object storage database.

3. The interface management method according to claim 1, characterized in that: The step of processing the parameter annotation according to the document type to generate an interface document comprises: If the document type is an EXCEL type, then the parameter annotations are combined into a string sequence, and the string sequences are written into an EXCEL template to generate an interface document in an EXCEL format; If the document type is Markdown type, each parameter annotation is converted into a text string according to the Markdown format, and each text string is written into the Showdoc template to generate an interface document in the Showdoc format.

4. The interface management method according to claim 1, characterized in that: The interface management method comprises: Upon receiving an interface parameter verification request, obtaining a target interface parameter to be verified corresponding to the interface parameter verification request; Query a preset annotation object storage database to obtain the target parameter annotation corresponding to the target interface parameter, and determine whether the target interface parameter conforms to the target parameter annotation; If the target interface parameters conform to the target parameter annotations, the output parameter verification passes; If the target interface parameters do not conform to the target parameter annotations, the output parameter check fails.

5. The interface management method according to claim 1, characterized in that: The step of testing the target interface corresponding to the target interface identifier according to the interface test value, obtaining an interface test result, and generating a test report including the interface test result comprises: Obtain the number of interfaces corresponding to the target interface identifier; When the number of interfaces is greater than a preset threshold, submitting the test task thread carrying the interface test value to the thread pool; Execute each of the test task threads in the thread pool, obtain the interface test results of the target interfaces corresponding to each of the target interface identifiers, and generate a test report corresponding to the interface test results.

6. An interface management device, characterized in that: The interface management device comprises: A request receiving module, used for determining the interface identifier and document type corresponding to the interface document generation request upon receiving the interface document generation request; A first acquisition module is used to query a preset annotation object storage database to acquire the interface annotation corresponding to the interface identifier; A second acquisition module is used to determine the interface parameters contained in the interface annotation, and obtain the parameter annotation corresponding to each of the interface parameters in the annotation object storage database; A document generation module, used for processing the parameter annotation according to the document type to generate an interface document; The interface test module is used to obtain the target interface identifier to be tested corresponding to the interface test request when receiving the interface test request; An annotation acquisition module is used to query a preset annotation object storage database to obtain the interface annotation and parameter annotation corresponding to the target interface identifier; A test value generation module, used to configure a parameter generator according to the interface annotation and the parameter annotation, and generate an interface test value through the parameter generator; A report generating module, used for testing the target interface corresponding to the target interface identifier according to the interface test value, obtaining the interface test result, and generating a test report including the interface test result; The test value generation module includes: a level determination unit, used to determine the interface level of the interface corresponding to the target interface identifier according to the interface annotation; A first generating unit, configured to generate a fixed parameter generator according to the parameter annotation configuration if the interface level is the first level, and generate a first interface test value through the fixed parameter generator; A second generating unit is used for generating a random parameter generator according to the parameter annotation configuration if the interface level is the second level, and generating a second interface test value through the random parameter generator; The third generating unit is used to generate a model parameter generator according to the parameter annotation configuration if the interface level is the third level, and generate a third interface test value through the model parameter generator.

7. The interface management device according to claim 6, characterized in that: The interface management device comprises: The interface definition module is used to output an interface definition window when receiving an interface definition request to prompt the developer to input interface annotations of each interface, wherein the interface annotations include: interface ID, interface name and interface type; A parameter definition module, used to receive the interface annotation of each interface input based on the interface definition window, obtain the interface parameters contained in the interface annotation, and output a parameter definition window to prompt the developer to input the parameter annotation of each interface parameter, wherein the parameter annotation includes: field name, field description, field type, field length and whether it is required to be input; The data saving module is used to obtain the interface annotations and the parameter annotations corresponding to each interface when it is detected that the interface definition is completed, and save the interface annotations and the parameter annotations to a preset annotation object storage database.

8. The interface management device according to claim 6, characterized in that: The document generation module includes: The first generating unit is used for combining the parameter annotations into a string sequence if the document type is an EXCEL type, and writing the string sequence into an EXCEL template to generate an interface document in an EXCEL format; The second generating unit is used for converting each parameter annotation into a text string according to the Markdown format if the document type is the Markdown type, and writing each text string into the Showdoc template to generate an interface document in the Showdoc format.

9. The interface management device according to claim 6, characterized in that: The interface management device comprises: A parameter verification module, configured to, upon receiving an interface parameter verification request, obtain a target interface parameter to be verified corresponding to the interface parameter verification request; A query and judgment module, used for querying a preset annotation object storage database, obtaining a target parameter annotation corresponding to the target interface parameter, and judging whether the target interface parameter conforms to the target parameter annotation; A first determination module, configured to determine that the output parameter verification is passed if the target interface parameter conforms to the target parameter annotation; The second determination module is used to determine that the output parameter check fails if the target interface parameter does not conform to the target parameter annotation.

10. The interface management device according to claim 6, characterized in that: The report generation module comprises: A quantity acquisition unit, used to acquire the number of interfaces corresponding to the target interface identifier; A task submission unit, used for submitting the test task thread carrying the interface test value to the thread pool when the number of the interfaces is greater than a preset threshold; The task execution unit is used to execute each of the test task threads in the thread pool, obtain the interface test results of the target interfaces corresponding to each of the target interface identifiers, and generate a test report corresponding to the interface test results.

11. An interface management device, characterized in that: The interface management device comprises: a memory, a processor, and an interface management program stored in the memory and executable on the processor. When the interface management program is executed by the processor, the steps of the interface management method according to any one of claims 1 to 5 are implemented.

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

Citation Information

Patent Citations

  • Method, system and apparatus for generating interface document

    CN101499002A

  • Interface information management method and device, computer device, and storage medium

    CN109375901A