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

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

Info

Publication number
CN111240653A
CN111240653A CN201911418878.6A CN201911418878A CN111240653A CN 111240653 A CN111240653 A CN 111240653A CN 201911418878 A CN201911418878 A CN 201911418878A CN 111240653 A CN111240653 A CN 111240653A
Authority
CN
China
Prior art keywords
interface
identifier
target
target service
version
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.)
Granted
Application number
CN201911418878.6A
Other languages
Chinese (zh)
Other versions
CN111240653B (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

Images

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

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 the various files to obtain an interface code of the at least one interface in the various files, extracting interface class information from the interface code 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 compiled, so that the interface document can be automatically generated, time and labor are saved, and the problem that the interface document is easy to make mistakes when being manually compiled is solved.

Description

Interface document generation method and device and readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an 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 generally needs to be tested, and the code corresponding to the service needs to be tested according to the interface document when the code is tested.
At present, developers write interface documents 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 the interfaces involved in the code may be multiple, and in the case of multiple interfaces, a corresponding interface document needs to be written for each interface, so that the manual writing of the interface document causes problems of high labor cost, long time consumption, low efficiency and easy error.
Disclosure of Invention
The embodiment of the invention provides an interface document generation method, an interface document generation device and a readable storage medium, and aims to solve the problems of high labor cost, long time consumption, low efficiency and high error probability caused by manual interface document compiling at present.
In a first aspect of the embodiments of the present invention, a method for generating an interface document is provided, 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;
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 second aspect of the embodiments of the present invention, an interface document generating apparatus is provided, which is disposed in a server, and includes:
a first obtaining module, 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 of the class files includes at least one of the interfaces;
the analysis module is used for analyzing each class file to obtain an interface code of each class file, wherein the interface code comprises the at least one interface;
the generating 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, a computer-readable storage medium is provided, on which a computer program is stored, and the computer program, 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 generating apparatus, including a processor, a memory, and a computer program stored on the memory and operable on the processor, wherein the computer program, when executed by the processor, implements the steps of the interface document generating method described above.
Aiming at the prior art, the invention has the following advantages:
the interface document generation method provided by the embodiment of the invention is characterized in that a data packet of a first target service is obtained, the data packet comprises class files corresponding to all interfaces of the first target service, one class file comprises at least one interface, the various files are analyzed to obtain an interface code of the at least one interface included in the various files, interface class information is extracted from the interface code included in the 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 compiled, so that the interface document can be automatically generated, time and labor are saved, and the problem that the interface document is easy to make mistakes when being manually compiled is solved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
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 refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flowchart illustrating steps of a method for generating an interface document according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of another interface document generation method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a step of 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 apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
It should be understood that the specific embodiments described herein are merely illustrative of the invention, but do not limit the invention to only some, but not all embodiments.
Referring to fig. 1, fig. 1 is a flowchart illustrating steps of a method for generating an interface document according to an embodiment of the present invention. The method can be executed in a server, and the method of the embodiment comprises the following steps:
step 101, obtaining 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.
For example, if three methods are defined in a class (class), each method has a respective method name, an interface can be uniquely defined according to the class name and the method name of the class, three interfaces are shared in the class, and if only one method is shared in the class file, only one interface is included in the class file corresponding to the class. RemoteProcedure Call), the interface of the first target service may be an RPC interface.
And 102, analyzing the various files to obtain an interface code of at least one interface included in the various files.
Step 103, extracting interface type information from the interface codes included in the various files, so as to generate a first interface document corresponding to each interface of the first target service according to the interface type information.
Each interface corresponds to one first interface document, and the first interface documents corresponding to each interface are different.
The generated interface document includes, for example, description information of the interface, a class name of an interface class corresponding to the interface, a method name, an input parameter of a method corresponding to the method name, a return parameter of the method, a version identifier, and a port identifier and an address identifier corresponding to both the service identifier and the version identifier. The description information indicates an annotation of an interface class corresponding to the interface, for example, the description information is "acquire city simple information according to an ID of a city a and return a simple", the input parameter is, for example, a field name and a type, the return parameter is, for example, a city name and a city identifier, and the address identifier may be an Internet Protocol (IP) address. The field name is, for example, cityIdSet, and the type is Long.
In the interface document generating method provided by this embodiment, a data packet of a first target service is obtained, 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, and the various files are analyzed to obtain an interface code of the at least one interface included in the various files, and interface class information is extracted from the interface code included in the 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. Therefore, the interface document does not need to be manually compiled, so that the interface document can be automatically generated, time and labor are saved, and the problem that the interface document is easy to make mistakes when being manually compiled is solved.
Referring to fig. 2, fig. 2 is a flowchart illustrating steps of another interface document generating method according to an embodiment of the present invention, where the method includes the following steps:
step 201, receiving a request message sent by a terminal.
The request message includes 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 the storage address of the code server.
Step 203, analyzing the various files to obtain an interface code of at least one interface included in the various files.
Step 204, extracting interface type information from the interface codes included in the various files, so as to generate a first interface document corresponding to each interface of the first target service according to the interface type information.
When the interface information is extracted from the interface codes included in the various files, the interface information can be extracted from the interface codes included in the various files according to the syntax tree. The interface class information comprises 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 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 codes included in the class file can be analyzed to obtain interface class information in the interface codes included in the class file, so that the information of each interface included in the class file can be determined, and then a first interface document corresponding to each interface of the first version of the first target service is generated according to the information of each interface. The information of the interface includes, for example, input parameters, return parameters, version identification of the first target service, port identification, address identification, and other information of a method corresponding to the interface.
Step 205, a first interface document associated with the first target service identification, the first version identification, and the interface identification of the interface is stored in a database.
After the first interface document is generated, the first interface document can be stored in the 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 subsequent search for the interface document associated with the service identifier, the version identifier and the interface identifier selected by the user can be facilitated according to the service identifier, the version identifier and the interface identifier selected by the user.
For example, with respect to step 204 and step 205, as shown in table 1 below, the first target service identifier is service 1, the first version identifier of service 1 is version 1, the interface identifier of each interface of version 1 includes 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.
Figure BDA0002351839770000061
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 a first interface document corresponding to each interface of version 2 of service 1 is generated in steps 203 to 204.
Step 206, scanning the data packet of the first target service stored on the code server at preset time intervals, so as to judge whether the data packet is updated according to the time information corresponding to the data packet.
And step 207, acquiring the updated data packet from the code server under the condition that the data packet is determined to be updated.
And step 208, analyzing the updated data packet to determine a target interface.
The target interface comprises an interface corresponding to a newly added class file in the updated data packet and/or an interface corresponding to an original class file which is changed in the updated data packet.
The target interface may only include an interface corresponding to the new class file, or the target interface only includes an interface corresponding to the changed original class file, or the target interface includes an interface corresponding to the new class file and an interface corresponding to the original class file. The original class file refers to a class file included in the data packet before the data packet is updated. For example, if the interface code of a certain interface in the original class file is changed, the interface is the target interface.
And 209, extracting the interface class information of 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 interface type information extracted from the interface code of the target interface is the interface type information corresponding to the interface code of the target interface. Note that there is a case where the packet of the first target service is updated. For example, if a class file in the data package is updated or a new class file is added to the data package, the data package 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 the test case compiled by a tester according to the interface document is inaccurate, and to avoid manually compiling the interface document corresponding to the newly added class file after the class file is newly added in the data packet. Through steps 206 to 209, generating a second interface document corresponding to the target interface can be realized.
Therefore, the problem that the interface document is manually written after the class files in the data packet are updated and the newly added class files are newly added to 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 preset intervals, so that time information corresponding to the data packet can be obtained, and if the time information is found to be updated, the data packet can be determined to be updated.
For example, the class file in the updated data packet is compared with the class file in the data packet before updating, it can be determined whether there is a new class file, if there is a new class file, the interface class information is extracted from the interface code included in the new class file (i.e. the interface class information is extracted from the interface code of the target interface, and 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 of class name, method name, input parameter, return parameter, port, IP address and the like in the original class file is changed or not can be judged, if at least one of the information is changed, the original class file is changed (the interface corresponding to the changed original class file is the target interface), and the interface document corresponding to the target interface is regenerated.
For example, as shown in table 2 below. For version 1 of the service 1, if an additional class file is added to the version 1 of the service 1, an interface identifier of an interface corresponding to the additional class file is an interface C, if the original class file is changed at the same time, for example, the interface identifier of the 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, the interface corresponding to the interface C and the interface corresponding to the interface a are both target interfaces, a second interface document C associated with the service 1, the version 1 and the interface C is regenerated, and a second interface document a1 associated with the service 1, the version 1 and the interface a is generated. The second interface document a1 and the second interface document C are regenerated interface documents.
Figure BDA0002351839770000081
TABLE 2
It should be noted that, after the interface code corresponding to the interface a is changed, 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 by using the second interface document a 1. If the user then queries an interface document associated with service 1, version 1, and interface a, a second interface document a1 will be 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 the fact that a tester still writes a test case according to the previous interface document under the condition that the interface code 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 subsequent search for the interface document associated with the service identifier, the version identifier and the interface identifier selected by the user can be facilitated according to the service identifier, the version identifier and the interface identifier selected by the user.
The interface document generation method provided in this embodiment scans a data packet of a first target service stored on a code server at preset intervals to determine whether the data packet is updated according to time information corresponding to the data packet, acquires the updated data packet from the code server when it is determined that the data packet is updated, analyzes the updated data packet to determine a target interface, extracts interface class information from an 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, and stores the second interface document associated with a first target service identifier, a first version identifier, and an interface identifier of the target interface in a database to update the interface document corresponding to the interface in time. That is, when the interface of the service is changed, the interface document corresponding to the changed interface can be automatically updated without manually rewriting the interface document.
It should be noted that the embodiment of the present invention further provides a scheme for a user to query and generate an interface document. The generated interface documents are stored in the database, the generated first interface document is associated with the first target service identifier, the first version identifier and the interface identifier of the interface, and the generated second interface document is associated with the first target service identifier, the first version identifier and the interface identifier of the target interface. 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 of 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, obtaining 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 a database.
It should be noted that the database stores a service identifier, a version identifier corresponding to the service identifier, and an interface identifier corresponding to the version identifier, when a user opens a page on the terminal, the terminal sends a page request to the server, and the server responds to the page request and obtains the service identifier, the version identifier corresponding to the service identifier, and the interface identifier corresponding to the version identifier from the database. And step 303 may be performed next.
Step 303, sending the obtained 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.
After the service identifier, the version identifier corresponding to the service identifier and the interface identifier corresponding to the version identifier of the service are displayed on the terminal, a user can select one service identifier, one version identifier and one interface identifier from the displayed service identifier, one version identifier corresponding to the service identifier and one interface identifier corresponding to the version identifier according to the actual requirements of the user. After the user selects, for example, the user may click on a determination button to transmit the service identifier, the version identifier, and the interface identifier selected by the user to the server through the terminal.
And step 304, receiving the second target service identifier, the second version identifier and the target interface identifier sent by the terminal.
The second target service identifier, the second version identifier and the target interface identifier are selected from the service identifier displayed on the terminal by the user, the version identifier corresponding to the service identifier and the interface identifier corresponding to the version identifier.
Step 305, obtaining a target interface document associated with a second target service identifier, a second version identifier and a target interface identifier from the database according to a first interface document stored in the database and associated with the first target service identifier, the first version identifier and the interface identifier of the interface 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, the server, upon receiving the second target service identifier, the second version identifier, and the target interface identifier sent by the terminal, may determine, according to the first interface document stored in the database and 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, the target interface document associated with the second target service identifier, the second version identifier, and the target interface identifier, and obtain the target interface document.
Step 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 compile a test case according to the displayed target interface document, so as to test an 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 in 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 the 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 the interface codes included in the 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.
The interface document generating device provided in this embodiment obtains 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, parses each class file to obtain an interface code of at least one interface included in each class file, and extracts interface class information for the interface code included in each class file to generate 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 compiled, so that the interface document can be automatically generated, time and labor are saved, and the problem that the interface document is easy to make mistakes when being manually compiled is solved.
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 includes:
a storage module to store a first interface document associated with the first target service identification, the first version identification, and the interface identification of the interface in a database.
Optionally, the method further includes:
the judging module is used for scanning a data packet of the first target service stored on the code server at intervals of preset time so as to judge whether the data packet is updated or not according to 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 type information from the updated data packet to determine a target interface, wherein the target interface comprises an interface corresponding to a newly added type file in the updated data packet and/or an interface corresponding to an original type file changed in the updated data packet;
the generating module is also used for extracting interface type information from the interface code of the target interface and generating a second interface document corresponding to the target interface according to the interface type information corresponding to the interface code of the target interface;
and the storage module is also used for storing a second interface document which is associated with the first target service identifier, the first version identifier and the interface identifier of the target interface in a database.
Optionally, the method further includes:
the first receiving module is used for receiving a request message sent by a 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 the first target service identifier and the first version identifier;
the first obtaining module is specifically configured to obtain, from the storage address of the code server, a data packet of the first target service corresponding to both the first target service identifier and the first version identifier.
Optionally, the method further includes:
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 the service identifier of at least one service, the version identifier corresponding to the service identifier and the interface identifier corresponding to the version identifier from the database;
and the sending module is used for 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.
Optionally, the method further includes:
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 stored in the database and associated with the first target service identifier, the first version identifier, and the interface identifier of the interface, 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 that the terminal displays the target interface document.
In addition, an embodiment of the present invention further provides an interface document generating apparatus, where the interface document generating apparatus includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when the computer program is executed by the processor, the computer program implements each process of the interface document generating method embodiment of the foregoing embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not described here again.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the embodiment of the interface document generation method, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
The embodiment of the invention also provides a computer program, and the computer program can be stored on a cloud or a local storage medium. When the computer program is run by a computer or a processor, the computer program is used for executing the corresponding steps of the interface document generation method of the embodiment of the invention and is used for realizing the corresponding modules in the interface document generation device according to the embodiment of the invention.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As is readily imaginable to the person skilled in the art: any combination of the above embodiments is possible, and thus any combination between the above embodiments is an embodiment of the present invention, but the present disclosure is not necessarily detailed herein for reasons of space.
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 structure required to construct a system incorporating aspects of the present invention will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, 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 foregoing 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 invention and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed 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 device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. 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. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements 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 included in other embodiments, rather than other features, 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.
The 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. It will be appreciated by those skilled in the art that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the interface document generation method according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or 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 usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (12)

1. An interface document generation method, executed on a server, includes:
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;
extracting interface class information from the interface codes included in the class files, and generating a first interface document corresponding to each interface of the first target service according to the interface class information.
2. The method of claim 1, wherein the interface class information comprises 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, and wherein the first version identifier is an identifier of a first version of the first target service.
3. The method according to claim 2, wherein after the extracting interface class information from the interface code included in each class file to generate a first interface document corresponding to each interface of the first target service according to the interface class information, further comprising:
storing the first interface document associated with the first target service identification, the first version identification, and the interface identification of the interface in a database.
4. The method of claim 3, further comprising, after storing the first interface document associated with the first target service identification, the first version identification, and the interface identification of the interface in a database:
scanning a data packet of the first target service stored on a code server at intervals of preset time so as to judge whether the data packet is updated or not according to time information corresponding to the data packet;
under the condition that the data packet is determined to be 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 newly added class file in the updated data packet and/or an interface corresponding to an original class file which is 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;
storing the second interface document associated with the first target service identification, the first version identification, and the interface identification of the target interface in the database.
5. The method according to any one of claims 1-4, further comprising, before said obtaining the data packet of the first target service:
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;
the acquiring the data packet of the first target service includes:
and acquiring the data packet of the first target service corresponding to the first target service identifier and the first version identifier from the storage address of the code server.
6. The method of claim 5, further comprising:
receiving a page request sent by a terminal;
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 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.
7. The method according to claim 6, wherein after the sending, to the terminal, the obtained service identifier of the service, the version identifier corresponding to the service identifier, and the interface identifier corresponding to the version identifier, the method further comprises:
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;
acquiring a target interface document 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 stored in the database and 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;
and sending the target interface document to the terminal so that the terminal displays the target interface document.
8. An interface document generation device provided in a server, comprising:
a first obtaining module, 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 of the class files includes at least one of the interfaces;
the analysis module is used for analyzing each class file to obtain an interface code of the at least one interface included in each class file;
the generating module is configured to extract interface class information from the interface codes included in each of the class files, so as to generate a first interface document corresponding to each of the interfaces of the first target service according to the interface class information.
9. The apparatus of claim 8, wherein the interface class information comprises 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, and wherein the first version identifier is an identifier of a first version of the first target service.
10. The apparatus of claim 9, further comprising:
a storage module, configured to store the first interface document associated with the first target service identifier, the first version identifier, and the interface identifier of the interface in a database.
11. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the interface document generation method according to any one of claims 1 to 7.
12. 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, when executed by the processor, implementing the steps of the interface document generation method according to any one of claims 1 to 7.
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 true CN111240653A (en) 2020-06-05
CN111240653B 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)

Cited By (8)

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

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下文档的快速汉化", no. 10 *

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111651196A (en) * 2020-06-24 2020-09-11 腾讯科技(深圳)有限公司 Document publishing method, device and server
CN111796809A (en) * 2020-06-29 2020-10-20 平安普惠企业管理有限公司 Interface document generation method and device, electronic equipment and medium
CN111880778A (en) * 2020-06-30 2020-11-03 百度在线网络技术(北京)有限公司 Interface document generation method and device, electronic equipment and storage medium
CN111880778B (en) * 2020-06-30 2023-12-22 百度在线网络技术(北京)有限公司 Method and device for generating interface document, electronic equipment and storage medium
CN111984228A (en) * 2020-07-09 2020-11-24 招联消费金融有限公司 Interface document processing method and device, computer equipment and storage medium
CN111984228B (en) * 2020-07-09 2023-12-12 招联消费金融有限公司 Interface document processing method and device, computer equipment and storage medium
CN112181370A (en) * 2020-09-17 2021-01-05 武汉联影医疗科技有限公司 Data interaction relation generation method, computer equipment and storage medium
CN112181370B (en) * 2020-09-17 2023-02-28 武汉联影医疗科技有限公司 Data interaction relation generation method, computer equipment and storage medium
CN112583891A (en) * 2020-11-19 2021-03-30 联通智网科技有限公司 Interface document acquisition method and device and server
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

Also Published As

Publication number Publication date
CN111240653B (en) 2024-02-02

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
CN106469044B (en) Method and device for realizing page jump
CN110716783A (en) Front-end page generation and deployment method and device, storage medium and equipment
CN109542412A (en) Interface message generation method, device, computer equipment and storage medium
CN111367595B (en) Data processing method, program running method, device and processing equipment
CN110377356B (en) Task processing method, device and system and computer readable storage medium
CN113094255A (en) Simulation test method, device and system for data interface
CN110750433A (en) Interface test method and device
CN112667697A (en) Method and device for acquiring real estate information by combining RPA and AI
CN109120432B (en) Fault server positioning method and device
CN110955409B (en) Method and device for creating resources on cloud platform
CN113704110A (en) Automatic testing method and device for user interface
CN110515631B (en) Method for generating application installation data packet, server and computer storage medium
CN110674023B (en) Interface testing method and device
CN110188106B (en) Data management method and device
CN110929188A (en) Method and device for rendering server page
CN111078571B (en) Test method for analog response, terminal equipment and computer readable storage medium
US11729246B2 (en) Apparatus and method for determining types of uniform resource locator
CN113326208A (en) Interface test method and device
CN108241497B (en) Dynamic updating method, device, equipment and medium for vehicle-mounted client development interface
CN111045720A (en) Code management method, code management system, server, and medium
CN115543227B (en) Cross-system data migration method, system, electronic device and storage medium
CN114285779B (en) Processing method, device and system of test request

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