CN115904481A - Interface document construction method and device, electronic equipment and storage medium - Google Patents

Interface document construction method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115904481A
CN115904481A CN202111162996.2A CN202111162996A CN115904481A CN 115904481 A CN115904481 A CN 115904481A CN 202111162996 A CN202111162996 A CN 202111162996A CN 115904481 A CN115904481 A CN 115904481A
Authority
CN
China
Prior art keywords
code
interface
module
file
interface document
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111162996.2A
Other languages
Chinese (zh)
Inventor
王雪
卢旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing New Oxygen World Wide Technology Consulting Co ltd
Original Assignee
Beijing New Oxygen World Wide Technology Consulting 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 Beijing New Oxygen World Wide Technology Consulting Co ltd filed Critical Beijing New Oxygen World Wide Technology Consulting Co ltd
Priority to CN202111162996.2A priority Critical patent/CN115904481A/en
Publication of CN115904481A publication Critical patent/CN115904481A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses an interface document construction method, an interface document construction device, electronic equipment and a storage medium, wherein the method comprises the following steps: receiving a code submission notice sent by a code management server; extracting interface code files contained in each module corresponding to the engineering project identification carried by the code submission notice from a code management server; and for each module, constructing a first interface document of the module according to the code comment block in the interface code file contained in the module. The interface code files of all modules under the engineering project are extracted and automatically constructed through the code submission notification, so that the embeddability of the codes is small, the interface files do not need to be manually written after the codes are developed, and the cost is saved. The interfaces contained in each module are integrated together to generate an interface document, so that the problems that the interface document of the whole engineering project is too large and is inconvenient to view due to the fact that a certain module is too large can be solved, and the interface document can be viewed according to the modules.

Description

Interface document construction method and device, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of computers, in particular to an interface document construction method and device, electronic equipment and a storage medium.
Background
When an API (Application Programming Interface) Interface is developed, an Interface document for describing request parameters and returning results of the Interface needs to be written correspondingly, so as to facilitate the use of a later-stage call Interface.
At present, developers need to spend time and effort to write corresponding interface documents while writing codes to realize an API interface. Generally, one functional module in one engineering project involves a plurality of API interfaces, if each API interface is written manually, the software development cycle is prolonged, and if the code of a certain API interface is modified, the corresponding interface document needs to be maintained, which also results in high maintenance cost.
Disclosure of Invention
The present invention provides an interface document construction method, apparatus, electronic device and storage medium for overcoming the above-mentioned deficiencies in the prior art, and the object is achieved by the following technical solutions.
The first aspect of the present invention provides an interface document construction method, where the method is applied to a background server, and the method includes:
receiving a code submission notice sent by a code management server;
extracting interface code files contained in each module corresponding to the engineering project identification carried by the code submission notice from the code management server;
for each module, a first interface document of the module is constructed according to a code comment block in an interface code file contained in the module.
In some embodiments of the present application, said constructing a first interface document of said module from code comment blocks in an interface code file contained by said module comprises:
extracting a code comment block from each interface code file contained by the module; according to the extracted grouping parameters in each code comment block, performing combination processing on the code comment blocks with the same grouping parameters; constructing a first interface document for the module based on the combined code comment block and the uncombined code comment block.
In some embodiments of the present application, after building the first interface document for the module based on the combined code comment block and the uncombined code comment block, the method further comprises:
converting a first interface document of the module into a file with a preset format; and when a viewing request aiming at the file is received, reading and analyzing the file so as to display the content in the file in a WEB page.
In some embodiments of the present application, after constructing, for each module, a first interface document for the module from code comment blocks in an interface code file contained by the module, the method further comprises:
receiving a code updating notice sent by a code management server; reading an interface code file corresponding to the module identifier carried by the code updating notice from the code management server; and constructing a second interface document corresponding to the module identifier according to the code annotation block in the read interface code file, and replacing the first interface document corresponding to the module identifier with the second interface document.
A second aspect of the present invention provides an interface document construction method, which is applied to a code management server, and includes:
receiving interface code files contained in each module under an engineering project submitted by front-end equipment;
carrying out grammar detection on the code comment block in each interface code file;
if the detection result is passed, sending a code submission notice to a background server so that the background server reads interface code files contained in the modules based on the code submission notice and constructs interface documents of the modules;
and if the code comment block which fails to be detected exists, prompting the front-end equipment of the interface code file to which the code comment block which fails to be detected belongs.
In some embodiments of the present application, the syntax detection of the code comment block in each interface code file includes:
detecting whether a code annotation block in each interface code file contains a preset annotation parameter or not; if yes, determining that the code comment block passes the detection; if not, determining that the code comment block fails to detect.
In some embodiments of the present application, the sending a notification of code submission to a backend server includes:
if the code annotation blocks in each interface code file are detected to pass, triggering a pre-configured push hook; and sending a code submission notice to the background server through the push hook.
A third aspect of the present invention provides an interface document building apparatus, where the apparatus is applied to a backend server, and the apparatus includes:
a receiving notification unit, configured to receive a code submission notification sent by a code management server;
an extracting unit, configured to extract, from the code management server, interface code files included in modules corresponding to the engineering project identifiers carried by the code submission notification;
and the construction unit is used for constructing a first interface document of each module according to the code comment block in the interface code file contained in the module.
A fourth aspect of the present invention provides an interface document construction apparatus applied to a code management server, the apparatus including:
the file receiving unit is used for receiving interface code files contained in each module under the engineering project submitted by the front-end equipment;
the detection unit is used for carrying out grammar detection on the code comment block in each interface code file;
a notification sending unit, configured to send a code submission notification to a backend server when the code annotation block in each interface code file passes detection, so that the backend server reads the interface code file included in each module based on the code submission notification and constructs an interface document of each module;
and the error prompting unit is used for prompting the interface code file to which the code comment block which fails to be detected belongs to the front-end equipment when the code comment block which fails to be detected exists.
A fifth aspect of the present invention proposes an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method according to the first or second aspect when executing the program.
A sixth aspect of the present invention proposes a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method according to the first or second aspect as described above.
Based on the interface document construction method and apparatus in the first to fourth aspects, the present invention has at least the following advantages or advantages:
the method comprises the steps of receiving a code submission notice of a code management server to trigger extraction of interface code files of all modules under an engineering project, and automatically constructing an interface document according to code annotation blocks in the interface code files, so that the embeddability of codes is low, the interface document does not need to be manually written after the codes are developed, and the cost is saved.
Furthermore, the interfaces contained in each module are integrated together to generate an interface document, namely the interface document is classified in a module form, so that the problems that the interface document of the whole engineering project is too large and is inconvenient to view due to the fact that a certain module under the engineering project is too large can be avoided, and the interface document only needs to be viewed according to the required modules in the follow-up process.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1A is a flowchart illustrating an embodiment of a method for interface document construction according to an exemplary embodiment of the present invention;
FIG. 1B is a schematic diagram illustrating various code annotations according to the embodiment of FIG. 1A;
FIG. 1C is a schematic diagram of a code comment block according to the embodiment of FIG. 1A;
FIG. 1D is a document content presentation diagram of a code comment block shown in the embodiment of FIG. 1A, in accordance with the present invention;
FIG. 2 is a flowchart of an embodiment of another interface document construction method according to an exemplary embodiment of the present invention;
FIG. 3 is an interaction flow diagram illustrating a method of interface document construction according to an exemplary embodiment of the present invention;
FIG. 4 is a block diagram of an interface document building apparatus according to an exemplary embodiment of the present invention;
FIG. 5 is a block diagram of another interface document builder apparatus according to an exemplary embodiment of the present invention;
FIG. 6 is a diagram illustrating a hardware configuration of an electronic device according to an exemplary embodiment of the present invention;
fig. 7 is a schematic structural diagram of a storage medium according to an exemplary embodiment of the present invention.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present invention. The word "if" as used herein may be interpreted as "at" \8230; "or" when 8230; \8230; "or" in response to a determination ", depending on the context.
In order to solve the technical problem of high cost caused by manually writing and maintaining an interface document, the invention provides an improved interface document construction method, namely when a code submission notice sent by a code management server is received, extracting an interface code file contained in each module corresponding to an engineering project identifier carried by the code submission notice from the code management server, and constructing a first interface document of each module according to a code annotation block in the interface code file contained in the module aiming at each module.
The technical effects which can be achieved based on the technical scheme described above are as follows:
the interface code files of all modules under the engineering project are triggered and extracted by receiving the code submission notice of the code management server, and the interface documents are automatically constructed according to the code annotation blocks in the interface code files, so that the embeddability of the codes is small, the interface documents do not need to be manually written after the codes are developed, and the cost is saved.
Furthermore, the interfaces contained in each module are integrated together to generate an interface document, namely the interface document is classified in a module form, so that the problems that the interface document of the whole engineering project is too large and is inconvenient to view due to the fact that a certain module under the engineering project is too large can be avoided, and the interface document only needs to be viewed according to the required module in the follow-up process.
In order to make the technical solutions of the embodiments of the present application better understood, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
The first embodiment is as follows:
fig. 1A is a flowchart illustrating an interface document constructing method according to an exemplary embodiment of the present invention, where the constructing method provided in this embodiment is applied to a backend server, and the backend server is a device for providing an engineering project implementation function, so that an interface document of an engineering project is constructed on the device. As shown in fig. 1A, the interface document construction method includes the following steps:
step 101: and receiving a code submission notice sent by the code management server.
In this embodiment, when the background server receives a code submission notification sent by the code management server, it indicates that there is a code change on the code management server, so as to trigger a locally preset script for extracting the code on the code management server to the local.
Step 102: and extracting interface code files contained in each module corresponding to the engineering project identification carried by the code submission notice from the code management server.
In this embodiment, an engineering project is composed of a plurality of function modules, each function module further includes a plurality of interface code files, and each interface code file is used for implementing a function. That is, there are several peer folders named by module name under one project item, and each folder contains several interface code files.
The interface code file comprises source code and a code comment block, wherein the code comment block is a comment explanation written by a developer when writing the source code.
Referring to fig. 1B, 21 annotation definitions are provided, and several commonly used annotation definitions are explained below:
@ api belongs to the annotation that must be written in the code annotation block, defined in the format: @ api { method } path [ title ], "method" indicates the manner of the request, e.g., get, post, put, delete, etc., "path" indicates the path of the request, "title" is an optional item, indicating the title navigation of the packet. For example: @ api { get }/search/city/index search city data, which means that data on the/search/city/index path is requested by way of a get request.
@ apiDescription is used to define source code functional descriptions
@ apiVersion is used to define interface versions
@ apiName is used to define the name of this code comment block for generating child navigations
The @ apiGroup is used for defining grouping parameters, belongs to comments which must be written in code comment blocks, and combines code comment blocks with the same grouping parameters
The @ apiHeader is used to define the parameters of the header for presentation at the head of the entire document
The @ apiParam is used to define the parameters to be passed to the source code
@ apiSuccess is used to define the parameters returned after a successful request
@ apiSuccessExample is used to define an example of a data structure after a successful request
@ apiError is used to define parameters for request failure return
@ api ErrorExample is used to define an example of a data format after a request failure
It should be noted that necessary annotation parameters, namely @ apiGroup and @ api, need to be preset, so that the code annotation block in each interface code file is defined with the preset annotation parameter.
Step 103: for each module, a first interface document of the module is constructed according to a code comment block in an interface code file contained in the module.
In this embodiment, since one engineering project is divided into a plurality of functional modules, such as an order module, a client module, a user module, and a content module, and each module is stored in the engineering project in the form of a peer folder, the interface documents are categorized in the form of modules, that is, an independent interface document is constructed for each module, so that the documents can be viewed as required according to the modules when viewed.
In an optional specific embodiment, for the interface document building process of each module, for each interface code file included in the module, a code comment block may be extracted from the interface code file, then, according to a grouping parameter in each extracted code comment block, a combination process is performed on the code comment blocks with the same grouping parameter, and then, based on the combined code comment block and the code comment block that is not combined, a first interface document of the module is built.
The code annotation blocks with the same grouping parameters are combined together to construct an interface document, and document contents of the code annotation blocks with the same grouping parameters are adjacently displayed in a web page when the interface document is subsequently viewed, so that a user can conveniently view the interface document.
The grouping parameter in the code comment block is the parameter defined by @ apiGroup as exemplified in step 102 above. Code comment blocks with the same grouping parameter mean that the parameters defined by @ apiGroup in the code comment blocks are all the same.
In a specific implementation, the first interface document of the module may include two files, where the header information and the trailer information of the whole document are stored in one file, the header information and the trailer information are used to describe the functions implemented by the document, and the content information of the document is stored in the other file.
It should be noted that the file format of the first interface document that is usually constructed is json format, and if document content is to be displayed on a WEB page, the json format needs to be converted into js format, and based on this, after the first interface document of a certain module is constructed, the first interface document of the module is converted into a file in a preset format, so that when a viewing request for the file is received, the file can be directly read and analyzed, so as to display the content in the file on the WEB page.
Wherein the preset format is js format.
For example, refer to fig. 1C for a schematic diagram of a code comment block of one of the interface code files, and after processing in step 103, refer to fig. 1D for a schematic diagram of document contents of the code comment block displayed in a WEB page.
It should be further noted that after step 103 is executed, the interface document of the code where the update occurs can be automatically reconstructed according to the code update notification sent by the code manager, without manual maintenance. The specific implementation process is as follows: receiving a code updating notice sent by a code management server, further reading an interface code file corresponding to a module identifier carried by the code updating notice from the code management server, constructing a second interface document corresponding to the module identifier according to a code annotation block in the read interface code file, and replacing a first interface document corresponding to the module identifier with the second interface document.
It can be understood by those skilled in the art that the first interface document is used to represent an interface document constructed after the code is first submitted, and the second interface document is used to represent an interface document constructed after the code is modified.
So far, the construction process shown in fig. 1A is completed, the code submission notice of the code management server is received to trigger the extraction of the interface code files of each module under the engineering project, and the interface document is automatically constructed according to the code comment block in the interface code file, so that the embeddability of the code is small, the interface document does not need to be manually written after the code is developed, and the cost is saved.
Furthermore, the interfaces contained in each module are integrated together to generate an interface document, namely the interface document is classified in a module form, so that the problems that the interface document of the whole engineering project is too large and is inconvenient to view due to the fact that a certain module under the engineering project is too large can be avoided, and the interface document only needs to be viewed according to the required module in the follow-up process.
Example two:
fig. 2 is a flowchart of another interface document construction method according to an exemplary embodiment of the present invention, and based on the embodiment shown in fig. 1A, the construction method provided in this embodiment is applied to a code management server, where the code management server is used to manage interface code files included in engineering projects, and specifically may be a gitlab server. As shown in fig. 2, the interface document construction method includes the following steps:
step 201: and receiving interface code files contained in each module under the engineering project submitted by the front-end equipment.
The front-end equipment is equipment for writing codes and code annotation blocks for developers.
Step 202: and carrying out grammar detection on the code comment block in each interface code file.
In an optional specific embodiment, whether a code comment block in each interface code file contains a preset comment parameter may be detected, and if yes, it is determined that the code comment block passes the detection; if not, determining that the code comment block detection fails.
The preset annotation parameter is an annotation parameter that must be defined in the code annotation block, and the two annotation parameters, i.e. the @ apiGroup and the @ api, described in step 102 are the annotation parameters that must be defined.
Step 203: and if the detection result is passed, sending a code submission notice to the background server, so that the background server reads the interface code files contained in the modules based on the code submission notice and constructs the interface documents of the modules.
In an alternative embodiment, the code management server typically supports configuration hooks, i.e., hooks that trigger configuration when a relevant event occurs in the repository, to notify external servers. Based on the above, in the process of sending the code submission notice by the background server, the pre-configured push hook is triggered under the condition that the code comment block in each interface code file is detected to pass, so that the code submission notice is sent to the background server through the push hook.
Step 204: and if the code comment block which fails to be detected exists, prompting the front-end equipment of the interface code file to which the code comment block which fails to be detected belongs.
If the code comment block which fails to be detected exists, the wrong position is prompted to the front-end equipment, so that the code comment block can be conveniently modified by developers.
Thus, the above construction process shown in fig. 2 is completed, and the backstage server can be ensured to extract the correct code comment block to generate the interface document in the code management server by a syntax detection mode.
Example three:
fig. 3 is an interaction flowchart of an interface document construction method according to an exemplary embodiment of the present invention, based on the above embodiments shown in fig. 1A and fig. 2, the present embodiment takes interaction on three sides of a front-end device, a backend server, and a code management server as an example, and the interface document construction flow is described as follows:
the front-end equipment sends interface code files contained in each module of the engineering project which is developed locally to a code management server; the code management server carries out grammar detection on code annotation blocks in the interface code file contained in each module, if the code annotation blocks in the interface code file contained in each module are detected to pass, the code management server sends a code submission notice to the background server, and if the code annotation blocks which are not detected to pass exist, the code management server prompts the interface code file to which the code annotation blocks which are not detected to belong to the front-end equipment so as to facilitate developers of the front-end equipment to modify the positions with errors; the background server extracts interface code files contained in each module of the engineering project from the code management server based on the code submission notice, and then constructs a first interface document of each module according to code annotation blocks in the interface code files contained in the modules aiming at each module, so that the interfaces contained in each module are integrated together to generate one interface document, the interface documents are classified in a module form, and the interface documents can be conveniently checked according to the modules.
Corresponding to the embodiment of the interface document construction method, the invention also provides an embodiment of an interface document construction device.
Fig. 4 is a flowchart of an embodiment of an interface document construction apparatus according to an exemplary embodiment of the present invention, the apparatus is configured to execute the interface document construction method provided in the first embodiment, and as shown in fig. 4, the interface document construction apparatus includes:
a reception notification unit 410, configured to receive a code submission notification sent by the code management server;
an extracting unit 420, configured to extract, from the code management server, an interface code file included in each module corresponding to the engineering project identifier carried by the code submission notification;
a constructing unit 430, configured to, for each module, construct a first interface document of the module according to the code comment block in the interface code file included in the module.
Fig. 5 is a flowchart of another interface document construction apparatus according to an exemplary embodiment of the present invention, the apparatus is configured to execute the interface document construction method provided in the second embodiment, as shown in fig. 5, the interface document construction apparatus includes:
a file receiving unit 510, configured to receive an interface code file included in each module under an engineering project submitted by a front-end device;
a detection unit 520, configured to perform syntax detection on the code comment block in each interface code file;
a notification sending unit 530, configured to send a code submission notification to a backend server when the code comment block in each interface code file passes detection, so that the backend server reads the interface code file included in each module based on the code submission notification, and constructs an interface document of each module;
and an error prompt unit 540, configured to prompt, when there is a code comment block that fails to be detected, the front-end device to an interface code file to which the code comment block that fails to be detected belongs.
The specific details of the implementation process of the functions and actions of each unit in the above device are the implementation processes of the corresponding steps in the above method, and are not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the invention. One of ordinary skill in the art can understand and implement it without inventive effort.
The embodiment of the invention also provides electronic equipment corresponding to the interface document construction method provided by the embodiment, so as to execute the interface document construction method.
Fig. 6 is a hardware block diagram of an electronic device according to an exemplary embodiment of the present invention, the electronic device including: a communication interface 601, a processor 602, a memory 603, and a bus 604; the communication interface 601, the processor 602 and the memory 603 communicate with each other via a bus 604. The processor 602 may execute the interface document construction method described above by reading and executing machine executable instructions in the memory 603 corresponding to the control logic of the interface document construction method, and the specific content of the method is described in the above embodiments, which will not be described herein again.
The memory 603 referred to in this disclosure may be any electronic, magnetic, optical, or other physical storage device that can contain stored information, such as executable instructions, data, and the like. Specifically, the Memory 603 may be a RAM (Random Access Memory), a flash Memory, a storage drive (such as a hard disk drive), any type of storage disk (such as an optical disk, a DVD, etc.), or similar storage medium, or a combination thereof. The communication connection between the network element of the system and at least one other network element is implemented through at least one communication interface 601 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like may be used.
Bus 604 can be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 603 is used for storing a program, and the processor 602 executes the program after receiving the execution instruction.
The processor 602 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 602. The Processor 602 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor.
The electronic device provided by the embodiment of the application and the interface document construction method provided by the embodiment of the application have the same inventive concept and have the same beneficial effects as the method adopted, operated or realized by the electronic device.
Referring to fig. 7, the computer readable storage medium is an optical disc 30, and a computer program (i.e., a program product) is stored thereon, and when being executed by a processor, the computer program may execute the interface document constructing method according to any of the foregoing embodiments.
It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, a phase change memory (PRAM), a Static Random Access Memory (SRAM), a Dynamic Random Access Memory (DRAM), other types of Random Access Memories (RAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a flash memory, or other optical and magnetic storage media, which are not described in detail herein.
The computer-readable storage medium provided by the above-mentioned embodiment of the present application and the interface document construction method provided by the embodiment of the present application have the same beneficial effects as the method adopted, executed or implemented by the application program stored in the computer-readable storage medium.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or apparatus comprising the element.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (11)

1. An interface document construction method is applied to a background server, and comprises the following steps:
receiving a code submission notice sent by a code management server;
extracting interface code files contained in each module corresponding to the engineering project identification carried by the code submission notice from the code management server;
for each module, a first interface document of the module is constructed according to a code comment block in an interface code file contained in the module.
2. The method of claim 1, wherein constructing the first interface document of the module from code comment blocks in an interface code file contained by the module comprises:
extracting a code comment block from each interface code file contained by the module;
according to the extracted grouping parameters in each code comment block, performing combination processing on the code comment blocks with the same grouping parameters;
constructing a first interface document for the module based on the combined code comment block and the uncombined code comment block.
3. The method of claim 2, wherein after constructing the first interface document for the module based on the combined code comment block and the uncombined code comment block, the method further comprises:
converting a first interface document of the module into a file with a preset format;
and when a viewing request aiming at the file is received, reading and analyzing the file so as to display the content in the file in a WEB page.
4. The method of claim 1, wherein after constructing, for each module, a first interface document for the module from code comment blocks in an interface code file contained by the module, the method further comprises:
receiving a code updating notice sent by a code management server;
reading an interface code file corresponding to the module identifier carried by the code updating notice from the code management server;
and constructing a second interface document corresponding to the module identifier according to the code annotation block in the read interface code file, and replacing the first interface document corresponding to the module identifier with the second interface document.
5. An interface document construction method, applied to a code management server, the method comprising:
receiving interface code files contained in each module under an engineering project submitted by front-end equipment;
carrying out grammar detection on the code comment block in each interface code file;
if the detection result is passed, sending a code submission notice to a background server so that the background server reads interface code files contained in the modules based on the code submission notice and constructs interface documents of the modules;
and if the code comment block which fails to be detected exists, prompting the interface code file to which the code comment block which fails to be detected belongs to the front-end equipment.
6. The method of claim 5, wherein the syntax checking of the code comment block in each interface code file comprises:
detecting whether a code annotation block in each interface code file contains a preset annotation parameter or not;
if yes, determining that the code comment block passes the detection;
and if not, determining that the code comment block fails to detect.
7. The method of claim 5, wherein sending a notification of code submission to a backend server comprises:
if the code annotation blocks in each interface code file are detected to pass, triggering a pre-configured push hook;
and sending a code submission notice to the background server through the push hook.
8. An interface document building device, which is applied to a background server, characterized in that the device comprises:
a receiving notification unit, configured to receive a code submission notification sent by a code management server;
an extracting unit, configured to extract, from the code management server, interface code files included in modules corresponding to the engineering project identifiers carried by the code submission notification;
and the construction unit is used for constructing a first interface document of each module according to the code comment block in the interface code file contained in the module.
9. An interface document construction apparatus applied to a code management server, the apparatus comprising:
the file receiving unit is used for receiving interface code files contained in all modules under the engineering project submitted by the front-end equipment;
the detection unit is used for carrying out grammar detection on the code comment block in each interface code file;
a notification sending unit, configured to send a code submission notification to a backend server when the code annotation block in each interface code file passes detection, so that the backend server reads the interface code file included in each module based on the code submission notification and constructs an interface document of each module;
and the error prompting unit is used for prompting the interface code file to which the code comment block which fails to be detected belongs to the front-end equipment when the code comment block which fails to be detected exists.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 4 or claims 5 to 7 when executing the program.
11. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, is adapted to carry out the steps of the method according to any one of claims 1-4 or claims 5-7.
CN202111162996.2A 2021-09-30 2021-09-30 Interface document construction method and device, electronic equipment and storage medium Pending CN115904481A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111162996.2A CN115904481A (en) 2021-09-30 2021-09-30 Interface document construction method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111162996.2A CN115904481A (en) 2021-09-30 2021-09-30 Interface document construction method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115904481A true CN115904481A (en) 2023-04-04

Family

ID=86492119

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111162996.2A Pending CN115904481A (en) 2021-09-30 2021-09-30 Interface document construction method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115904481A (en)

Similar Documents

Publication Publication Date Title
US20160342413A1 (en) Verification of backward compatibility of software components
CN107968841B (en) Dynamic routing method, device, storage medium and client of network page
JP6614756B2 (en) Transaction system error detection method, apparatus, storage medium, and computer device
US10268568B2 (en) System and method for data element tracing
CN108256870B (en) Method and device for generating description information, updating and processing data based on topological structure
WO2017107808A1 (en) Method and system for locating obfuscated scripting language
CN112241370B (en) API interface class checking method, system and device
US20120159515A1 (en) Sharing object representations
CN116302064A (en) Integrated code analysis method, integrated code analysis device, electronic equipment and storage medium
CN112115063B (en) Software localization test method, device, terminal and storage medium
CN112052157B (en) Method, device and system for constructing test message
CN105824647A (en) Form page generating method and device
CN110286912B (en) Code detection method and device and electronic equipment
CN113934617A (en) Data processing method, device, equipment and storage medium
CN115904481A (en) Interface document construction method and device, electronic equipment and storage medium
CN115033592A (en) SQL statement processing method, device, equipment and storage medium based on database
CN111400245B (en) Art resource migration method and device
CN111726373B (en) Communication link construction method, device and equipment
CN112148581A (en) Code specification checking method, device, system and storage medium
CN112035367B (en) Method and system for checking workflow correctness of big data platform
CN117354114B (en) Data service release method and system based on cloud native architecture
CN113327167B (en) Block chain data processing method
CN113672491B (en) Method for detecting legality of SQL statement, storage medium and terminal equipment
WO2023123019A1 (en) Cloud resource management method and device, and storage medium
CN115729539A (en) Template file generation method, device, equipment and medium for code development

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