CN112199331A - Automatic generation method, system, terminal and storage medium of interface document - Google Patents

Automatic generation method, system, terminal and storage medium of interface document Download PDF

Info

Publication number
CN112199331A
CN112199331A CN202011073606.XA CN202011073606A CN112199331A CN 112199331 A CN112199331 A CN 112199331A CN 202011073606 A CN202011073606 A CN 202011073606A CN 112199331 A CN112199331 A CN 112199331A
Authority
CN
China
Prior art keywords
interface
information
document
project
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
CN202011073606.XA
Other languages
Chinese (zh)
Inventor
吕宪伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202011073606.XA priority Critical patent/CN112199331A/en
Publication of CN112199331A publication Critical patent/CN112199331A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/116Details of conversion of file system types or formats
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention discloses an automatic generation method, a system, a terminal and a storage medium of an interface document, wherein the method comprises the following steps: receiving an interface document generation request, wherein the interface document generation request comprises at least one item information; extracting interface information of each project from at least one project information; analyzing domain name information corresponding to each interface from the interface information; generating an interface document by using the interface information; and aggregating the interface documents with the same domain name information and outputting the aggregated interface documents. Through the mode, the method and the device can process the interface information of the project in batches, automatically generate the Swagger-specified interface document of each interface, aggregate the interface documents according to the domain name, and facilitate quick checking of a user.

Description

Automatic generation method, system, terminal and storage medium of interface document
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, a system, a terminal, and a storage medium for automatically generating an interface document.
Background
In the current internet era, an information system supports the operation of online services, the interaction between front-end services and background services in the information system and between the information systems is performed through Application Programming Interface (API), while the number of interfaces opened to a client by an internet company server is often very large, and documents in the company for such interfaces are often few and few, which results in the increase of the internal learning communication cost.
At present, interface document generation mainly adopts two modes, one mode is to write the interface document manually, and the other mode is to generate the interface document by means of an automatic interface document generating tool.
In the first mode, the service interface document is manually written, interface information is manually extracted according to interface definition, data relation is manually combed, and then a field is extracted and written on the document according to the interface definition information. Each field needs to have a field name, a field type, whether the field can be empty, a default value for the field, an example value for the field, a description of the field, etc. noted in the document. In addition, the field is divided into basic data types and complex structures, the complex structures can be nested in multiple layers, and the depth can be as high as several layers. The interface document also needs to contain an error code for each interface. When the number of the interfaces is large, the writing efficiency of the purely mechanical manual service document is low, mistakes are easy to make, and the accuracy cannot be guaranteed. In addition, when the service interface is changed, the abnormal service condition caused by the fact that the document of the service interface is not updated in time by people is also frequent.
For the second mode, the existing document generation tool is not suitable for the condition of processing project interfaces in batches, even if the interface documents can be processed, the generated interface documents are mixed together, and still need to be manually confirmed and then classified one by one, which also needs to consume a lot of time, has low efficiency and is not beneficial to the management of the interface documents.
Disclosure of Invention
The application provides an automatic generation method, a system, a terminal and a storage medium of an interface document, which are used for solving the problems of low efficiency and unfavorable management of the existing interface document generation mode.
In order to solve the technical problem, the application adopts a technical scheme that: an automatic interface document generation method is provided, which comprises the following steps: receiving an interface document generation request, wherein the interface document generation request comprises at least one item information; extracting interface information of each project from at least one project information; analyzing domain name information corresponding to each interface from the interface information; generating an interface document by using the interface information; and aggregating the interface documents with the same domain name information and outputting the aggregated interface documents.
As a further improvement of the present application, the extracting interface information of each project from at least one project includes: the interface information of at least one project is uniformly imported into a collection of postman; and exporting the collection to obtain a JSON format file, and analyzing the JSON format file to obtain interface information of each project.
As a further improvement of the present application, generating an interface document using the interface information includes: analyzing the interface information and extracting project name information from the interface information; creating storage folders according to the project name information, wherein all interfaces of each project correspond to one storage folder; generating an interface document corresponding to each interface by using the interface information and the Swagger specification; and storing the interface document into the corresponding storage folder based on the project name information.
As a further improvement of the present application, generating an interface document corresponding to each interface by using the interface information and the Swagger specification includes: automatically converting the interface information into parameters in a format specified by Swagger specification according to a preset rule; and filling the parameters into a document template prepared in advance to obtain an interface document corresponding to each interface.
As a further improvement of the present application, after automatically converting the interface information into a parameter in a format specified by the Swagger specification according to a preset rule, the method further includes: judging whether the parameters corresponding to each interface comprise authentication parameters or not; if not, the authentication parameter of the interface is set as a default value and is supplemented into the parameter.
As a further improvement of the present application, after automatically converting the interface information into a parameter in a format specified by the Swagger specification according to a preset rule, the method further includes: judging whether the parameters corresponding to each interface include an example of which the length exceeds a preset threshold value; if yes, the example is cut off into at least two segments according to a preset cutting-off rule.
As a further improvement of the present application, after aggregating and outputting interface documents with the same domain name information, the method further includes: and uploading the aggregated interface document to a block chain.
In order to solve the above technical problem, another technical solution adopted by the present application is: there is provided an interface document automatic generation system including: the receiving module is used for receiving an interface document generation request, and the interface document generation request comprises at least one item information; the extraction module is used for extracting the interface information of each project from at least one project information; the analysis module is used for analyzing the domain name information corresponding to each interface from the interface information; the generating module is used for generating an interface document by utilizing the interface information; and the aggregation module is used for aggregating the interface documents with the same domain name information and outputting the aggregated interface documents.
In order to solve the above technical problem, the present application adopts another technical solution that: providing a terminal, which comprises a processor and a memory coupled with the processor, wherein the memory stores program instructions for realizing the automatic generation method of the interface document; the processor is for executing the memory-stored program instructions to generate the interface document and to automatically aggregate.
In order to solve the above technical problem, the present application adopts another technical solution that: a storage medium is provided, which stores a program file capable of realizing the automatic interface document generation method.
The beneficial effect of this application is: the interface document automatic generation method extracts the interface information of each item from the item information in the interface document generation request after receiving the interface document generation request, analyzes the interface information to obtain the domain name information of each interface, automatically aggregates the interface documents according to the domain name information after automatically generating the interface documents, aggregates the interface documents with the same domain name information into a folder, and the interface documents with the same domain name information correspond to the interfaces of the same item, so that the interface documents mixed together are automatically classified by utilizing the domain name aggregation, when one interface document needs to be checked, the corresponding folder is found according to the domain name information, the needed interface document is found from the folder, and the needed interface document is not required to be inquired from all the interface documents, thereby reducing the management difficulty, and the user can conveniently and quickly check.
Drawings
FIG. 1 is a flowchart illustrating an interface document automatic generation method according to a first embodiment of the present invention;
FIG. 2 is a flowchart illustrating an interface document automatic generation method according to a second embodiment of the present invention;
FIG. 3 is a flowchart illustrating an interface document automatic generation method according to a third embodiment of the present invention;
FIG. 4 is a flowchart illustrating an interface document automatic generation method according to a fourth embodiment of the present invention;
FIG. 5 is a flowchart illustrating an interface document automatic generation method according to a fifth embodiment of the present invention;
FIG. 6 is a functional block diagram of an interface document automatic generation system according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a terminal according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a storage medium according to an embodiment of the present invention.
Detailed Description
The technical solutions in 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, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first", "second" and "third" in this application are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any indication of the number of technical features indicated. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of the feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless explicitly specifically limited otherwise. All directional indications (such as up, down, left, right, front, and rear … …) in the embodiments of the present application are only used to explain the relative positional relationship between the components, the movement, and the like in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indication is changed accordingly. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
Fig. 1 is a flowchart illustrating an interface document automatic generation method according to a first embodiment of the present invention. It should be noted that the method of the present invention is not limited to the flow sequence shown in fig. 1 if the results are substantially the same. As shown in fig. 1, the method comprises the steps of:
step S101: an interface document generation request is received, the interface document generation request including at least one item information.
It should be understood that, currently, most projects are developed separately at the front end and the back end during development, so in order to reduce the work of interfaces between the front end development engineers and the back end development engineers, during development, the front end development engineers and the back end development engineers must define the interfaces together, write interface documents, facilitate the front end engineers and the back end engineers to have a unified file to communicate, communicate and develop during the project development, and facilitate the later personnel to check and maintain during the project maintenance at the back end.
In step S101, an interface document generation request is generated by aggregating the names or flag information of all items of the interface document that the user needs to generate, and the item information of all items can be obtained by the names or flag information of all items in the interface document generation request.
Step S102: interface information of each project is extracted from the at least one project information.
In step S102, after the item information is acquired, the interface information of all the interfaces of each item is acquired from the item information. It should be noted that the interface information includes, but is not limited to, method information of an interface, parameter name information of an interface, parameter description information of an interface, parameter example information of an interface, path information of an interface, or any information related to an interface, and it should be understood that a person skilled in the art may understand that any known method may be used in the present embodiment to obtain various interface information, and the present embodiment is not limited. For example, the interface information may be data required by the Swagger specification extracted from objects such as url, header, method, description, response, and the like.
Further, there are many existing development languages, the development languages used in different projects may be different, and the existing interface document generation tools all depend on a package or a framework corresponding to the development languages, so as to manage the projects conveniently and realize fast and automatic generation of the interface document, in this embodiment, postman is used to manage project information, specifically, step S102 includes:
1. and uniformly importing the interface information of at least one project into one collection of postman.
It should be noted that postman is a simulation submission testing tool for Chrome (*** browser) and is used for interface request testing, and the postman can be used for testing an interface no matter whether the front end, the back end or a tester.
Specifically, a plurality of collections can be created in postman, each collection corresponds to a folder, and in each collection, subfolders can also be created. In this embodiment, the interface information of all the projects is uniformly imported into one collection of postman, then the subfolder of each project is newly built in the collection, and the interface information of each project is put into the corresponding subfolder, so that the interface information of each project is conveniently managed.
2. And exporting the collection to obtain a JSON format file, and analyzing the JSON format file to obtain interface information of each project.
It should be noted that JSON is a lightweight data exchange format, and adopts a text format completely independent of a programming language to store and represent data, and a simple and clear hierarchical structure makes JSON an ideal data exchange language, so that developers can easily read and write, and machines can easily parse and generate, and network transmission efficiency can be effectively improved.
Specifically, postman can convert the imported information based on any development language into a JSON format file and export the JSON format file, and the exported JSON format file is not limited to the development language any more, so that projects of different development languages can be supported, dependence on a project development environment is eliminated, no matter whether the development language of the project is python, C + +, java, php or other languages, the interface document can be automatically generated by the interface document automatic generation method provided by the embodiment, and the cross-development language can be used.
Step S103: and analyzing the domain name information corresponding to each interface from the interface information.
In step S103, a recursive method is used to extract url data from each interface information, and then IP information (IP address) and port information (port) corresponding to the interface information are obtained from the url data by means of data segmentation, where the IP information and the port information are domain name information.
Step S104: an interface document is generated using the interface information.
In step S104, after the interface information is acquired, a corresponding interface document is automatically generated by using the interface information according to the Swagger specification.
It should be noted that the Swagger Specification (Swagger Specification) specifies how to correctly describe the information of the interface. The Swagger specification is itself independent of the programming language, which supports two syntax styles: YAML grammar and JSON grammar, these two grammar styles can be converted each other, can be used to describe the interface information accurately, facilitate users and machine reading, at present, there are two kinds of main regulations of Swagger: swagger 2.0 and OpenAPI 3.0. In Swagger, a document for describing interface information is called a Swagger document, and the Swagger document refers to a file conforming to Swagger specification and is used for completely describing the interface information. There are two types of Swagger documents: yaml file and json file. YAML files are in YAML grammar style; JSON file is a JSON syntax style, and both files can be used to describe interface information and can be converted into each other. Generally speaking, Swagger documents are interface documents, but Swagger documents are written in a specific syntax. In this embodiment, after the interface information is obtained, an interface document in the YAML format or the JSON format is generated by using the interface information with reference to the Swagger specification.
Step S105: and aggregating the interface documents with the same domain name information and outputting the aggregated interface documents.
In step S105, after the corresponding relationship among the domain name information, the interfaces, and the interface documents is obtained, the interface documents with the same domain name information are aggregated, for example, aggregated in the same folder, and the aggregated folder is output.
Furthermore, after the interface documents are generated and aggregated, the interface documents can be placed in a directory recognizable by the Swagger UI, and a user can directly request the corresponding interface documents to be displayed online through a webpage without copying and transferring the interface documents. Wherein the Swagger UI is a set of HTML/CSS/JS frames for rendering the Swagger document so as to provide an aesthetically pleasing interface document interface. And, the interface document can also be edited or modified through the Swagger-editor. The Swagger-Editor is an Editor of a Swagger interface document, and in the Swagger Editor, the Swagger-Editor can be used for defining an interface based on the syntax such as JSON, YAML and the like, then automatically generating an interface document with beautiful typesetting and providing real-time preview.
Further, in this embodiment, after the user initiates the request through the web page, the problem of cross-domain and authentication is solved through nginx, and the request is forwarded and the request result is returned, so that the user can directly perform the interface test through the interface display page on the web page. nginx is a high performance HTTP and reverse proxy web server, while also providing IMAP/POP3/SMTP services.
The interface document automatic generation method of the first embodiment of the present invention extracts the interface information of each item from the item information in the interface document generation request after receiving the interface document generation request, analyzes the interface information to obtain the domain name information, thereby obtaining the domain name information of each interface, automatically aggregates the interface documents according to the domain name information after automatically generating the interface documents, aggregates the interface documents with the same domain name information in one folder, and the interface documents with the same domain name information correspond to the interfaces of the same item, so that the interface documents mixed together are automatically classified by using the domain name aggregation, when a certain interface document needs to be viewed, finds the corresponding folder according to the domain name information, and finds the required interface document therefrom without querying from all the interface documents, the difficulty in management is reduced, and the user can conveniently and quickly check the information.
Fig. 2 is a flowchart illustrating an interface document automatic generation method according to a second embodiment of the present invention. It should be noted that the method of the present invention is not limited to the flow sequence shown in fig. 2 if the results are substantially the same. As shown in fig. 2, the method comprises the steps of:
step S201: an interface document generation request is received, the interface document generation request including at least one item information.
In this embodiment, step S201 in fig. 2 is similar to step S101 in fig. 1, and for brevity, is not described herein again.
Step S202: interface information of each project is extracted from the at least one project information.
In this embodiment, step S202 in fig. 2 is similar to step S102 in fig. 1, and for brevity, is not described herein again.
Step S203: and analyzing the domain name information corresponding to each interface from the interface information.
In this embodiment, step S203 in fig. 2 is similar to step S103 in fig. 1, and for brevity, is not described herein again.
Step S204: the interface information is analyzed and project name information is extracted from the interface information.
In step S204, postman derived collection is utilized, which is divided into a plurality of levels, each level including item key information. In this embodiment, a hierarchy where key information in the interface information is located is first analyzed, where the key information refers to information of objects such as url, header, method, description, and response, and after the hierarchy is confirmed, the item name information is obtained in a name field of the hierarchy.
Step S205: and creating storage folders according to the project name information, wherein all interfaces of each project correspond to one storage folder.
In step S205, after the item name information is acquired, a corresponding storage folder is created for the item name, so as to create one storage folder for each item, which can be used for storing the interface document of the corresponding item.
Step S206: and generating an interface document corresponding to each interface by using the interface information and the Swagger specification.
Step S207: and storing the interface document into the corresponding storage folder based on the project name information.
In step S207, after the interface document is generated, the item to which the interface corresponding to the interface document belongs is confirmed, and the interface document is stored in the storage folder of the item, so that the human face divides all the interface document items.
Step S208: and aggregating the interface documents with the same domain name information and outputting the aggregated interface documents.
In this embodiment, step S208 in fig. 2 is similar to step S105 in fig. 1, and for brevity, is not described herein again.
It should be understood that, after the interface documents are stored in the project partitions, when the interface documents are aggregated, the interface documents in the same storage folder are aggregated, so that the interface documents are further grouped in the storage folder.
The method for automatically generating the interface document according to the second embodiment of the present invention extracts the project name information from the interface information on the basis of the first embodiment, creates a storage folder for each project on the basis of the project name information, and then stores the interface document corresponding to each project into the corresponding storage folder, thereby realizing the division of the interface document by project, and further facilitating the management and quick viewing of the user.
Fig. 3 is a flowchart illustrating an interface document automatic generation method according to a third embodiment of the present invention. It should be noted that the method of the present invention is not limited to the flow sequence shown in fig. 3 if the results are substantially the same. As shown in fig. 3, the method comprises the steps of:
step S301: an interface document generation request is received, the interface document generation request including at least one item information.
In this embodiment, step S301 in fig. 3 is similar to step S201 in fig. 2, and for brevity, is not described herein again.
Step S302: interface information of each project is extracted from the at least one project information.
In this embodiment, step S302 in fig. 3 is similar to step S202 in fig. 2, and for brevity, is not described herein again.
Step S303: and analyzing the domain name information corresponding to each interface from the interface information.
In this embodiment, step S303 in fig. 3 is similar to step S203 in fig. 2, and for brevity, is not described herein again.
Step S304: the interface information is analyzed and project name information is extracted from the interface information.
In this embodiment, step S304 in fig. 3 is similar to step S204 in fig. 2, and for brevity, is not described herein again.
Step S305: and creating storage folders according to the project name information, wherein all interfaces of each project correspond to one storage folder.
In this embodiment, step S305 in fig. 3 is similar to step S205 in fig. 2, and for brevity, is not described herein again.
Step S306: and automatically converting the interface information into parameters in a format specified by the Swagger specification according to a preset rule.
In step S306, after extracting the data required by the Swagger specification from the objects such as url, header, method, description, and response, the required data is automatically converted into the parameters in the format specified by the Swagger specification according to the preset rules, so that the parameters are automatically converted. For example, method corresponds to the request method identification in the Swagger specification, response corresponds to the responses in the Swagger specification, the element of the header in the request corresponds to the parameter under the parameters module in the Swagger specification, and the elements of the header in the method, the response and the request are automatically converted.
Step S307: and filling the parameters into a document template prepared in advance to obtain an interface document corresponding to each interface.
In step S307, after the required parameters are acquired, the parameters are filled in a document template prepared in advance, so as to obtain an interface document of each interface.
Step S308: and storing the interface document into the corresponding storage folder based on the project name information.
In this embodiment, step S308 in fig. 3 is similar to step S207 in fig. 2, and for brevity, is not described herein again.
Step S309: and aggregating the interface documents with the same domain name information and outputting the aggregated interface documents.
In this embodiment, step S309 in fig. 3 is similar to step S208 in fig. 2, and for brevity, is not described herein again.
In the method for automatically generating an interface document according to the third embodiment of the present invention, after the interface information is extracted, the interface information is automatically converted into parameters according to a format required by the Swagger specification, and then the parameters are automatically filled into a document template prepared in advance, so as to generate an interface document corresponding to an interface.
Fig. 4 is a flowchart illustrating an interface document automatic generation method according to a fourth embodiment of the present invention. It should be noted that the method of the present invention is not limited to the flow sequence shown in fig. 4 if the results are substantially the same. As shown in fig. 4, the method includes the steps of:
step S401: an interface document generation request is received, the interface document generation request including at least one item information.
In this embodiment, step S401 in fig. 4 is similar to step S301 in fig. 3, and for brevity, is not described herein again.
Step S402: interface information of each project is extracted from the at least one project information.
In this embodiment, step S402 in fig. 4 is similar to step S302 in fig. 3, and for brevity, is not described herein again.
Step S403: and analyzing the domain name information corresponding to each interface from the interface information.
In this embodiment, step S403 in fig. 4 is similar to step S303 in fig. 3, and for brevity, is not described herein again.
Step S404: the interface information is analyzed and project name information is extracted from the interface information.
In this embodiment, step S404 in fig. 4 is similar to step S304 in fig. 3, and for brevity, is not described herein again.
Step S405: and creating storage folders according to the project name information, wherein all interfaces of each project correspond to one storage folder.
In this embodiment, step S405 in fig. 4 is similar to step S305 in fig. 3, and for brevity, is not described herein again.
Step S406: and automatically converting the interface information into parameters in a format specified by the Swagger specification according to a preset rule.
In this embodiment, step S406 in fig. 4 is similar to step S306 in fig. 3, and after the operation of specifying the parameters of the format for the specification, the method further includes: judging whether the parameters corresponding to each interface include an example of which the length exceeds a preset threshold value; if yes, the example is cut off into at least two segments according to a preset cutting-off rule.
Optionally, after the aggregating module 65 aggregates the interface documents with the same domain name information and outputs the aggregated interface documents, the aggregating module is further configured to: and uploading the aggregated interface document to a block chain.
For other details of the technical solution implemented by each module in the automatic interface document generation system in the above embodiment, reference may be made to the description of the automatic interface document generation method in the above embodiment, and details are not described here again.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the system-class embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a terminal according to an embodiment of the present invention. As shown in fig. 7, the terminal 70 includes a processor 71 and a memory 72 coupled to the processor 71.
The memory 72 stores program instructions for implementing the interface document automatic generation method according to any of the above embodiments.
The processor 71 is used to execute program instructions stored by the memory 72 to generate interface documents and to automatically aggregate.
The processor 71 may also be referred to as a CPU (Central Processing Unit). The processor 71 may be an integrated circuit chip having signal processing capabilities. The processor 71 may also be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a storage medium according to an embodiment of the invention. The storage medium of the embodiment of the present invention stores a program file 81 capable of implementing all the methods described above, where the program file 81 may be stored in the storage medium in the form of a software product, and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a mobile hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, or terminal devices, such as a computer, a server, a mobile phone, and a tablet.
In the several embodiments provided in the present application, it should be understood that the disclosed system, terminal and method can be implemented in other manners. For example, the above-described system embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. The above embodiments are merely examples and are not intended to limit the scope of the present disclosure, and all modifications, equivalents, and flow charts using the contents of the specification and drawings of the present disclosure or those directly or indirectly applied to other related technical fields are intended to be included in the scope of the present disclosure.

Claims (10)

1. An automatic interface document generation method is characterized by comprising the following steps:
receiving an interface document generation request, wherein the interface document generation request comprises at least one item information;
extracting interface information of each project from the at least one project information;
analyzing domain name information corresponding to each interface from the interface information;
generating an interface document by using the interface information;
and aggregating the interface documents with the same domain name information and outputting the aggregated interface documents.
2. The method for automatically generating an interface document according to claim 1, wherein the extracting interface information of each item from the at least one item includes:
the interface information of the at least one project is uniformly imported into a collection of postman;
and exporting the collection to obtain a JSON format file, and analyzing the JSON format file to obtain interface information of each project.
3. The method for automatically generating an interface document according to claim 1, wherein the generating an interface document using the interface information includes:
analyzing the interface information and extracting project name information from the interface information;
creating storage folders according to the project name information, wherein all interfaces of each project correspond to one storage folder;
generating an interface document corresponding to each interface by using the interface information and the Swagger specification;
and storing the interface document to the corresponding storage folder based on the project name information.
4. The method according to claim 3, wherein the generating an interface document corresponding to each interface by using the interface information and the Swagger specification includes:
automatically converting the interface information into parameters in a format specified by the Swagger specification according to a preset rule;
and filling the parameters into a document template prepared in advance to obtain the interface document corresponding to each interface.
5. The method according to claim 4, wherein after automatically converting the interface information into the parameters in the format specified by the Swagger specification according to the preset rules, the method further comprises:
judging whether the parameters corresponding to each interface comprise authentication parameters or not;
and if not, setting the authentication parameters of the interface as default values and completing the default values into the parameters.
6. The method according to claim 4, wherein after automatically converting the interface information into the parameters in the format specified by the Swagger specification according to the preset rules, the method further comprises:
judging whether the parameters corresponding to each interface comprise examples of which the length exceeds a preset threshold value or not;
and if so, truncating the example into at least two segments according to a preset truncation rule.
7. The method according to claim 1, wherein after aggregating and outputting the interface documents with the same domain name information, the method further comprises:
and uploading the aggregated interface document to a block chain.
8. An interface document automatic generation system, characterized by comprising:
the system comprises a receiving module, a generating module and a processing module, wherein the receiving module is used for receiving an interface document generating request which comprises at least one item information;
the extraction module is used for extracting the interface information of each project from the at least one project information;
the analysis module is used for analyzing the domain name information corresponding to each interface from the interface information;
the generating module is used for generating an interface document by utilizing the interface information;
and the aggregation module is used for aggregating the interface documents with the same domain name information and outputting the aggregated interface documents.
9. A terminal, comprising a processor, a memory coupled to the processor, wherein,
the memory stores program instructions for implementing the method for automatic generation of an interface document according to any of claims 1-7;
the processor is to execute the program instructions stored by the memory to generate an interface document and to automatically aggregate.
10. A storage medium storing a program file capable of implementing the interface document automatic generation method according to any one of claims 1 to 7.
CN202011073606.XA 2020-10-09 2020-10-09 Automatic generation method, system, terminal and storage medium of interface document Pending CN112199331A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011073606.XA CN112199331A (en) 2020-10-09 2020-10-09 Automatic generation method, system, terminal and storage medium of interface document

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011073606.XA CN112199331A (en) 2020-10-09 2020-10-09 Automatic generation method, system, terminal and storage medium of interface document

Publications (1)

Publication Number Publication Date
CN112199331A true CN112199331A (en) 2021-01-08

Family

ID=74013196

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011073606.XA Pending CN112199331A (en) 2020-10-09 2020-10-09 Automatic generation method, system, terminal and storage medium of interface document

Country Status (1)

Country Link
CN (1) CN112199331A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783837A (en) * 2021-01-12 2021-05-11 北京首汽智行科技有限公司 API document searching method
CN113296752A (en) * 2021-05-25 2021-08-24 平安养老保险股份有限公司 Method, system, device and storage medium for generating API document
CN113778423A (en) * 2021-09-10 2021-12-10 上海幻电信息科技有限公司 Interface document generation method and system
CN113971024A (en) * 2021-12-24 2022-01-25 云账户技术(天津)有限公司 Interface management method, device, electronic equipment and readable storage medium
CN114461298A (en) * 2022-01-17 2022-05-10 ***股份有限公司 Interface technology standard document generation method and system

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783837A (en) * 2021-01-12 2021-05-11 北京首汽智行科技有限公司 API document searching method
CN112783837B (en) * 2021-01-12 2024-01-30 北京首汽智行科技有限公司 API document searching method
CN113296752A (en) * 2021-05-25 2021-08-24 平安养老保险股份有限公司 Method, system, device and storage medium for generating API document
CN113778423A (en) * 2021-09-10 2021-12-10 上海幻电信息科技有限公司 Interface document generation method and system
CN113778423B (en) * 2021-09-10 2024-03-01 上海幻电信息科技有限公司 Interface document generation method and system
CN113971024A (en) * 2021-12-24 2022-01-25 云账户技术(天津)有限公司 Interface management method, device, electronic equipment and readable storage medium
CN114461298A (en) * 2022-01-17 2022-05-10 ***股份有限公司 Interface technology standard document generation method and system

Similar Documents

Publication Publication Date Title
CN112199331A (en) Automatic generation method, system, terminal and storage medium of interface document
CN106682219B (en) Associated document acquisition method and device
US10229115B2 (en) System and method for creating an internationalized web application
CN108717437B (en) Search result display method and device and storage medium
CN111639473A (en) Excel file analysis method and device based on java, computer equipment and storage medium
CN107015948B (en) Log information formatting method and system
CN111221739A (en) Service testing method, device and system
WO2019242164A1 (en) Document management method and apparatus, computer device and storage medium
CN110737630B (en) Method and device for processing electronic archive file, computer equipment and storage medium
CN112650529B (en) System and method for configurable generation of mobile terminal APP codes
CN108768835B (en) Mail analysis method, device, server and storage medium
CN112527291A (en) Webpage generation method and device, electronic equipment and storage medium
CA3061623A1 (en) File sending in instant messaging applications
CN115242896A (en) Dynamic message analysis method and device, electronic equipment and computer readable storage medium
CN112286815A (en) Interface test script generation method and related equipment thereof
CN104978325B (en) A kind of web page processing method, device and user terminal
CN109471957B (en) Metadata conversion method and device based on uniform tags
CN114500423A (en) Message processing method, device, equipment and storage medium
CN113886174A (en) Monitoring information display and processing method and device, computer equipment and storage medium
CN115065945B (en) Short message link generation method and device, electronic equipment and storage medium
CN113779953B (en) Automatic document generation method and system
CN113127776A (en) Breadcrumb path generation method and device and terminal equipment
CN112417827B (en) Method, device, electronic equipment and storage medium for on-line document editing and displaying
CN115114280A (en) Report generation processing method, device and equipment
CN109344372B (en) Big data-based document generation method and system

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