Interface document generation method and related equipment

By automatically obtaining comment information and interface information after the code is written, the specification document is generated and split into interface documents, the problem of out-of-synchronization of interface documents is solved, the automatic generation of interface documents and strong binding of code and documents is realized, and the development efficiency is improved.

CN120010863APending Publication Date: 2025-05-16BEIJING HONGTENG INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311532746.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-16
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

In the government and enterprise browser server scenario, due to the excessive number of interfaces, the interface documents are often out of sync with the corresponding code, which affects the development progress.

Method used

Provides an interface document generation method, which automatically obtains comment information and interface information after the code is written, generates specification documents, and splits and generates corresponding interface documents based on the interface information.

Benefits of technology

Automatic generation of interface documents is realized, ensuring that interface documents are kept in synchronization with code, reducing the time and cost of interface maintenance, and improving development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120010863A_ABST
    Figure CN120010863A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an interface document generation method and related equipment. The interface document generation method comprises the following steps: in response to completion of interface code writing, acquiring annotation information corresponding to an interface code and interface information of a corresponding interface; generating a standard document according to the annotation information; and splitting the standard document according to the interface information to generate a corresponding interface document. According to the technical scheme, the interface document is automatically generated after code writing is completed, a developer only needs to write the code and the annotation information, the interface document can be automatically generated according to the code and the annotation information, strong binding of the code and the document is achieved, and the user experience is improved. The situation that in the prior art, interface documents are often asynchronous with corresponding codes is avoided, the interface maintenance time is shortened, the interface maintenance cost is reduced, and the development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer and communication technology, and in particular to an interface document generation method and related equipment. Background Art

[0002] In the government and enterprise browser server scenario, there are multiple interfaces. Because of the customization of project branches, there are more interfaces under customized branches.

[0003] Due to the large number of interfaces, and the need to communicate based on code in front-end and back-end development, code features are generally expressed through interface documents. However, as time goes by, interface documents maintained by humans often become out of sync with the corresponding code, affecting the development progress. Summary of the invention

[0004] The embodiments of the present application provide an interface document generation method and related devices, thereby overcoming, at least to a certain extent, the problem that the interface documents in the prior art are often out of sync with the corresponding codes.

[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0006] According to one aspect of an embodiment of the present application, an interface document generation method is provided, and the interface document generation method includes: in response to the completion of interface code writing, obtaining annotation information corresponding to the interface code and interface information of the corresponding interface; generating a specification document based on the annotation information; splitting the specification document according to the interface information to generate corresponding interface documents.

[0007] In some embodiments of the present application, the specification document is split according to the interface information to generate corresponding interface documents, which specifically includes: traversing all elements in the specification document according to the interface information to obtain multiple interface lists; re-arranging the document according to each interface list to generate corresponding interface documents.

[0008] In some embodiments of the present application, the interface information includes an interface tag, and traversing all elements in the specification document to obtain multiple interface lists includes: traversing all elements in the specification document to obtain a total interface list; and splitting the total interface list according to the interface tag to obtain multiple interface lists.

[0009] In some embodiments of the present application, the re-arranging of documents according to each of the interface lists to generate a corresponding interface document specifically includes: parsing the interface tags according to each of the interface lists; and re-arranging the documents according to the parsing results to generate a corresponding interface document.

[0010] In some embodiments of the present application, generating a standard document according to the annotation information specifically includes: obtaining a standard interface definition according to the annotation information; and filling the standard interface definition into a document template to obtain a standard document.

[0011] In some embodiments of the present application, obtaining a standard interface definition based on the annotation information specifically includes: obtaining a corresponding normalized template based on the interface information; and normalizing the annotation information through the normalized template to obtain a standard interface definition.

[0012] In some embodiments of the present application, obtaining a standard interface definition based on the annotation information specifically includes: inputting the annotation information into an interface specification model, and the interface specification model outputting a corresponding standard interface definition.

[0013] In some embodiments of the present application, the interface document generation method also includes: obtaining an annotation information sample set, the annotation information sample set comprising multiple annotation information samples, each of the annotation information samples being labeled with a corresponding standard interface definition; inputting the annotation information samples in the annotation information sample set into the interface specification model one by one to obtain the standard interface definition output by the interface specification model; updating parameters according to the output standard interface definition and the output standard interface definition until a predetermined condition is met, stopping training, and obtaining a trained interface specification model.

[0014] In some embodiments of the present application, after splitting the specification document according to the interface information to generate the corresponding interface document, the interface document generation method further includes: visualizing the interface documents one by one to display them to developers.

[0015] According to one aspect of an embodiment of the present application, an interface document generation device is provided, and the interface document generation device includes: an information acquisition module, which is used to obtain annotation information corresponding to the interface code and interface information of the corresponding interface in response to the completion of interface code writing; a document generation module, which is used to generate a specification document according to the annotation information; and a document splitting module, which is used to split the specification document according to the interface information to generate corresponding interface documents.

[0016] In some embodiments of the present application, the document splitting module specifically includes: a document traversal submodule, which is used to traverse all elements in the specification document according to the interface information to obtain multiple interface lists; and a document arrangement submodule, which is used to rearrange the document according to each of the interface lists to generate a corresponding interface document.

[0017] In some embodiments of the present application, the interface information includes an interface tag, and the document traversal submodule includes: a document traversal unit, used to traverse all elements in the specification document to obtain a total interface list; and a list splitting unit, used to split the total interface list according to the interface tag to obtain multiple interface lists.

[0018] In some embodiments of the present application, the document editing submodule specifically includes: a label parsing unit, used to parse the interface label according to each interface list; a document editing unit, used to rearrange the document according to the parsing result to generate a corresponding interface document.

[0019] In some embodiments of the present application, the document generation module specifically includes: a specification definition submodule, used to obtain a specification interface definition based on the annotation information; and a template filling submodule, used to fill the specification interface definition into the document template to obtain a specification document.

[0020] In some embodiments of the present application, the specification definition submodule specifically includes: a template acquisition unit, used to acquire the corresponding normalized template according to the interface information; and a standard processing unit, used to normalize the annotation information through the normalized template to obtain a standard interface definition.

[0021] In some embodiments of the present application, the specification definition submodule specifically includes: a model input unit, which is used to input the annotation information into an interface specification model, and the interface specification model outputs a corresponding specification interface definition.

[0022] In some embodiments of the present application, the interface document generation device also includes: a sample acquisition module, used to obtain an annotation information sample set, the annotation information sample set includes multiple annotation information samples, each of the annotation information samples is labeled with a corresponding standard interface definition; a sample input module, used to input the annotation information samples in the annotation information sample set into the interface specification model one by one to obtain the standard interface definition output by the interface specification model; a parameter update module, used to update parameters according to the output standard interface definition and the output standard interface definition until a predetermined condition is met, stop training, and obtain a trained interface specification model.

[0023] In some embodiments of the present application, the interface document generating device further includes: a visualization module, which is used to visualize the interface documents one by one to display them to developers.

[0024] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the interface document generation method described in the above embodiment is implemented.

[0025] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the interface document generation method as described in the above embodiments.

[0026] In the technical solutions provided in some embodiments of the present application, the corresponding annotation information and interface information are automatically obtained after the code is written, the annotation information is sorted to generate the corresponding specification document, and then the specification document is split according to the interface information to obtain the corresponding interface document. The interface document is automatically generated after the code is written. As long as the developer writes the code and annotation information, the interface document can be automatically generated according to the code and annotation information, realizing a strong binding between the code and the document, avoiding the situation in which the interface document of the prior art is often out of sync with the corresponding code, reducing the time and cost of interface maintenance, and improving development efficiency.

[0027] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0029] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.

[0030] Figure 2 A flow chart of an interface document generation method provided in an embodiment of the present application is shown.

[0031] Figure 3 Shown according to Figure 2 A specific implementation flowchart of step S200 in the interface document generation method shown in the corresponding embodiment.

[0032] Figure 4 Shown according to Figure 2 A specific implementation flowchart of step S300 in the interface document generation method shown in the corresponding embodiment.

[0033] Figure 5 A schematic diagram of the structure of an interface document generating device provided in an embodiment of the present application is shown.

[0034] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0035] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.

[0036] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0037] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0038] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0039] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.

[0040] like Figure 1 As shown, the system architecture may include terminal devices (such as Figure 1 The embodiment of the present invention is a schematic diagram of a mobile phone 101, a tablet computer 102, a portable computer 103, a desktop computer, etc., a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the terminal device and the server 105. The network 104 may include various connection types, such as a wired communication link, a wireless communication link, etc.

[0041] It should be understood that Figure 1The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.

[0042] The user can use the terminal device to interact with the server 105 through the network 104 to receive or send messages, etc. The server 105 can be a server that provides various services. For example, the user uses the terminal device 103 (or the terminal device 101 or 102) to upload the annotation information corresponding to the interface code and the interface information of the corresponding interface to the server 105, and the server 105 can generate a specification document based on the annotation information; split the specification document according to the interface information to generate a corresponding interface document.

[0043] It should be noted that the interface document generation method provided in the embodiment of the present application is generally executed by the server 105, and accordingly, the interface document generation device is generally set in the server 105. However, in other embodiments of the present application, the terminal device may also have similar functions as the server, thereby executing the interface document generation solution provided in the embodiment of the present application.

[0044] The implementation details of the technical solution of the embodiment of the present application are described in detail below:

[0045] Figure 2 A flowchart of a method for generating an interface document according to an embodiment of the present application is shown. The method for generating an interface document can be executed by a server. The server can be Figure 1 Refer to the server shown in . Figure 2 As shown, the interface document generation method at least includes:

[0046] Step S100, in response to the completion of the interface code writing, obtaining the annotation information corresponding to the interface code and the interface information of the corresponding interface.

[0047] Step S200: Generate a standard document based on the annotation information.

[0048] Step S300, splitting the specification document according to the interface information to generate corresponding interface documents.

[0049] In an embodiment of the present application, the corresponding annotation information and interface information are automatically obtained after the code is written, the annotation information is sorted to generate a corresponding specification document, and then the specification document is split according to the interface information to obtain the corresponding interface document. The interface document is automatically generated after the code is written. As long as the developer writes the code and annotation information, the interface document can be automatically generated according to the code and annotation information, realizing a strong binding between the code and the document, avoiding the situation in which the interface document of the prior art is often out of sync with the corresponding code, reducing the time and cost of interface maintenance, and improving development efficiency.

[0050] In step S100, after the interface code is written, the annotation information in the interface code is obtained, and the interface information therein is obtained at the same time, and the annotation information and the interface information are correspondingly associated to achieve strong binding of the interface, code and annotation information.

[0051] Because most of Golang's web frameworks are implemented based on the principle of MVC, a few special ones also have interface entrances, so we add annotation information based on the interface entrance to mark the specific information of the interface.

[0052] In an embodiment of the present application, the interface information includes the interface name, interface URL, interface request method, request parameter input content-type, interface input parameter, interface return value, and field names in the input parameter and return value.

[0053] In an embodiment of the present application, the interface information also includes an interface tag.

[0054] The interface tag can be expressed in many forms, for example, it can be expressed in the following form: Tagsv13.1.2002.345,Admin / App,project_name. That is, the interface document and the project where the interface is located are marked in a comma-separated manner. v13.1.2002.345 represents the code version, Admin / App is the project module, and project_name is actually the project branch, such as project1 or project2.

[0055] In step S200, the annotation information is sorted and a corresponding standard document is automatically generated.

[0056] Specifically, in some embodiments, the specific implementation of step S200 can be found in Figure 3 . Figure 3 is based on Figure 2 The detailed description of step S200 in the interface document generation method shown in the corresponding embodiment, in the interface document generation method, step S200 may include the following steps:

[0057] Step S210: obtaining a standard interface definition according to the annotation information.

[0058] Step S220, filling the standard interface definition into the document template to obtain a standard document.

[0059] In an embodiment of the present application, the annotation information is first normalized to obtain the corresponding normalized definition, and then the document template is filled in according to the normalized definition to obtain the corresponding standard document. The standard document can be an interface document in the swagger standard format, so that it can be used in other products, such as yapi, postman, etc.

[0060] In step S210, there are multiple ways to obtain the standard interface definition according to the annotation information, and the specific examples may refer to the following embodiments.

[0061] Specifically, in some embodiments, the specific implementation of step S210 can refer to the following embodiments. Figure 3 The detailed description of step S210 in the interface document generation method shown in the corresponding embodiment, in the interface document generation method, step S210 may include the following steps:

[0062] According to the interface information, obtain the corresponding normalized template.

[0063] The annotation information is normalized by using the normalization template to obtain a normalized interface definition.

[0064] In the embodiment of the present application, the corresponding normalized template is first retrieved according to the interface information, and the annotation information is normalized by the normalized template to obtain the normalized interface definition. The normalized template is configured, and it can have a general template and multiple targeted templates for different code versions and project modules.

[0065] In other embodiments, the swaggo conversion tool provided by swagger may be used instead of the normalization template to normalize the annotation information to obtain a normalized interface definition.

[0066] Specifically, in some embodiments, the specific implementation of step S220 can refer to the following embodiments. Figure 3 The detailed description of step S220 in the interface document generation method shown in the corresponding embodiment, in the interface document generation method, step S220 may include the following steps:

[0067] The annotation information is input into an interface specification model, and the interface specification model outputs a corresponding specification interface definition.

[0068] In this embodiment, a neural network model is used to normalize the annotation information to obtain a corresponding standard interface definition.

[0069] Specifically, the training method of the above interface specification model specifically includes:

[0070] An annotation information sample set is obtained, wherein the annotation information sample set includes a plurality of annotation information samples, and each of the annotation information samples is annotated with a corresponding standard interface definition.

[0071] The annotation information samples in the annotation information sample set are input into the interface specification model one by one to obtain the specification interface definition output by the interface specification model.

[0072] According to the output standard interface definition and the output standard interface definition, parameters are updated until predetermined conditions are met, and training is stopped to obtain a trained interface standard model.

[0073] In this embodiment, in order to analyze and learn the annotation information, the convolutional neural network can well capture the semantic features contained in the annotation information itself, mine the correlation between the annotation information, and has strong generalization ability and robustness. When training, the conditions for stopping training, that is, the conditions for model training, can be multiple, and the specific embodiments can be referred to as follows.

[0074] Specifically, in some embodiments, the specific implementation of the above interface specification model training can refer to the following embodiments. In this embodiment, according to the output specification interface definition and the output specification interface definition, the parameters are updated until the predetermined conditions are met, the training is stopped, and the trained interface specification model is obtained, which can include the following steps:

[0075] If, in the annotation information sample set, less than a predetermined number of annotation information samples are input into the interface specification model and the outputted standard interface definition is consistent with the marked standard interface definition, the parameters of the interface specification model are updated.

[0076] If more than a predetermined number of annotation information samples in the annotation information sample set are input into the interface specification model and the output standard interface definition is consistent with the marked standard interface definition, the predetermined end condition is met, the training is ended, and a trained interface specification model is obtained.

[0077] Specifically, in other embodiments, the specific implementation of the above interface specification model training can refer to the following embodiments. In this embodiment, according to the output specification interface definition and the output specification interface definition, the parameters are updated until the predetermined conditions are met, the training is stopped, and the trained interface specification model is obtained, which may include the following steps:

[0078] The loss function is determined according to the canonical interface definition of the model output and the canonical interface definition of the label.

[0079] The parameters of the interface specification model are updated according to the loss function until a predetermined end condition is reached, and the training is terminated to obtain a trained interface specification model.

[0080] In this embodiment, the loss function reaching a predetermined end condition may be that the loss function converges or the loss function is less than a predetermined loss (eg, 0.001).

[0081] In the above embodiment, log text recognition is performed through a neural network model obtained through multiple trainings to obtain corresponding judgment results. The neural network model is obtained through multiple trainings. The more samples it trains, the more accurate the results obtained. It basically does not require maintenance during operation, which also reduces maintenance costs, improves the efficiency and accuracy of traffic identification, and reduces the false alarm rate.

[0082] It should be noted that, in some other embodiments, the annotation information sample set may also be divided into a training set, a test set, and a validation set for training, and the K-fold cross validation fold may be used.

[0083] In step S220, the obtained standard interface definition is directly filled into the document template to generate a standard document, which is an intermediate document.

[0084] In step S300, the specification document is split to obtain interface documents corresponding to different versions and branches.

[0085] Specifically, in some embodiments, the specific implementation of step S300 can be found in Figure 4 . Figure 4 is based on Figure 2 The detailed description of step S300 in the interface document generation method shown in the corresponding embodiment, in the interface document generation method, step S300 may include the following steps:

[0086] Step S310: According to the interface information, all elements in the specification document are traversed to obtain multiple interface lists.

[0087] Step S320: re-arrange the documents according to the interface lists to generate corresponding interface documents.

[0088] In an embodiment of the present application, all elements in the specification document are first traversed according to the interface information to generate a corresponding interface list, and then the document is rearranged according to the interface list to obtain the corresponding interface document.

[0089] In step S310, all elements in the specification document are traversed according to the interface information, the document information therein is extracted, and a corresponding plurality of interface lists are generated.

[0090] Specifically, in some embodiments, the specific implementation of step S310 can refer to the following embodiments. Figure 4 The detailed description of step S310 in the interface document generation method shown in the corresponding embodiment, in the interface document generation method, the interface information includes an interface tag, and step S310 may include the following steps:

[0091] All elements in the specification document are traversed to obtain a total list of interfaces.

[0092] The total interface list is split according to the interface labels to obtain multiple interface lists.

[0093] In this embodiment, all elements in the specification document are first traversed to extract the document information therein to obtain a total list of interfaces, and then the total list of interfaces is split according to the interface label to obtain multiple interface lists. The interface label contains the code version of the interface code, the project module in which it is located, the project branch, etc. According to the interface label, the total list of interfaces is split into an interface document list corresponding to the code version and an interface document list corresponding to the project branch name.

[0094] In step S320, documents are rearranged according to each interface list to generate corresponding interface documents.

[0095] Specifically, in some embodiments, the specific implementation of step S320 can refer to the following embodiments. Figure 4 The detailed description of step S320 in the interface document generation method shown in the corresponding embodiment, in the interface document generation method, step S320 may include the following steps:

[0096] According to each of the interface lists, the interface labels are parsed.

[0097] According to the analysis result, the document is rearranged to generate a corresponding interface document.

[0098] In this embodiment, the interface tag is first parsed according to the interface list to obtain the parsing result, which is the content corresponding to each code version and the content corresponding to each project branch. According to the parsing result, the document is rearranged to obtain the interface document corresponding to each code version and the interface document corresponding to each project branch.

[0099] Specifically, in some embodiments, after step S300, the above-mentioned interface document generation method further includes:

[0100] Visualize the above interface documents one by one to show them to developers.

[0101] In some embodiments, the visualization technique may be to import the above-mentioned interface documents one by one into an interface document viewing tool, and display the interface documents through the interface document viewing tool.

[0102] In other embodiments, the visualization technique may be to convert the above-mentioned interface documents one by one into document formats such as PDF or Word, and display various information in the interface documents in a table form.

[0103] The following describes an apparatus embodiment of the present application, which can be used to execute the interface document generation method in the above-mentioned embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the embodiment of the interface document generation method in the above-mentioned embodiment of the present application.

[0104] Figure 5 A block diagram of an interface document generating device according to an embodiment of the present application is shown.

[0105] Reference Figure 5 As shown, according to an embodiment of the present application, an interface document generating device 500 includes: an information acquiring module 510, a document generating module 520, and a document splitting module 530.

[0106] Among them, the information acquisition module 510 is used to respond to the completion of the interface code writing, obtain the annotation information corresponding to the interface code and the interface information of the corresponding interface; the document generation module 520 is used to generate a standard document according to the annotation information; the document splitting module 530 is used to split the standard document according to the interface information to generate the corresponding interface document.

[0107] In some embodiments of the present application, the document splitting module specifically includes: a document traversal submodule, which is used to traverse all elements in the specification document according to the interface information to obtain multiple interface lists; and a document arrangement submodule, which is used to rearrange the document according to each of the interface lists to generate a corresponding interface document.

[0108] In some embodiments of the present application, the interface information includes an interface tag, and the document traversal submodule includes: a document traversal unit, used to traverse all elements in the specification document to obtain a total interface list; and a list splitting unit, used to split the total interface list according to the interface tag to obtain multiple interface lists.

[0109] In some embodiments of the present application, the document editing submodule specifically includes: a label parsing unit, used to parse the interface label according to each interface list; a document editing unit, used to rearrange the document according to the parsing result to generate a corresponding interface document.

[0110] In some embodiments of the present application, the document generation module specifically includes: a specification definition submodule, used to obtain a specification interface definition based on the annotation information; and a template filling submodule, used to fill the specification interface definition into the document template to obtain a specification document.

[0111] In some embodiments of the present application, the specification definition submodule specifically includes: a template acquisition unit, used to acquire the corresponding normalized template according to the interface information; and a standard processing unit, used to normalize the annotation information through the normalized template to obtain a standard interface definition.

[0112] In some embodiments of the present application, the specification definition submodule specifically includes: a model input unit, which is used to input the annotation information into an interface specification model, and the interface specification model outputs a corresponding specification interface definition.

[0113] In some embodiments of the present application, the interface document generation device also includes: a sample acquisition module, used to obtain an annotation information sample set, the annotation information sample set includes multiple annotation information samples, each of the annotation information samples is labeled with a corresponding standard interface definition; a sample input module, used to input the annotation information samples in the annotation information sample set into the interface specification model one by one to obtain the standard interface definition output by the interface specification model; a parameter update module, used to update parameters according to the output standard interface definition and the output standard interface definition until a predetermined condition is met, stop training, and obtain a trained interface specification model.

[0114] In some embodiments of the present application, the interface document generating device further includes: a visualization module, which is used to visualize the interface documents one by one to display them to developers.

[0115] In an embodiment of the present application, the corresponding annotation information and interface information are automatically obtained after the code is written, the annotation information is sorted to generate a corresponding specification document, and then the specification document is split according to the interface information to obtain the corresponding interface document. The interface document is automatically generated after the code is written. As long as the developer writes the code and annotation information, the interface document can be automatically generated according to the code and annotation information, realizing a strong binding between the code and the document, avoiding the situation in which the interface document of the prior art is often out of sync with the corresponding code, reducing the time and cost of interface maintenance, and improving development efficiency.

[0116] Figure 6 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.

[0117] It should be noted that Figure 6 The computer system of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0118] like Figure 6 As shown, the computer system includes a central processing unit (CPU) 1801, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1802 or the program loaded from the storage part 1808 to the random access memory (RAM) 1803, such as executing the method described in the above embodiment. In RAM 1803, various programs and data required for system operation are also stored. CPU 1801, ROM 1802 and RAM 1803 are connected to each other through bus 1804. Input / output (I / O) interface 1805 is also connected to bus 1804.

[0119] The following components are connected to the I / O interface 1805: an input section 1806 including a keyboard, a mouse, etc.; an output section 1807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1808 including a hard disk, etc.; and a communication section 1809 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1809 performs communication processing via a network such as the Internet. A drive 1810 is also connected to the I / O interface 1805 as needed. A removable medium 1811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1810 as needed so that a computer program read therefrom is installed into the storage section 1808 as needed.

[0120] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1809, and / or installed from a removable medium 1811. When the computer program is executed by a central processing unit (CPU) 1801, various functions defined in the system of the present application are executed.

[0121] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0122] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0123] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0124] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.

[0125] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0126] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0127] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.

[0128] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A method for generating an interface document, characterized in that: The interface document generation method comprises: In response to the completion of the interface code writing, obtaining annotation information corresponding to the interface code and interface information of the corresponding interface; Generate a specification document based on the annotation information; The specification document is split according to the interface information to generate corresponding interface documents.

2. The interface document generation method according to claim 1, characterized in that: The step of splitting the specification document according to the interface information to generate a corresponding interface document specifically includes: According to the interface information, traverse all elements in the specification document to obtain multiple interface lists; The documents are rearranged according to the interface lists to generate corresponding interface documents.

3. The interface document generation method according to claim 2, characterized in that: The interface information includes an interface tag, and traversing all elements in the specification document to obtain multiple interface lists includes: Traverse all elements in the specification document to obtain a total list of interfaces; The total interface list is split according to the interface labels to obtain multiple interface lists.

4. The interface document generation method according to claim 3, characterized in that: The re-arranging of the documents according to the interface lists to generate corresponding interface documents specifically includes: According to each of the interface lists, parsing the interface labels; According to the analysis result, the document is rearranged to generate a corresponding interface document.

5. The interface document generation method according to claim 1, characterized in that: Generating a specification document according to the annotation information specifically includes: According to the annotation information, a standard interface definition is obtained; Fill the specification interface definition into the document template to obtain a specification document.

6. The interface document generation method according to claim 5, characterized in that: The step of obtaining a standard interface definition according to the annotation information specifically includes: The annotation information is input into an interface specification model, and the interface specification model outputs a corresponding specification interface definition.

7. The interface document generation method according to claim 6, characterized in that: The interface document generation method also includes: Acquire an annotation information sample set, wherein the annotation information sample set includes a plurality of annotation information samples, each of which is annotated with a corresponding standard interface definition; Inputting the annotation information samples in the annotation information sample set into the interface specification model one by one to obtain the specification interface definition output by the interface specification model; According to the output standard interface definition and the output standard interface definition, parameters are updated until predetermined conditions are met, and training is stopped to obtain a trained interface standard model.

8. An interface document generating device, characterized in that: The interface document generating device comprises: An information acquisition module, configured to acquire annotation information corresponding to the interface code and interface information of the corresponding interface in response to completion of the interface code writing; A document generation module, used to generate a standard document according to the annotation information; The document splitting module is used to split the specification document according to the interface information to generate corresponding interface documents.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the interface document generation method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the interface document generation method as described in any one of claims 1 to 7.