CN114356404A - Interface document generating method, system and computer readable storage medium - Google Patents

Interface document generating method, system and computer readable storage medium Download PDF

Info

Publication number
CN114356404A
CN114356404A CN202210015720.XA CN202210015720A CN114356404A CN 114356404 A CN114356404 A CN 114356404A CN 202210015720 A CN202210015720 A CN 202210015720A CN 114356404 A CN114356404 A CN 114356404A
Authority
CN
China
Prior art keywords
parameters
parameter
interface
original
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210015720.XA
Other languages
Chinese (zh)
Inventor
李�昊
王保庆
白桦
杨立民
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BOE Technology Group Co Ltd
Beijing BOE Health Technology Co Ld
Original Assignee
BOE Technology Group Co Ltd
Beijing BOE Health Technology Co Ld
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BOE Technology Group Co Ltd, Beijing BOE Health Technology Co Ld filed Critical BOE Technology Group Co Ltd
Priority to CN202210015720.XA priority Critical patent/CN114356404A/en
Publication of CN114356404A publication Critical patent/CN114356404A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Document Processing Apparatus (AREA)

Abstract

The present disclosure provides an interface document generation method, system and computer-readable storage medium, wherein the interface document generation method includes: extracting original parameter information of an interface from an interface code, wherein the original parameter information comprises a plurality of original parameters; performing parameter analysis on each original parameter according to a preset mapping template to obtain interpretation information of each original parameter, wherein the mapping template comprises different fields and corresponding interpretation information; and generating an interface document according to the interpretation information of each original parameter. The technical scheme disclosed by the invention can automatically generate the interface document under the condition that the interface code does not have annotation information, so that the manual intervention cost can be greatly reduced, and the phenomenon that the interface document needs to depend on the annotation information strongly when being generated is avoided.

Description

Interface document generating method, system and computer readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and a system for generating an interface document, and a computer-readable storage medium.
Background
In the interface development process, developers need to provide complete interface documents. Manual writing of interface documents wastes development time for developers, is inefficient, and is prone to errors. Some existing automatic generation tools also need to compile configuration files manually, and the efficiency is not improved obviously enough; in addition, some automated generation tools require the introduction of additional annotations to mark the interface, which can be somewhat intrusive to the original system.
Disclosure of Invention
The present invention is directed to at least one of the technical problems in the prior art, and provides an interface document generation method, an interface document generation system, and a computer-readable storage medium.
In a first aspect, an embodiment of the present disclosure provides an interface document generating method, including:
extracting original parameter information of an interface from an interface code, wherein the original parameter information comprises a plurality of original parameters;
performing parameter analysis on each original parameter according to a preset mapping template to obtain interpretation information of each original parameter, wherein the mapping template comprises different fields and corresponding interpretation information;
and generating an interface document according to the interpretation information of each original parameter.
In some embodiments, the plurality of original parameters includes: request parameters and response parameters.
In some embodiments, the number of the request parameters is multiple, and the number of the response parameters is multiple;
after the step of extracting the original parameter information of the interface from the interface code and before the step of performing parameter analysis on each original parameter according to a preset mapping template, the method further comprises the following steps:
constructing a data hierarchy tree structure on the plurality of request parameters to obtain a hierarchy relation among the request parameters, and constructing a data hierarchy tree structure on the plurality of response parameters to obtain a hierarchy relation among the response parameters;
the interface document is internally recorded with the hierarchical relationship between the request parameters and the hierarchical relationship between the response parameters.
In some embodiments, the step of constructing a data hierarchy tree structure for a plurality of said request parameters comprises:
storing the flattened request parameters by using a temporary table, and converting the flattened request parameters into a tree structure by using a recursion method;
the step of constructing a data hierarchy tree structure for a plurality of the response parameters comprises:
and storing the flattened multiple response parameters by using a temporary table, and converting the flattened multiple response parameters into a tree structure by using a recursive method.
In some embodiments, in the process of converting the flattened request parameters or the flattened response parameters into the tree structure by using a recursive method, if the request parameters or the response parameters to be processed currently are identified as generic set type parameters and test data of the generic set type parameters exists, determining child nodes of nodes corresponding to the generic set type parameters according to the test data.
In some embodiments, the plurality of original parameters includes: an interface address.
The method for analyzing the parameters of the interface address according to the preset mapping template comprises the following steps:
dividing the interface address according to separators in the interface address to obtain a plurality of character strings;
performing parameter analysis on each character string by using the mapping template to obtain interpretation information of each character string;
and obtaining the interpretation information of the interface address based on the interpretation information of each character string.
In some embodiments, the interface document generation method further comprises:
obtaining request examples and/or response examples from a test cache;
the request examples and/or the response examples are/is loaded within the interface document.
In some embodiments, the plurality of original parameters includes: the type of interface.
In some embodiments, after the step of generating an interface document according to the interpretation information of each of the original parameters, the method further includes:
and responding to a modification instruction to correspondingly modify the interface document.
In a second aspect, an embodiment of the present disclosure further provides an interface document generation system for implementing the method provided in the first aspect, including:
an extraction module configured to extract original parameter information of an interface from an interface code, the original parameter information including a plurality of original parameters;
the analysis module is configured to perform parameter analysis on each original parameter according to a preset mapping template to obtain interpretation information of each original parameter, wherein the mapping template comprises different fields and corresponding interpretation information;
and the generating module is configured to generate an interface document according to the interpretation information of each original parameter.
In a third aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, where a computer executing instruction is stored in the computer-readable storage medium, and when a processor executes the computer executing instruction, the method provided in the first aspect is implemented.
Drawings
Fig. 1 is a flowchart of an interface document generating method according to an embodiment of the present disclosure;
FIG. 2 is a flow chart of another interface document generation method provided by the embodiment of the present disclosure;
FIG. 3 is a flowchart of a further interface document generation method provided by an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a data hierarchy tree structure for request parameters according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of a data hierarchy tree structure for response parameters in an embodiment of the present disclosure;
FIG. 6 is a schematic illustration of generating an interface document in an embodiment of the disclosure;
FIG. 7 is a flowchart of a further interface document generation method provided by an embodiment of the present disclosure;
fig. 8 is a block diagram of an interface document generation system according to an embodiment of the present disclosure.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the following describes an interface document generating method, an interface document generating system and a computer readable storage medium provided by the present invention in detail with reference to the accompanying drawings.
Fig. 1 is a flowchart of an interface document generation method provided in an embodiment of the present disclosure, and as shown in fig. 1, the interface document generation method includes:
and step S1, extracting the original parameter information of the interface from the interface code.
After a developer completes an Interface code of an Application Programming Interface (API), original parameter information of the Interface may be extracted based on the Interface code, where the original parameter information includes a plurality of original parameters.
In the embodiment of the present disclosure, the original parameter information of the interface refers to information used for describing the interface attribute in the interface code; such as interface address, interface type, request parameters, response parameters.
The interface address is essentially a Uniform Resource Locator (URL) for uniquely identifying a Resource, and a demand party can obtain corresponding content by calling the URL; the interface type (also called request mode) generally includes the following four cases: post (newly added), Put (modified), Delete (deleted) and Get (acquired); the request parameter refers to a parameter (field in essence) required to be requested to the interface; response parameters refer to parameters (essentially fields) returned by the interface.
In practical application, the required original parameter information can be extracted according to actual needs (for example, contents required to be described in an interface document). Specifically, the extraction of the original parameter information may be performed by some existing parameter extraction tools, or may be performed by a custom extraction algorithm.
And step S2, analyzing the parameters of the original parameters according to the preset mapping template to obtain the explanation information of the original parameters.
The mapping template can be designed and stored in advance, and comprises different fields and corresponding interpretation information; the interpretation information may be used to describe the meaning represented by the corresponding field. For example, the interpretation information may be used in Chinese to describe the meaning of the field. In step S2, interpretation information of each original parameter can be obtained based on the preset mapping template, and the obtained interpretation information can be used to describe the meaning represented by the original parameter.
Taking the mapping template as the mapping correspondence table as an example, table 1 below exemplifies a case where different fields and interpretation information corresponding to each field are recorded in one mapping correspondence table.
Field(s) Interpreting information
user User' s
pagelist Paging query
add Adding new
update Updating
delete Deleting
query Query
TABLE 1 mapping correspondence table of different fields and interpretation information corresponding to each field
Step S3, generating an interface document according to the interpretation information of each original parameter.
In step S3, a corresponding interface document may be generated based on the parsing result obtained in step S2, and the interface document at least includes each original parameter and its corresponding interpretation information.
Based on the above content, it can be seen that in the technical scheme of the present disclosure, the original parameters of the interface are extracted, the parameter analysis is performed on each original parameter according to the mapping template, and the interface document is automatically generated according to the interpretation information of each original parameter, so that the interface document is automatically generated under the condition that the interface code has no annotation information, the manual intervention cost can be greatly reduced, and the phenomenon that the interface document needs to depend on the annotation information strongly when being generated is avoided.
Fig. 2 is a flowchart of another interface document generation method provided by the embodiment of the disclosure, and as shown in fig. 2, in some embodiments, the original parameter information of the interface extracted by step S1 includes a plurality of request parameters and a plurality of response parameters, and in this case, step S1a is further included between step S1 and step S2.
Step S1a, constructing a data hierarchy tree structure for the plurality of request parameters to obtain a hierarchical relationship between the request parameters, and constructing a data hierarchy tree structure for the plurality of response parameters to obtain a hierarchical relationship between the response parameters.
At this time, the hierarchical relationship between the request parameters and the hierarchical relationship between the response parameters may also be described in the interface document in step S3.
In practical application, the request parameter or the response parameter is a generic set type parameter, and a hierarchical relationship exists between the response parameters or between the response parameters; after the extraction of the original parameter information is completed through step S1, the hierarchical relationship between the request parameters and the hierarchical relationship between the response parameters are restored through step S1a, and the hierarchical relationship is recorded in the interface document, so that the developer can accurately restore the generic set type parameters based on the interface document. The technical scheme provided by the embodiment of the disclosure can be suitable for the interface with the generic set type parameters.
In some embodiments, the step of building a data hierarchy tree structure for the plurality of request parameters in step S1a includes: storing the flattened request parameters by using a temporary table, and converting the flattened request parameters into a tree structure by using a recursion method; the step of constructing a data hierarchy tree structure for the plurality of response parameters in step S1a includes: and storing the flattened multiple response parameters by using a temporary table, and converting the flattened multiple response parameters into a tree structure by using a recursive method. By the method, the hierarchical structure construction of the request parameters or the response parameters with the parameter types of the generic set types can be realized. It should be noted that the specific process of converting the flattened data into the tree structure by using the recursive method is conventional in the art, and will not be described in detail herein.
In some embodiments, in the process of converting the flattened request parameters or the flattened response parameters into the tree structure by using a recursive method, if the request parameters or the response parameters to be processed at present are identified as generic set type parameters and test data of the generic set type parameters exists, child nodes of nodes corresponding to the generic set type parameters are determined according to the test data.
Generally, after the writing of the interface code is completed, the interface test is performed, and both the request parameters and the response parameters used in the interface test process are recorded and cached. That is, in the interface testing process, if the generic set type parameter is tested, all the parameters included in the generic set type parameter and the hierarchical relationship of the parameters are recorded, and at this time, the data structure of the generic set type parameter can be obtained based on the test data, that is, all the child nodes using the generic set type parameter as the parent node in the tree structure and the hierarchical relationship between the child nodes are obtained. In the embodiment of the present disclosure, the way of determining the child nodes of the node corresponding to the generic set type parameter based on the test data can effectively reduce the data processing amount in the recursive processing process.
In some embodiments, the step of performing parameter resolution on the request parameter/response parameter according to the preset mapping template in step S2 includes: and inquiring interpretation information corresponding to the fields of the request parameters/response parameters from the mapping template aiming at each request parameter/response parameter.
In some embodiments, each request parameter, the interpretation information corresponding to each request parameter, and the hierarchical relationship between the request parameters may be presented in a list form in the interface document; and presenting each response parameter, the interpretation information corresponding to each response parameter and the hierarchical relation among the response parameters in a list form in the interface document.
In some embodiments, the original parameter information of the interface extracted by step S1 includes: an interface address. The step of performing parameter resolution on the interface address according to the preset mapping template in step S2 includes: dividing the interface address according to a separator (the separator in the interface address is generally a slash "/") in the interface address to obtain a plurality of character strings; performing parameter analysis on each character string by using the mapping template to obtain interpretation information of each character string; and obtaining the interpretation information of the interface address based on the interpretation information of each character string.
As an example interface address: the interface address is divided into two character strings of 'user' and 'add', then the explanation information corresponding to 'user' is 'new', the explanation information corresponding to 'add' is 'user' and the interface address is finally obtained based on the mapping template shown in table 1: the interpretation information corresponding to the user/add is 'new user'.
Similarly, the interface address is: the interpretation information corresponding to the user/query is 'query user', and the interface address is: the interpretation information corresponding to the user/pagelist is 'paging inquiry user', and the interface address is as follows: the interpretation information corresponding to the user/update is 'update user', and the interface address is: the interpretation information corresponding to/user/delete is "delete user".
In some embodiments, the original parameter information of the interface extracted by step S1 includes: the type of interface.
Fig. 3 is a flowchart of another interface document generation method provided in the embodiment of the present disclosure, and as shown in fig. 3, the interface document generation method includes steps S1 to S3, and further includes steps S1b and S3 a.
And step S1b, obtaining the request examples and/or the response examples from the test cache.
Step S3a, the request example and/or the response example are/is set in the interface document.
After the interface test is completed, the test data comprises the request examples and the response examples, and the request examples and the response examples in the test data can be recorded in the interface document to serve as the interface examples without additionally writing the interface examples.
In some embodiments, step S1b may be performed in synchronization with step S1 or step S1a, and step S3a may be performed in synchronization with step S3. Of course, in the embodiment of the present disclosure, it is only necessary to ensure that step S1b is executed before step S3 a.
In order to make the technical solutions of the present disclosure more clearly understood by those skilled in the art, the interface document generation method provided in the present disclosure will be described in detail below with reference to an example.
If the original parameter information of the interface is extracted from the interface code through step S1 as follows:
the interface address is: address 1;
the interface types are: type 1;
the request parameters are:
parameter A (parameter a1, parameter a2, parameter a3, parameter a4)
Parameter a3 (parameter a3_1, parameter a3_2, parameter a3_3)
Parameter a3_2 (parameter a3_2_1, parameter a3_2_2)
Parameter a4 (parameter a4_1, parameter a4_2)
Parameter B (parameter B1, parameter B2);
a parameter C;
the response parameters are:
parameter D (parameter D1, parameter D2, parameter D3)
Parameter d2 (parameter d2_1, parameter d2_2)
Parameter d2_1 (parameter d2_1_1)
A parameter E;
wherein, the parameter A, the parameter B and the parameter D are all generic set parameters; specifically, the parameter a includes a1, a2, a3 and a4, the parameter a3 is a generic set class parameter, the parameter a3 includes a3_1, a3_2 and a3_3, the parameter a3_2 is a generic set class parameter, the parameter a3_2 includes a3_2_1 and a3_2, the parameter a4 is a generic set class parameter, and the parameter a4 includes a4_1 and a4_ 2; the parameter B comprises a parameter B1 and a parameter B2; the parameter D comprises a parameter D1, a parameter D2 and a parameter D3, the parameter D2 is a generic set class parameter, the parameter D2 comprises a parameter D2_1 and a parameter D2_2, the parameter D2_1 is a generic set class parameter, and the parameter D2_1 comprises a parameter D2_1_1 and a parameter D2_1_ 1.
The parameter types of the parameter C, the parameter E, the parameter a1, the parameter a2, the parameter a3_1, the parameter a3_2_1, the parameter a3_2_2, the parameter a3_3, the parameter a4_1, the parameter a4_2, the parameter b1, the parameter b2, the parameter d1 and the parameter d3 are respectively and independently selected from conventional data types, such as String type, Long type, Integer type and the like.
Note that both the request parameter and the response parameter acquired in step S1 are flattened data.
Fig. 4 is a schematic diagram of constructing a data hierarchy tree structure for request parameters in the embodiment of the present disclosure, and as shown in fig. 4, a tree structure corresponding to a request parameter can be obtained by constructing a data hierarchy tree structure for a plurality of request parameters in step 1a, the number of layers of the tree structure is five, and request parameters corresponding to each layer may be as shown in fig. 4. At this time, the tree structure constructed by the request parameter may be expressed as: (parameter a1, parameter a2, parameter a3 (parameter a3_1, parameter a3_2 (parameter a3_2_1, parameter a3_2_2), parameter a3_3), parameter a4 (parameter a4_1, parameter a4_2)), parameter B (parameter B1, parameter B2, parameter C).
Fig. 5 is a schematic diagram of constructing a data hierarchy tree structure for response parameters in the embodiment of the present disclosure, and fig. 5 shows that a tree structure corresponding to a response parameter can be obtained by constructing a data hierarchy tree structure for a plurality of response parameters in step 1a, the number of layers of the tree structure is five, and the response parameters corresponding to each layer can be as shown in fig. 5. At this time, the tree structure constructed by the response parameters may be expressed as: (parameter D (parameter D1, parameter D2 (parameter D2_1 (parameter D2_1_1, parameter D2_1_1), parameter D2_2), parameter D3), parameter E).
Through the step 1a, the generic set type parameters in the interface code can be accurately restored, so that the technical scheme disclosed by the invention can be suitable for the scene of the interface with the generic set type parameters. Of course, those skilled in the art should understand that the step 1a is performed between the step S1 and the step S2 as an alternative embodiment in the present disclosure, and the step 1a may not be performed in some embodiments.
Then, a mapping template can be configured in advance to analyze the parameters of the original parameters to obtain the explanation information of the original parameters. In the case of parameter analysis, each parameter included in the set class parameter is also analyzed for the set class parameter. In practical application, when interface codes of different interfaces are processed to generate corresponding interface documents, the same mapping template or different mapping templates can be used for the adopted mapping templates, and a proper mapping template can be configured under specific conditions.
In addition, request examples and/or response examples may also be retrieved from a test cache.
Fig. 6 is a schematic diagram of generating an interface document according to an embodiment of the present disclosure, and as shown in fig. 6, in step S3, the interface document is generated according to an interface address, an interface type, a request parameter, a response parameter and its corresponding interpretation information, a request example, and a response example. The interface document is loaded with an interface address and interpretation information corresponding to the interface address, an interface type and interpretation information corresponding to the interface type, each request parameter and interpretation information corresponding to the request parameter (the content in the interface document may also reflect the hierarchical relationship between the request eucalyptus), each response parameter and interpretation information corresponding to the response parameter (the content in the interface document may also reflect the hierarchical relationship between the response parameters), a request example and a response example.
The use of a tree hierarchy table to expose request and response parameters is shown only by way of example in fig. 6 and serves only as an example. The tree-shaped hierarchical structure table can intuitively embody the hierarchical relationship between the request parameters and the hierarchical relationship between the response parameters.
Of course, when the original parameter information is extracted in step S1, not only the fields corresponding to the request parameters and the response parameters, but also the corresponding parameter types may be extracted, and the parameter types of the request parameters and the response parameters may be recorded in the interface document in the process of generating the interface document.
Fig. 7 is a flowchart of still another interface document generation method provided by the embodiment of the disclosure, and as shown in fig. 7, the interface document generation method includes steps S1 to S3 in the foregoing embodiment, and further includes, after step S3: step S4.
Step S4, the interface document is modified accordingly in response to the modification instruction.
After the system generates the interface document according to the interpretation information of each original parameter, the user can modify the generated interface document, and the system responds to the modification instruction to correspondingly modify the interface document. Of course, the user can also confirm the final interface document by operation.
It should be noted that different steps in the above embodiments may be combined with each other, and the technical solutions obtained by the combination also belong to the scope of the present disclosure. For example, in some embodiments, the generation method of the interface document includes step S1, step S1a, step S1b, step S2, step S3 and step S3a, and other combination schemes are not described herein by way of example.
Based on the same inventive concept, the embodiment of the present disclosure further provides an interface document generation system, which can be used to implement the interface document generation method provided by the foregoing embodiment. Fig. 8 is a block diagram of an interface document generating system according to an embodiment of the present disclosure, and as shown in fig. 8, the interface document generating system includes: the device comprises an extraction module 1, an analysis module 2 and a generation module 3.
The extraction module 1 is configured to extract original parameter information of an interface from an interface code, wherein the original parameter information comprises a plurality of original parameters; the analysis module 2 is configured to perform parameter analysis on each original parameter according to a preset mapping template to obtain interpretation information of each original parameter, wherein the mapping template comprises different fields and corresponding interpretation information; the generating module 3 is configured to generate an interface document according to the interpretation information of each original parameter.
For the specific working process of each module, reference may be made to the specific description of the corresponding step in the foregoing embodiment, which is not described herein again.
It should be noted that the extraction module 1 in the embodiment of the present disclosure may be specifically configured to implement step S1, step S1a, and step S1b in the foregoing embodiment; the parsing module 2 in the embodiment of the present disclosure may be specifically configured to implement step S2 in the foregoing embodiment; the generating module 3 in the embodiment of the present disclosure may specifically implement step S3 and step S3a in the foregoing embodiment by a user.
In some embodiments, the interface document generation system may further include a modification module 4, the modification module 4 being configured to make corresponding modifications to the interface document in response to the modification instructions. The modification module 4 is specifically operable to implement step S4 in the foregoing embodiment.
As an application scenario, the extraction module 1 may be set at a client in the form of an "application plug-in", the parsing module 2 and the generation module 3 may be set at a management end (e.g., a service cloud end), and the management end implements functions of parameter parsing and interface document generation; of course, the analysis module 2 and the generation module 3 may also be disposed at the client; these conditions are all intended to fall within the scope of the present disclosure.
Based on the same inventive concept, embodiments of the present disclosure further provide a computer-readable storage medium, where a computer execution instruction is stored in the computer-readable storage medium, and when a processor executes the computer execution instruction, the technical solution of the interface document generation method in any of the above embodiments is implemented, and the implementation principle and the beneficial effect of the interface document generation method are similar to those of the interface document generation method, which can be referred to as the implementation principle and the beneficial effect of the interface document generation method, and are not described herein again.
One of ordinary skill in the art will appreciate that all or some of the steps of the methods, systems, functional blocks in the systems disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between functional modules referred to in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as is well known to those of ordinary skill in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to those skilled in the art.
Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted in a generic and descriptive sense only and not for purposes of limitation. In some instances, features, characteristics and/or elements described in connection with a particular embodiment may be used alone or in combination with features, characteristics and/or elements described in connection with other embodiments, unless expressly stated otherwise, as would be apparent to one skilled in the art. Accordingly, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the disclosure as set forth in the appended claims.

Claims (11)

1. An interface document generation method, comprising:
extracting original parameter information of an interface from an interface code, wherein the original parameter information comprises a plurality of original parameters;
performing parameter analysis on each original parameter according to a preset mapping template to obtain interpretation information of each original parameter, wherein the mapping template comprises different fields and corresponding interpretation information;
and generating an interface document according to the interpretation information of each original parameter.
2. The method of claim 1, wherein the plurality of original parameters comprises: request parameters and response parameters.
3. The method of claim 2, wherein the number of the request parameters is plural, and the number of the response parameters is plural;
after the step of extracting the original parameter information of the interface from the interface code and before the step of performing parameter analysis on each original parameter according to a preset mapping template, the method further comprises the following steps:
constructing a data hierarchy tree structure on the plurality of request parameters to obtain a hierarchy relation among the request parameters, and constructing a data hierarchy tree structure on the plurality of response parameters to obtain a hierarchy relation among the response parameters;
the interface document is internally recorded with the hierarchical relationship between the request parameters and the hierarchical relationship between the response parameters.
4. The method of claim 3, wherein the step of constructing a data hierarchy tree structure for a plurality of said request parameters comprises:
storing the flattened request parameters by using a temporary table, and converting the flattened request parameters into a tree structure by using a recursion method;
the step of constructing a data hierarchy tree structure for a plurality of the response parameters comprises:
and storing the flattened multiple response parameters by using a temporary table, and converting the flattened multiple response parameters into a tree structure by using a recursive method.
5. The method according to claim 4, wherein in the process of converting the flattened request parameters or the flattened response parameters into the tree structure by using a recursive method, if the request parameters or the response parameters to be processed currently are identified as generic set class parameters and there is test data of the generic set class parameters, then determining child nodes of the nodes corresponding to the generic set class parameters according to the test data.
6. The method of claim 1, wherein the plurality of original parameters comprises: an interface address.
The method for analyzing the parameters of the interface address according to the preset mapping template comprises the following steps:
dividing the interface address according to separators in the interface address to obtain a plurality of character strings;
performing parameter analysis on each character string by using the mapping template to obtain interpretation information of each character string;
and obtaining the interpretation information of the interface address based on the interpretation information of each character string.
7. The method of claim 1, further comprising:
obtaining request examples and/or response examples from a test cache;
the request examples and/or the response examples are/is loaded within the interface document.
8. The method of claim 1, wherein the plurality of original parameters comprises: the type of interface.
9. The method according to any one of claims 1 to 8, further comprising, after the step of generating an interface document from the interpretation information of each of the original parameters:
and responding to a modification instruction to correspondingly modify the interface document.
10. An interface document generation system for implementing the method of any one of claims 1 to 9, comprising:
an extraction module configured to extract original parameter information of an interface from an interface code, the original parameter information including a plurality of original parameters;
the analysis module is configured to perform parameter analysis on each original parameter according to a preset mapping template to obtain interpretation information of each original parameter, wherein the mapping template comprises different fields and corresponding interpretation information;
and the generating module is configured to generate an interface document according to the interpretation information of each original parameter.
11. A computer-readable storage medium having computer-executable instructions stored thereon which, when executed by a processor, implement the method of any one of claims 1 to 9.
CN202210015720.XA 2022-01-07 2022-01-07 Interface document generating method, system and computer readable storage medium Pending CN114356404A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210015720.XA CN114356404A (en) 2022-01-07 2022-01-07 Interface document generating method, system and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210015720.XA CN114356404A (en) 2022-01-07 2022-01-07 Interface document generating method, system and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN114356404A true CN114356404A (en) 2022-04-15

Family

ID=81106345

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210015720.XA Pending CN114356404A (en) 2022-01-07 2022-01-07 Interface document generating method, system and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114356404A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115146604A (en) * 2022-07-01 2022-10-04 广州高专资讯科技有限公司 Interface technology document generation method, device, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115146604A (en) * 2022-07-01 2022-10-04 广州高专资讯科技有限公司 Interface technology document generation method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110147411B (en) Data synchronization method, device, computer equipment and storage medium
US10324909B2 (en) Omega names: name generation and derivation utilizing nested three or more attributes
CN108089893B (en) Method and device for determining redundant resources, terminal equipment and storage medium
CN109254907B (en) Java-based interface test report generation method and system
US7769719B2 (en) File system dump/restore by node numbering
CN111061643B (en) SDK cluster compatibility detection method and device, electronic equipment and storage medium
CN107783770B (en) Page configuration updating method, device, server and medium
US9483508B1 (en) Omega names: name generation and derivation
CN110941629B (en) Metadata processing method, apparatus, device and computer readable storage medium
CN115543402B (en) Software knowledge graph increment updating method based on code submission
CN111737227A (en) Data modification method and system
CN110866024A (en) Vector database increment updating method and system
CN113282799B (en) Node operation method, node operation device, computer equipment and storage medium
CN114356404A (en) Interface document generating method, system and computer readable storage medium
CN111159142B (en) Data processing method and device
CN109947739B (en) Data source management method and device
CN111176901A (en) HDFS deleted file recovery method, terminal device and storage medium
CN115238655A (en) Json data editing method and device
CN115599295A (en) Node capacity expansion method and device of storage system
CN115017161A (en) Method, device and application for updating tree data structure by combining virtual DOM
CN114816364A (en) Method, device and application for dynamically generating template file based on Swagger
CN113792026A (en) Deployment method and device of database script and computer readable storage medium
CN110727726A (en) Method and system for extracting data from document type database to relational database
CN112379891B (en) Data processing method and device
CN114089976B (en) Method, apparatus, and medium for generating database operation statements

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination