CN111240653B - Interface document generation method, device and readable storage medium - Google Patents

Interface document generation method, device and readable storage medium Download PDF

Info

Publication number
CN111240653B
CN111240653B CN201911418878.6A CN201911418878A CN111240653B CN 111240653 B CN111240653 B CN 111240653B CN 201911418878 A CN201911418878 A CN 201911418878A CN 111240653 B CN111240653 B CN 111240653B
Authority
CN
China
Prior art keywords
interface
identifier
version
target
service
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.)
Active
Application number
CN201911418878.6A
Other languages
Chinese (zh)
Other versions
CN111240653A (en
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.)
Ruiting Network Technology Shanghai Co ltd
Original Assignee
Ruiting Network Technology Shanghai Co ltd
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 Ruiting Network Technology Shanghai Co ltd filed Critical Ruiting Network Technology Shanghai Co ltd
Priority to CN201911418878.6A priority Critical patent/CN111240653B/en
Publication of CN111240653A publication Critical patent/CN111240653A/en
Application granted granted Critical
Publication of CN111240653B publication Critical patent/CN111240653B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Library & Information Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides an interface document generation method, an interface document generation device and a readable storage medium. The interface document generation method of the invention comprises the following steps: the method comprises the steps of obtaining a data packet of a first target service, wherein the data packet comprises class files corresponding to all interfaces of the first target service, one class file comprises at least one interface, analyzing various files to obtain interface codes of at least one interface included in the various files, extracting interface class information from the interface codes included in the various files, and generating a first interface document corresponding to each interface of the first target service according to the interface class information. Therefore, the interface document does not need to be manually written, so that the automatic generation of the interface document can be realized, time and labor are saved, and the problem that the interface document is easy to make mistakes when manually written is avoided.

Description

Interface document generation method, device and readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for generating an interface document, and a readable storage medium.
Background
In the development process of the service, the code corresponding to the service is usually required to be tested, and the code corresponding to the service is required to be tested according to the interface document when the code is tested.
At present, a developer writes an interface document according to information such as class names, method names, service names and the like applied when writing codes corresponding to services. Because the number of interfaces involved in the code is multiple, and under the condition that the number of interfaces is multiple, a corresponding interface document needs to be written for each interface, and therefore, the manual writing of the interface document causes the problems of high labor cost, long time consumption, low efficiency and easy error.
Disclosure of Invention
The embodiment of the invention provides a method and a device for generating an interface document and a readable storage medium, which are used for solving the problems of high labor cost, long time consumption, low efficiency and easy error caused by manually writing the interface document at present.
In a first aspect of an embodiment of the present invention, there is provided an interface document generating method, including:
acquiring a data packet of a first target service, wherein the data packet comprises class files corresponding to all interfaces of the first target service, and one class file comprises at least one interface;
analyzing each class file to obtain an interface code of the at least one interface included in each class file;
and extracting interface class information from the interface codes included in the class files to generate a first interface document corresponding to each interface of the first target service according to the interface class information.
In a second aspect of the embodiment of the present invention, there is provided an interface document generating apparatus, provided in a server, including:
the system comprises a first acquisition module, a second acquisition module and a first processing module, wherein the first acquisition module is used for acquiring a data packet of a first target service, the data packet comprises class files corresponding to all interfaces of the first target service, and one class file comprises at least one interface;
the analyzing module is used for analyzing each class file to obtain an interface code comprising at least one interface in each class file;
and the generation module is used for extracting interface class information from the interface codes included in the class files so as to generate a first interface document corresponding to each interface of the first target service according to the interface class information.
In a third aspect of the embodiments of the present invention, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the interface document generation method described above.
In a fourth aspect of the present invention, there is provided an interface document generation apparatus comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program implementing the steps of the interface document generation method described above when executed by the processor.
Aiming at the prior art, the invention has the following advantages:
according to the interface document generation method provided by the embodiment of the invention, the data package of the first target service is obtained, the data package comprises class files corresponding to all interfaces of the first target service, one class file comprises at least one interface, various files are analyzed to obtain interface codes of at least one interface included in various files, interface class information is extracted from the interface codes included in various files, and a first interface document corresponding to each interface of the first target service is generated according to the interface class information. Therefore, the interface document does not need to be manually written, so that the automatic generation of the interface document can be realized, time and labor are saved, and the problem that the interface document is easy to make mistakes when manually written is avoided.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 is a flowchart of steps in an interface document generation method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of another method for generating an interface document according to an embodiment of the present invention;
FIG. 3 is a flowchart showing steps for displaying a generated interface document according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an interface document generating device according to an embodiment of the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating steps of an interface document generating method according to an embodiment of the present invention, where the interface document generating method according to the embodiment is applicable to a case where an interface document is not required to be written manually. The method can be executed on a server, and the method of the embodiment comprises the following steps:
step 101, acquiring a data packet of a first target service, wherein the data packet comprises class files corresponding to all interfaces of the first target service, and one class file comprises at least one interface.
The data package may be a JAR package, and the JAR (Java ARchive) is a file format, and multiple files may be combined into one file, for example, a user may bind multiple class files (a class-tagged file into the JAR file, that is, form a JAR package).
And 102, analyzing various files to obtain interface codes of at least one interface included in the various files.
And 103, extracting interface class information from interface codes included in various files to generate a first interface document corresponding to each interface of the first target service according to the interface class information.
Wherein each interface corresponds to a first interface document, and the first interface documents corresponding to each interface are different.
The generated interface document comprises, for example, description information of the interface, class names of interface classes corresponding to the interface, method names, input parameters of methods corresponding to the method names, return parameters of the methods, version identifiers, and port identifiers and address identifiers corresponding to the service identifiers and the version identifiers. The description information indicates an annotation of an interface class corresponding to the interface, for example, the description information is "obtain city simple information according to an ID of a city a, return simple", input parameters are field name and type, return parameters are city name and city identifier, and the address identifier may be an internet protocol (IP, internet Protocol) address. The field name is, for example, cityIdSet, and the type is Long.
According to the interface document generation method provided by the embodiment, the data package of the first target service is obtained, the data package comprises class files corresponding to all interfaces of the first target service, one class file comprises at least one interface, the class files are analyzed to obtain interface codes of at least one interface included in the class files, interface class information is extracted from the interface codes included in the class files, and a first interface document corresponding to each interface of the first target service is generated according to the interface class information. Therefore, the interface document does not need to be manually written, so that the automatic generation of the interface document can be realized, time and labor are saved, and the problem that the interface document is easy to make mistakes when manually written is avoided.
Referring to fig. 2, fig. 2 is a flowchart showing steps of another method for generating an interface document according to an embodiment of the present invention, the method includes the steps of:
step 201, receiving a request message sent by a terminal.
The request message comprises a first target service identifier of the first target service, a first version identifier of the first target service and a storage address corresponding to both the first target service identifier and the first version identifier.
Step 202, obtaining a data packet of the first target service corresponding to both the first target service identifier and the first version identifier from a storage address of the code server.
And 203, analyzing various files to obtain interface codes of at least one interface included in the various files.
And 204, extracting interface class information from interface codes included in various files to generate a first interface document corresponding to each interface of the first target service according to the interface class information.
When the interface class information is extracted from the interface codes included in various files, the interface class information can be extracted from the interface codes included in various files according to the grammar tree. The interface class information comprises a class name, a method name, a first target service identifier, input parameters of a method corresponding to the method name, return parameters of the method, a first version identifier, and a port identifier and an address identifier corresponding to both the first target service identifier and the first version identifier, wherein the first version identifier is an identifier of a first version of the first target service. The address identification may be an IP address.
It should be noted that, since one class name and one method name can uniquely determine one interface, the interface code included in the class file can be analyzed, and the interface class information in the interface code included in the class file is obtained, so that the information of each interface included in the class file can be determined, and further, according to the information of each interface, a first interface document corresponding to each interface of the first version of the first target service is generated. The information of the interface includes, for example, information of an input parameter, a return parameter, a version identifier of the first target service, a port identifier, an address identifier, and the like of a method corresponding to the interface.
Step 205, storing a first interface document associated with the first target service identification, the first version identification, and an interface identification of the interface in a database.
After the first interface document is generated, the first interface document can be stored in a database, and the stored first interface document is associated with the first target service identifier, the first version identifier and the interface identifier of the interface, so that the interface document associated with the service identifier, the version identifier and the interface identifier selected by the user can be conveniently searched for later according to the service identifier, the version identifier and the interface identifier selected by the user.
For example, for steps 204 and 205, as shown in Table 1 below, the first target service identification is service 1, the first version of service 1 is version 1, the interface identifications of the interfaces of version 1 include interface A and interface B, the first interface document associated with service 1, version 1 and interface A is interface document A, and the first interface document associated with service 1, version 1 and interface B is interface document B.
TABLE 1
It should be noted that, if in step 201, the first target service included in the request message is service 1, the first version identifier of service 1 is version 2, and the storage addresses corresponding to both service 1 and version 2, the data packet of version 2 of service 1 is obtained from the storage address in step 202, and the first interface document corresponding to each interface of version 2 of service 1 is generated in steps 203 to 204.
And 206, scanning the data packet of the first target service stored on the code server at intervals of preset time to judge whether the data packet is updated or not according to the time information corresponding to the data packet.
Step 207, when it is determined that the data packet is updated, the updated data packet is acquired from the code server.
Step 208, analyzing the updated data packet to determine the target interface.
The target interface comprises an interface corresponding to a new class file in the updated data packet and/or an interface corresponding to an original class file changed in the updated data packet.
The target interface may only include an interface corresponding to the newly added class file, or the target interface only includes an interface corresponding to the original class file that is changed, or the target interface includes an interface corresponding to the newly added class file and an interface corresponding to the original class file. The original class file refers to a class file included in a data packet before the update data packet. For example, if the interface code of an interface in the original class file is changed, the interface is the target interface.
Step 209, extracting interface class information from the interface code of the target interface, so as to generate a second interface document corresponding to the target interface according to the interface class information corresponding to the interface code of the target interface.
The interface class information extracted from the interface code of the target interface is the interface class information corresponding to the interface code of the target interface. The data packet of the first target service is updated. For example, if a certain class file in the data packet is updated or if a class file is newly added in the data packet, the data packet of the first target service is updated. In order to avoid the problem that the interface document is not updated after the class file in the data packet is updated, so that a tester can not accurately write the test case according to the interface document, and the interface document corresponding to the newly added class file is avoided when the class file is newly added in the data packet. Through steps 206 through 209, generating a second interface document corresponding to the target interface may be implemented.
Therefore, the problem that the interface document is written manually after the class file in the data packet is updated and after the newly added class file is newly added by the first target service is solved. In this embodiment, the data packet of the first target service stored on the code server is scanned at each interval for a preset time, so that time information corresponding to the data packet can be obtained, if the time information is found to be updated, the data packet can be determined to be updated, in this case, the updated data packet can be downloaded again from the code server, and interface type information is extracted from the updated data packet, so as to determine the target interface.
For example, the class file in the updated data packet is compared with the class file in the data packet before the update, whether a new class file exists or not can be determined, if the new class file exists, interface class information is extracted for the interface code included in the new class file (that is, interface class information is extracted for the interface code of the target interface, the interface corresponding to the new class file is the target interface), and an interface document corresponding to the target interface is generated. If the new class file is not added, whether at least one kind of information such as class name, method name, input parameter, return parameter, port, IP address and the like in the original class file is changed can be judged, if at least one kind of information is changed, the fact that the original class file is changed (an interface corresponding to the changed original class file is a target interface) is meant, and then an interface document corresponding to the target interface is regenerated.
For example, as shown in table 2 below. For version 1 of service 1, if a new class file is added to version 1 of service 1, an interface identifier of an interface corresponding to the new class file is an interface C, and if an original class file is changed at the same time, for example, an interface identifier of an interface corresponding to the original class file is an interface a, an interface code corresponding to the interface a is changed, for example, any one of information such as an input parameter, a return parameter, a method name and the like in the interface code is changed, an interface corresponding to the interface C and an interface corresponding to the interface a are both target interfaces, and a second interface document C associated with each of service 1, version 1 and interface C is regenerated, and a second interface document A1 associated with each of service 1, version 1 and interface a is generated. The second interface document A1 and the second interface document C are regenerated interface documents.
TABLE 2
After the modification of the interface code corresponding to the interface a, since the second interface document A1 corresponding to the interface a is regenerated, the first interface document a corresponding to the interface a in table 1 is updated with the second interface document A1. Then if the user queries the interface document associated with service 1, version 1, interface a, then a second interface document A1 is queried. That is, the interface document can be updated in time along with the update of the interface code of the interface, so that the problem of test failure caused by writing a test case according to the previous interface document by a tester under the condition that the interface code is updated but the interface document is not updated is avoided.
Step 210, storing a second interface document associated with the first target service identification, the first version identification, and the interface identification of the target interface in a database.
After the second interface document is generated, the second interface document can be stored in the database, and the stored second interface document is associated with the first target service identifier, the first version identifier and the interface identifier of the target interface, so that the interface document associated with the service identifier, the version identifier and the interface identifier selected by the user can be conveniently searched for later according to the service identifier, the version identifier and the interface identifier selected by the user.
According to the interface document generation method, data packets of the first target service stored on the code server are scanned through preset time at each interval, whether the data packets are updated or not is judged according to time information corresponding to the data packets, under the condition that the data packets are updated, the updated data packets are obtained from the code server, the updated data packets are analyzed to determine a target interface, interface class information is extracted from interface codes of the target interface, a second interface document corresponding to the target interface is generated according to the interface class information corresponding to the interface codes of the target interface, and the second interface document which is associated with the first target service identifier, the first version identifier and the interface identifier of the target interface is stored in a database, so that timely updating of the interface document corresponding to the interface is achieved. That is, when the service interface is changed, the interface document corresponding to the changed interface can be automatically updated, and the interface document does not need to be written again manually.
It should be noted that the embodiment of the invention also provides a scheme for the user to inquire the generated interface document. Since the generated interface documents are all stored in the database and the generated first interface document is associated with the first target service identification, the first version identification and the interface identification of the interface, the generated second interface document is associated with the first target service identification, the first version identification and the interface identification of the target interface. The user can select the service identifier, the version identifier corresponding to the service identifier and the interface identifier corresponding to the version identifier, and the server can uniquely determine an interface document according to the service identifier selected by the user, the version identifier corresponding to the service identifier and the interface identifier corresponding to the version identifier and return the determined interface document to the user through the terminal. Specifically, referring to fig. 3, fig. 3 is a flowchart of a step for displaying a generated interface document according to an embodiment of the present invention, including the following steps:
step 301, receiving a page request sent by a terminal.
Step 302, in response to the page request, a service identifier of at least one service, a version identifier corresponding to the service identifier, and an interface identifier corresponding to the version identifier are obtained from a database.
It should be noted that, the database stores the service identifier, the version identifier corresponding to the service identifier, and the interface identifier corresponding to the version identifier, when the user opens a page on the terminal, the terminal sends a page request to the server, and the server responds to the page request to obtain the service identifier, the version identifier corresponding to the service identifier, and the interface identifier corresponding to the version identifier from the database. And may then execute step 303.
Step 303, sending the service identifier of the acquired service, the version identifier corresponding to the service identifier, and the interface identifier corresponding to the version identifier to the terminal, so that the terminal displays the service identifier of the service, the version identifier corresponding to the service identifier, and the interface identifier corresponding to the version identifier.
After the service identifier, the version identifier corresponding to the service identifier, and the interface identifier corresponding to the version identifier are displayed on the terminal, the user can select one service identifier, version identifier, and interface identifier from the displayed service identifier, version identifier corresponding to the service identifier, and interface identifier corresponding to the version identifier according to the actual requirements of the user. After the user selects, for example, a confirm button may be clicked to send the service identifier, version identifier, and interface identifier selected by the user to the server through the terminal.
Step 304, receiving a second target service identifier, a second version identifier and a target interface identifier sent by the terminal.
The second target service identifier, the second version identifier and the target interface identifier are selected from service identifiers displayed on the terminal by the user, version identifiers corresponding to the service identifiers and interface identifiers corresponding to the version identifiers.
Step 305, obtaining, from the database, a target interface document associated with the second target service identifier, the second version identifier, and the target interface identifier according to a first interface document associated with the first target service identifier, the first version identifier, and the interface identifier of the interface stored in the database, and/or a second interface document associated with the first target service identifier, the first version identifier, and the interface identifier of the target interface.
Through steps 304 and 305, when the server receives the second target service identifier, the second version identifier, and the target interface identifier sent by the terminal, the server may determine, according to the first interface document associated with the first target service identifier, the first version identifier, and the interface identifier of the interface stored in the database, and/or the second interface document associated with the first target service identifier, the first version identifier, and the interface identifier of the target interface, a target interface document associated with the second target service identifier, the second version identifier, and the target interface identifier, and acquire the target interface document.
And 306, sending the target interface document to the terminal so that the terminal displays the target interface document.
Through step 306, the server may send the target interface document to the terminal, so that the target interface document may be displayed on the terminal, and the user may write a test case according to the displayed target interface document, so as to test the interface corresponding to the target interface document.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an interface document generating apparatus according to an embodiment of the present invention, where the apparatus 400 is disposed on a server, and includes:
a first obtaining module 410, configured to obtain a data packet of a first target service, where the data packet includes class files corresponding to all interfaces of the first target service, and one class file includes at least one interface;
the parsing module 420 is configured to parse various files to obtain an interface code of at least one interface included in the various files;
the generating module 430 is configured to extract interface class information from interface codes included in various files, so as to generate a first interface document corresponding to each interface of the first target service according to the interface class information.
According to the interface document generation device provided by the embodiment, the data package of the first target service is obtained, the data package comprises class files corresponding to all interfaces of the first target service, one class file comprises at least one interface, the class files are analyzed to obtain interface codes of at least one interface included in the class files, interface class information is extracted from the interface codes included in the class files, and a first interface document corresponding to each interface of the first target service is generated according to the interface class information. Therefore, the interface document does not need to be manually written, so that the automatic generation of the interface document can be realized, time and labor are saved, and the problem that the interface document is easy to make mistakes when manually written is avoided.
Optionally, the interface class information includes a class name, a method name, a first target service identifier, an input parameter of a method corresponding to the method name, a return parameter of the method, a first version identifier, and a port identifier and an address identifier corresponding to both the first target service identifier and the first version identifier, where the first version identifier is an identifier of a first version of the first target service.
Optionally, the method further comprises:
and the storage module is used for storing a first interface document which is associated with the first target service identifier, the first version identifier and the interface identifier of the interface in the database.
Optionally, the method further comprises:
the judging module is used for scanning the data packet of the first target service stored on the code server at each preset interval time so as to judge whether the data packet is updated according to the time information corresponding to the data packet;
the second acquisition module is used for acquiring the updated data packet from the code server under the condition that the data packet is determined to be updated;
the determining module is used for extracting interface class information from the updated data packet to determine a target interface, wherein the target interface comprises an interface corresponding to a new class file in the updated data packet and/or an interface corresponding to an original class file changed in the updated data packet;
the generating module is also used for extracting interface class information from the interface code of the target interface and generating a second interface document corresponding to the target interface according to the interface class information corresponding to the interface code of the target interface;
the storage module is further configured to store a second interface document associated with the first target service identifier, the first version identifier, and the interface identifier of the target interface in the database.
Optionally, the method further comprises:
the first receiving module is used for receiving a request message sent by the terminal, wherein the request message comprises a first target service identifier of a first target service, a first version identifier of the first target service and a storage address corresponding to both the first target service identifier and the first version identifier;
the first obtaining module is specifically configured to obtain, from a storage address of the code server, a data packet of a first target service corresponding to both the first target service identifier and the first version identifier.
Optionally, the method further comprises:
the second receiving module is used for receiving the page request sent by the terminal;
the third acquisition module is used for responding to the page request and acquiring a service identifier of at least one service, a version identifier corresponding to the service identifier and an interface identifier corresponding to the version identifier from the database;
and the sending module is used for sending the acquired service identifier, the version identifier corresponding to the service identifier and the interface identifier corresponding to the version identifier to the terminal so that the terminal displays the service identifier of the service, the version identifier corresponding to the service identifier and the interface identifier corresponding to the version identifier.
Optionally, the method further comprises:
the third receiving module is used for receiving a second target service identifier, a second version identifier and a target interface identifier sent by the terminal, wherein the second target service identifier, the second version identifier and the target interface identifier are selected from a service identifier displayed on the terminal by a user, a version identifier corresponding to the service identifier and an interface identifier corresponding to the version identifier;
a fourth obtaining module, configured to obtain, from the database, a target interface document associated with the second target service identifier, the second version identifier, and the target interface identifier according to a first interface document associated with the first target service identifier, the first version identifier, and the interface identifier of the interface stored in the database, and/or a second interface document associated with the first target service identifier, the first version identifier, and the interface identifier of the target interface;
and the sending module is also used for sending the target interface document to the terminal so as to enable the terminal to display the target interface document.
In addition, the embodiment of the invention also provides an interface document generating device, which comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein the computer program realizes the processes of the embodiment of the interface document generating method of the embodiment when being executed by the processor, and can achieve the same technical effects, and the repetition is avoided, so that the description is omitted.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the processes of the above-mentioned interface document generation method embodiment, and can achieve the same technical effects, so that repetition is avoided, and no further description is provided herein. The computer readable storage medium may be a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, an optical disk, or the like.
The embodiment of the invention also provides a computer program which can be stored on a cloud or local storage medium. Which when executed by a computer or processor is adapted to carry out the respective steps of the interface document generation method of an embodiment of the invention and to carry out the respective modules in the interface document generation device according to an embodiment of the invention.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
As will be readily appreciated by those skilled in the art: any combination of the above embodiments is possible, and thus is an embodiment of the present invention, but the present specification is not limited by the text.
The interface document generation methods provided herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a system constructed with aspects of the present invention will be apparent from the description above. In addition, the present invention is not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
Various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that some or all of the functions of some or all of the components in an interface document generation method according to an embodiment of the present invention may be implemented in practice using a microprocessor or Digital Signal Processor (DSP). The present invention can also be implemented as an apparatus or device program (e.g., a computer program and a computer program product) for performing a portion or all of the methods described herein. Such a program embodying the present invention may be stored on a computer readable medium, or may have the form of one or more signals. Such signals may be downloaded from an internet website, provided on a carrier signal, or provided in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names.

Claims (10)

1. An interface document generation method, which is executed in a server, comprising:
acquiring a data packet of a first target service corresponding to both the first target service identifier and the first version identifier from a storage address of a code server; the data packet comprises class files corresponding to all interfaces of the first target service, and one class file comprises at least one interface;
analyzing each class file to obtain an interface code of the at least one interface included in each class file;
extracting interface class information from the interface codes included in the class files to generate first interface documents corresponding to the interfaces of the first target service according to the interface class information;
the first interface document associated with the first target service identification, the first version identification, and an interface identification of the interface is stored in a database.
2. The method of claim 1, wherein the interface class information includes a class name, a method name, a first target service identification, an input parameter of a method corresponding to the method name, a return parameter of the method, a first version identification, and a port identification and an address identification corresponding to both the first target service identification and the first version identification, the first version identification being an identification of a first version of the first target service.
3. The method of claim 1, further comprising, after storing the first interface document associated with all of the first target service identification, the first version identification, and the interface identification of the interface in a database:
scanning the data packet of the first target service stored on the code server at preset time intervals to judge whether the data packet is updated or not according to the time information corresponding to the data packet;
under the condition that the data packet is updated, acquiring the updated data packet from the code server;
analyzing the updated data packet to determine a target interface, wherein the target interface comprises an interface corresponding to a new class file in the updated data packet and/or an interface corresponding to an original class file changed in the updated data packet;
extracting interface class information from the interface code of the target interface to generate a second interface document corresponding to the target interface according to the interface class information corresponding to the interface code of the target interface;
the second interface document associated with the first target service identification, the first version identification, and an interface identification of the target interface is stored in the database.
4. A method according to any of claims 1-3, further comprising, prior to said acquiring the data packet of the first target service:
and receiving a request message sent by a terminal, wherein the request message comprises a first target service identifier of the first target service, the first version identifier of the first target service and a storage address corresponding to both the first target service identifier and the first version identifier.
5. The method as recited in claim 4, further comprising:
receiving a page request sent by a terminal;
responding to the page request, acquiring a service identifier of at least one service, a version identifier corresponding to the service identifier and an interface identifier corresponding to the version identifier from the database;
and sending the acquired service identifier of the service, the version identifier corresponding to the service identifier and the interface identifier corresponding to the version identifier to the terminal, so that the terminal displays the service identifier of the service, the version identifier corresponding to the service identifier and the interface identifier corresponding to the version identifier.
6. The method according to claim 5, further comprising, after said transmitting the acquired service identifier of the service, the version identifier corresponding to the service identifier, and the interface identifier corresponding to the version identifier to the terminal:
receiving a second target service identifier, a second version identifier and a target interface identifier, which are sent by the terminal, wherein the second target service identifier, the second version identifier and the target interface identifier are selected from service identifiers displayed on the terminal by a user, version identifiers corresponding to the service identifiers and interface identifiers corresponding to the version identifiers;
obtaining target interface documents associated with the second target service identifier, the second version identifier and the target interface identifier from the database according to the first interface document associated with the first target service identifier, the first version identifier and the interface identifier of the interface and/or the second interface document associated with the first target service identifier, the first version identifier and the interface identifier of the target interface stored in the database;
and sending the target interface document to the terminal so that the terminal displays the target interface document.
7. An interface document generating apparatus provided in a server, comprising:
the first acquisition module is used for acquiring the data packet of the first target service corresponding to both the first target service identifier and the first version identifier from the storage address of the code server; the data packet comprises class files corresponding to all interfaces of the first target service, and one class file comprises at least one interface;
the analyzing module is used for analyzing each class file to obtain the interface code of the at least one interface included in each class file;
the generation module is used for extracting interface class information from the interface codes included in the class files so as to generate a first interface document corresponding to each interface of the first target service according to the interface class information;
and the storage module is used for storing the first interface document which is associated with the first target service identifier, the first version identifier and the interface identifier of the interface in a database.
8. The apparatus of claim 7, wherein the interface class information comprises a class name, a method name, a first target service identification, an input parameter of a method corresponding to the method name, a return parameter of the method, a first version identification, and a port identification and an address identification corresponding to both the first target service identification and the first version identification, the first version identification being an identification of a first version of the first target service.
9. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the interface document generation method of any of claims 1 to 6.
10. An interface document generating apparatus comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program when executed by the processor implementing the steps of the interface document generating method according to any one of claims 1 to 6.
CN201911418878.6A 2019-12-31 2019-12-31 Interface document generation method, device and readable storage medium Active CN111240653B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911418878.6A CN111240653B (en) 2019-12-31 2019-12-31 Interface document generation method, device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911418878.6A CN111240653B (en) 2019-12-31 2019-12-31 Interface document generation method, device and readable storage medium

Publications (2)

Publication Number Publication Date
CN111240653A CN111240653A (en) 2020-06-05
CN111240653B true CN111240653B (en) 2024-02-02

Family

ID=70874189

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911418878.6A Active CN111240653B (en) 2019-12-31 2019-12-31 Interface document generation method, device and readable storage medium

Country Status (1)

Country Link
CN (1) CN111240653B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111796809A (en) * 2020-06-29 2020-10-20 平安普惠企业管理有限公司 Interface document generation method and device, electronic equipment and medium
CN111880778B (en) * 2020-06-30 2023-12-22 百度在线网络技术(北京)有限公司 Method and device for generating interface document, electronic equipment and storage medium
CN111984228B (en) * 2020-07-09 2023-12-12 招联消费金融有限公司 Interface document processing method and device, computer equipment and storage medium
CN112181370B (en) * 2020-09-17 2023-02-28 武汉联影医疗科技有限公司 Data interaction relation generation method, computer equipment and storage medium
CN112583891B (en) * 2020-11-19 2021-07-06 联通智网科技有限公司 Interface document acquisition method and device and server
CN112486460A (en) * 2020-11-30 2021-03-12 携程旅游信息技术(上海)有限公司 Method, system, device and medium for automatically importing interface document
CN112463210A (en) * 2020-12-04 2021-03-09 上海路人王信息科技有限公司 Interface document generation method, terminal device and computer-readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015154682A1 (en) * 2014-04-08 2015-10-15 北京奇虎科技有限公司 Network request processing method, network server, and network system
CN107885499A (en) * 2017-10-19 2018-04-06 平安壹钱包电子商务有限公司 A kind of interface document generation method and terminal device
CN109446072A (en) * 2018-09-27 2019-03-08 深圳壹账通智能科技有限公司 The generation method and device of test script
CN110162296A (en) * 2019-04-15 2019-08-23 平安科技(深圳)有限公司 Generation method, device and the terminal device of application programming interface document
CN110308930A (en) * 2019-06-18 2019-10-08 广州华多网络科技有限公司 Interface document generation method, device, computer equipment and storage medium
CN110377336A (en) * 2019-06-17 2019-10-25 平安普惠企业管理有限公司 Interface document generation method, device, computer equipment and storage medium
CN110442378A (en) * 2019-06-27 2019-11-12 平安科技(深圳)有限公司 The amending method and system of interface document

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015154682A1 (en) * 2014-04-08 2015-10-15 北京奇虎科技有限公司 Network request processing method, network server, and network system
CN107885499A (en) * 2017-10-19 2018-04-06 平安壹钱包电子商务有限公司 A kind of interface document generation method and terminal device
CN109446072A (en) * 2018-09-27 2019-03-08 深圳壹账通智能科技有限公司 The generation method and device of test script
CN110162296A (en) * 2019-04-15 2019-08-23 平安科技(深圳)有限公司 Generation method, device and the terminal device of application programming interface document
CN110377336A (en) * 2019-06-17 2019-10-25 平安普惠企业管理有限公司 Interface document generation method, device, computer equipment and storage medium
CN110308930A (en) * 2019-06-18 2019-10-08 广州华多网络科技有限公司 Interface document generation method, device, computer equipment and storage medium
CN110442378A (en) * 2019-06-27 2019-11-12 平安科技(深圳)有限公司 The amending method and system of interface document

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
胡佳琦,罗明,陈绵云,尹平林.FOXPRO FOR WINDOWS&SDOS下文档的快速汉化.微型机与应用.1996,(10),全文. *

Also Published As

Publication number Publication date
CN111240653A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
CN111240653B (en) Interface document generation method, device and readable storage medium
CN107948314B (en) Business processing method and device based on rule file and server
CN111639019B (en) Code testing method, device and readable storage medium
CN102799468B (en) The method and apparatus opening unknown file
CN109902073B (en) Log processing method and device, computer equipment and computer readable storage medium
CN110968478B (en) Log acquisition method, server and computer storage medium
CN109831466B (en) Micro-service business processing method and nginx server
CN111367595B (en) Data processing method, program running method, device and processing equipment
CN109120432B (en) Fault server positioning method and device
CN112667697A (en) Method and device for acquiring real estate information by combining RPA and AI
CN111045941A (en) Positioning method and device of user interface control and storage medium
CN114153910A (en) Data acquisition method and device, electronic device and computer program product
CN103095698B (en) The restorative procedure of client software, device and communication system
CN110737577B (en) Test defect data storage method and device
JP2021140430A (en) Database migration method, database migration system, and database migration program
CN111045720A (en) Code management method, code management system, server, and medium
CN107483294B (en) Method and device for monitoring network request
US10365898B2 (en) Multi-platform interface framework
CN111367500A (en) Data processing method and device
US11729246B2 (en) Apparatus and method for determining types of uniform resource locator
US10140363B2 (en) Social network crowd translation
CN112887352B (en) Image file uploading method and device for Docker container
CN114500348A (en) CDN gateway test method and system
CN113282347A (en) Plug-in operation method, device, equipment and storage medium
CN111225075A (en) Configuration method and device for Internet of things directional access service

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
GR01 Patent grant
GR01 Patent grant