Interface document generation method and device, equipment, storage medium and program product
Through the reverse generation method of interface design data, the problem that existing interface document generation components cannot maintain consistency when code updates are updated is solved, real-time consistency between the source code of the interface framework and the document, and is suitable for interface document generation in various scenarios .
Patent Information
- Application Number
- CN202411093920.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-12-03
AI Technical Summary
In the cloud development paradigm based on a 4-layer architecture, existing interface document generation components cannot maintain the consistency of code and documents, especially when code is updated, resulting in the generation components being not universal enough and suitable for specific scenarios rather than general scenarios.
By receiving the interface design data input by the user, generate the source design document based on the preset interface design document template, and enter it into the preset code production template to generate the interface framework source code to detect consistency in real time. If updated, reverse generation and update Interface documentation to ensure consistency between code and documentation.
It realizes the consistency of the interface framework source code and interface documents when code is updated, avoids inconsistency between code and document, and improves the universality and efficiency of generating components.
Smart Images

Figure CN119065707A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of interface technology, and in particular to an interface document generation method, device, equipment, storage medium and program product. Background Art
[0002] With the development of the Internet, more and more components are involved in the user interface development process. When developers have completed the component, they also need to write the corresponding document for other developers to use the component. Among them, the interface document is a standardized interface description document used by service users and service providers to communicate with each other in order to improve the efficiency of collaboration during the software development process. It is the basis for calling the interface.
[0003] In the process of generating interface documents, based on the 4-layer cloud development paradigm, there are a large number of DTO (Data Transfer Object), PO (Persistent Object), VO (Value Object), POJO (Plain Old Java Object), etc. These objects can be automatically generated through the generation components of structured documents to avoid mechanical duplication and increase the workload. However, the current generation components are not universal enough and are more suitable for specific scenarios. When the code is updated, the consistency of the code and the document cannot be maintained. Summary of the invention
[0004] The main purpose of this application is to provide an interface document generation method, device, equipment, storage medium and program product, aiming to solve the technical problem that the current generation components are more suitable for characteristic scenarios and cannot maintain the consistency of code and documents when the code is updated.
[0005] To achieve the above purpose, the present application proposes a method for generating an interface document, the method comprising:
[0006] Receiving interface design data input by a user, and generating a source design document according to a preset interface design document template and the interface design data;
[0007] Input the source design document into a preset code production template to obtain the interface framework source code corresponding to the source design document;
[0008] Upon receiving a consistency check instruction, detecting whether the interface framework source code is updated;
[0009] If the interface framework source code is updated, reverse generation is performed based on the source design document and the updated interface framework source code to obtain an updated interface document.
[0010] In one embodiment, the step of receiving interface design data input by a user and generating a source design document according to a preset interface design document template and the interface design data includes:
[0011] Receiving interface design data input by a user;
[0012] Performing text extraction on the interface design data to obtain a plurality of function type data corresponding to the interface design data;
[0013] According to the mapping relationship of the preset interface design document template, the multiple function type data are filled into the corresponding positions of the preset interface design document template to generate a source design document.
[0014] In one embodiment, the step of inputting the source design document into a preset code production template to obtain the interface framework source code corresponding to the source design document includes:
[0015] Inputting the source design document into a preset code production template to obtain multiple source codes;
[0016] Determine a code framework corresponding to the source design document, wherein the code framework includes a request layer, a response layer, a control layer, and a service layer;
[0017] The multiple source codes are filled into the request layer, the response layer, the control layer and the service layer accordingly, and an interface framework source code corresponding to the source design document is generated.
[0018] In one embodiment, after the step of inputting the source design document into a preset code production template to obtain the interface framework source code corresponding to the source design document, the step further includes:
[0019] Compressing the interface framework source code to obtain compressed interface framework source code;
[0020] Storing the compressed interface framework source code in an interface project engineering to generate a corresponding code guide directory, wherein the interface project engineering is a collection of various source design documents;
[0021] Correspondingly, if the interface framework source code is updated, reverse generation is performed based on the source design document and the updated interface framework source code to obtain the updated interface document, and further includes:
[0022] The updated interface document is stored in the interface project to obtain an updated code guide directory.
[0023] In one embodiment, if the interface framework source code is updated, the step of reverse engineering the source design document and the updated interface framework source code to obtain an updated interface document includes:
[0024] If the interface framework source code is updated, the corresponding interface name and interface path are obtained from the interface project according to the code guide directory;
[0025] Determine multiple interface unique identifiers corresponding to the updated interface framework source code according to the interface name and interface path;
[0026] The updated interface framework source code is reverse-engineered using the multiple interface unique identifiers and the source design document to obtain an updated interface document.
[0027] In one embodiment, after the step of reverse engineering the updated interface framework source code using the multiple interface unique identifiers and the source design document to obtain the updated interface document, the step further includes:
[0028] Compare the multiple interface unique identifiers according to the source design document, and determine whether there is a code-added interface according to the comparison result;
[0029] If the code-added interface exists, then based on the code-added interface, the step of generating the source design document according to the preset interface design document template and the interface design data is returned to obtain the newly added source design document corresponding to the code-added interface.
[0030] In addition, to achieve the above purpose, the present application also proposes an interface document generation device, the device comprising:
[0031] A document generation module, used to receive interface design data input by a user, and generate a source design document according to a preset interface design document template and the interface design data;
[0032] A code generation module, used to input the source design document into a preset code production template to obtain an interface framework source code corresponding to the source design document;
[0033] A consistency check module, used to detect whether the interface framework source code is updated when receiving a consistency check instruction;
[0034] The reverse generation module is used to perform reverse generation based on the source design document and the updated interface framework source code to obtain an updated interface document if the interface framework source code is updated.
[0035] In addition, to achieve the above-mentioned purpose, the present application also proposes an interface document generation device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the interface document generation method described above.
[0036] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the interface document generation method described above are implemented.
[0037] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the interface document generation method described above are implemented.
[0038] One or more technical solutions proposed in this application have at least the following technical effects: this application first receives the interface design data input by the user, and generates a source design document according to the preset interface design document template and the interface design data; then the source design document is input into the preset code production template to obtain the interface framework source code corresponding to the source design document; then upon receiving the consistency check instruction, it is detected whether the interface framework source code is updated; if the interface framework source code is updated, then reverse generation is performed according to the source design document and the updated interface framework source code to obtain an updated interface document. Since this application can quickly perform reverse generation according to the updated interface framework source code corresponding to the source design document, the interface framework source code and the interface document are generated mutually, avoiding the situation where the code and document of the current generation component are inconsistent when the code is updated, thereby maintaining the consistency of the interface framework source code and the interface document. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0041] Figure 1 A flowchart of the first embodiment of the method for generating an interface document of the present application is provided;
[0042] Figure 2 A flowchart of the second embodiment of the method for generating an interface document of the present application is provided;
[0043] Figure 3 A schematic diagram of the template mapping relationship provided in Example 2 of the present application;
[0044] Figure 4This is a schematic diagram of the module structure of the interface document generating device according to an embodiment of the present application;
[0045] Figure 5 A schematic diagram of the device structure of the hardware operating environment involved in the interface document generation method in the embodiment of the present application.
[0046] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0047] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0048] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0049] It should be noted that the execution subject of this embodiment can be a computing service device with interface document design, source code generation and reverse generation functions, such as a personal computer, server, etc., or an electronic device capable of realizing the above functions, an interface document generation device (hereinafter referred to as a generation device) that executes the interface document generation method of this application, etc., and this embodiment does not limit this. The following takes the generation device as an example to illustrate this embodiment and the following embodiments.
[0050] Based on this, the present application embodiment provides a method for generating an interface document, referring to Figure 1 , Figure 1 A flowchart diagram of the first embodiment of the interface document generation method of the present application.
[0051] In this embodiment, the interface document generation method includes steps S10 to S40:
[0052] Step S10: receiving interface design data input by a user, and generating a source design document according to a preset interface design document template and the interface design data.
[0053] It should be noted that interface design data refers to various relevant information and specific contents involved in designing an interface.
[0054] Exemplarily, the interface design data may include interface parameters, data format, request and response methods, interface function description, performance indicator data, error handling information, permission-related data, associated data, etc., which is not limited in this embodiment.
[0055] It should be noted that the preset interface design document template is a pre-established standardized document format template for describing interface-related information. The preset interface design document template can ensure the standardization and consistency of the interface design document.
[0056] It should be noted that the source design document is the initial design description file of the interface generated based on the preset interface design document template and interface design data.
[0057] Exemplarily, the source design document may include various characteristics of the interface, such as the functional purpose of the interface, applicable scenarios, input and output data formats and specifications, calling methods, parameter definitions and requirements, possible returned results and status codes, and relationships with other interfaces.
[0058] In one embodiment, the generating device may first receive the interface design data input by the user, and then input the interface design data into a preset interface design document template, complete the interface design according to the format of the template, and generate a source design document.
[0059] Step S20: input the source design document into a preset code production template to obtain the interface framework source code corresponding to the source design document.
[0060] It should be noted that the preset code production template is a template pre-set in the generating device and is used to convert the source design document into interface-related codes.
[0061] The preset code production template may contain some fixed structures, code frameworks, and basic logic related to interface implementation. When you need to generate code for a specific interface, you can fill in and improve the specific function implementation part based on this template, thereby improving the efficiency and standardization of code generation, reducing duplication of work, and further ensuring that the code has a certain consistency and rationality in structure and style.
[0062] The above preset code production template and preset interface design document template are easy to use. You only need to follow the template to complete the interface design and realize the source code and document generation functions, thereby improving the user experience and reducing the cost of use.
[0063] It should be noted that the interface framework source code is the original code involved in building the interface framework.
[0064] Exemplarily, the interface framework source code may define key elements of the interface framework, such as the basic architecture, operation logic, data processing method, and interaction rules with other parts.
[0065] In one embodiment, the generation device can input the source design document into a preset code production template and convert it into the corresponding interface framework source code, thereby improving the efficiency and standardization of code generation, reducing duplication of work, and further ensuring that the code has a certain consistency and rationality in structure and style.
[0066] Step S30: upon receiving the consistency check instruction, detecting whether the interface framework source code is updated.
[0067] It should be noted that the consistency check instruction is an instruction used to check whether the interface framework source code is consistent with the source design document.
[0068] The consistency check command can ensure that the source design document and the interface framework source code are consistent and correct. For example, check whether the data format is consistent, whether the results of the previous and next operations match each other, and whether the data between different modules is coordinated and consistent.
[0069] Step S40: If the interface framework source code is updated, reverse generation is performed based on the source design document and the updated interface framework source code to obtain an updated interface document.
[0070] It should be noted that the updated interface document is an interface design document obtained by reverse engineering the updated interface framework source code.
[0071] In this implementation, the generation device will perform a consistency check in real time or periodically to detect whether the interface framework source code is updated. When the interface framework source code is updated, the original interface is determined according to the interface name, the corresponding source design document is searched, and reverse generation is performed in combination with the updated interface framework source code to obtain an updated interface document. This allows the interface document and the source code to be generated mutually, and the consistency of the interface document and the source code is maintained.
[0072] This embodiment provides an interface document generation method, in which the generation device can first receive the interface design data input by the user, and then input the interface design data into a preset interface design document template, complete the interface design according to the format of the template, and generate a source design document. The source design document is then input into a preset code production template and converted into the corresponding interface framework source code, thereby improving the efficiency and standardization of code generation and reducing duplication of work. Finally, a consistency check will be performed in real time to detect whether the interface framework source code is updated. When the interface framework source code is updated, the original interface is determined according to the interface name, the corresponding source design document is searched, and reverse generation is performed in combination with the updated interface framework source code to obtain an updated interface document. This allows the interface document and the source code to be generated mutually, keeping the interface document and the source code consistent.
[0073] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 1 and Figure 2 , Figure 2 A flowchart diagram is provided for the second embodiment of the interface document generation method of this application.
[0074] In this example, step S10 includes steps S11 to S13:
[0075] Step S11: receiving interface design data input by the user.
[0076] Step S12: performing text extraction on the interface design data to obtain a plurality of function type data corresponding to the interface design data.
[0077] It should be noted that multiple function type data are various interface-related data in the interface design data, such as input, output, interface name, request path, module name, permission control rules, interface function description, etc.
[0078] Step S13: According to the mapping relationship of the preset interface design document template, the plurality of function type data are filled into corresponding positions of the preset interface design document template to generate a source design document.
[0079] It should be noted that the mapping relationship is the correspondence and association relationship between different interface elements or information in the preset interface design document template.
[0080] For ease of understanding, refer to Figure 3 , Figure 3 The template mapping relationship diagram provided for the second embodiment of the present application does not limit the present solution. Exemplarily, the corresponding positions in the template contain various interface elements (for example, the interface URL path corresponds to the interface path and code 1, the interface name corresponds to the interface name and code 2, the input object corresponds to the input and code 3, the interface description corresponds to the business logic description and code 4, the permission corresponds to the permission code and code 5, the paging parameter corresponds to whether to paginate and code 6, etc.), and the position and role of the interface in the entire business logic are displayed through the mapping relationship of the preset interface design document template.
[0081] In this embodiment, the generating device may first perform text extraction on the interface design data to obtain corresponding multiple function type data, such as input, output, interface name, request path, module name, permission control rules, interface function description, etc. Then, according to the mapping relationship of the preset interface design document template, fill in the corresponding position in the preset interface design document template to generate the source design document. After the generation is successful, all files are packaged for users to download. It should be noted that the template can support dynamic modification to adapt to different scenario requirements. In this way, the interface design can be completed only according to the preset interface design document template, which improves the design efficiency.
[0082] In a feasible implementation, step S20 of this embodiment may include the steps of: inputting the source design document into a preset code production template to obtain multiple source codes; determining a code framework corresponding to the source design document, the code framework including a request layer, a response layer, a control layer and a service layer; filling the multiple source codes into the request layer, the response layer, the control layer and the service layer accordingly to generate an interface framework source code corresponding to the source design document.
[0083] It should be noted that the various source codes are multiple types of codes corresponding to the source design documents, such as layered codes corresponding to the request layer, response layer, control layer and service layer.
[0084] It should be noted that the request layer (Request) is the interface framework layer responsible for receiving requests sent from the outside, and performing preliminary processing and parsing of the requests. The response layer (Response) is the interface framework layer used to build and send responses to the requester, and determine the format, content and status code of the response. The control layer (control) plays a role in coordination and scheduling. After receiving the request, it distributes the request to the corresponding service layer for specific processing according to the type of request and business logic. The service layer (service) is an interface framework layer that contains specific business logic and function implementation. It performs actual operations, such as data processing, calculation, interaction with the database, etc., to complete the tasks required by the request.
[0085] This layered design can make the code structure clearer.
[0086] In this embodiment, the generating device can input the source design document into a preset code production template, obtain multiple source codes, and fill the generated code into the corresponding position in the code template, and finally generate the interface framework code of the Request, Response, control, and service layers, thereby making the code structure clearer.
[0087] In another feasible implementation, the present embodiment may include the following steps after step S20: compressing the interface framework source code to obtain a compressed interface framework source code; storing the compressed interface framework source code in an interface project engineering, and generating a corresponding code guide directory, wherein the interface project engineering is a collection of various source design documents; accordingly, after step S40, it also includes: storing the updated interface document in the interface project engineering, and obtaining an updated code guide directory.
[0088] It should be noted that the interface project engineering is an overall project formed around a series of related work such as interface development, deployment, and maintenance, including documents, codes, versions and other data of different interfaces.
[0089] Interface project engineering may include the specification of each design interface, definition of interface functions and parameters, development of code to implement the interface, version and update of the interface, and deployment of the interface to a suitable operating environment for other systems or applications to call.
[0090] It should be noted that the code guidance directory is a directory system used to organize and guide the storage location of the interface framework source code in the interface project engineering.
[0091] The code guide directory can clearly identify the location and relationship of each part of the code, and can clearly present the hierarchical structure of the code, making it easy for developers to quickly find the location of specific functional modules or related code snippets. It helps to improve the readability and manageability of the code.
[0092] In this embodiment, after the user obtains the source design document according to the preset code production template, he can open the component work interface of the generating device, upload the design document, click the code generation button, wait for a moment, and the generated interface framework source code will be compressed and packaged, and the generated source code can be added to the corresponding directory of the project engineering. When reverse generating, open the component work interface, upload the source design document, select the code guide directory of the source code, click the document generation button, wait for a moment, the generating device can automatically generate the updated interface document, download the document, and add it to the interface project engineering. Therefore, the interface project engineering can facilitate developers to quickly find the location of specific functional modules or related code snippets. It helps to improve the readability and manageability of the code.
[0093] In another feasible implementation, step S40 of this embodiment may include the following steps: if the interface framework source code is updated, obtaining the corresponding interface name and interface path from the interface project engineering according to the code guidance directory; determining multiple interface unique identifiers corresponding to the updated interface framework source code according to the interface name and interface path; and reverse engineering the updated interface framework source code through the multiple interface unique identifiers and the source design document to obtain an updated interface document.
[0094] It should be noted that the interface name is a name used to identify a specific interface and is used for people to reference and identify the interface.
[0095] It should be noted that the interface path is the specific address or path information for accessing a specific interface, usually a string similar to a URL. Through the interface path, you can accurately navigate to the corresponding interface to perform corresponding operations or obtain related data.
[0096] It should be noted that the unique interface identifier is a specific mark or code used to clearly distinguish different interfaces, and to ensure that each interface has its own unique identity. Through this identifier, the specific interface can be accurately identified and operated to avoid confusion and errors.
[0097] In this embodiment, during reverse generation, the generating device can scan the code guide directory, obtain the corresponding interface name and interface path from the interface project, and uniquely identify the interface according to the interface name and interface path. And according to the interface unique identifier of the interface, go to the location of the matching design document in the preset interface design document template, reverse generate the updated interface framework source code, and obtain the updated interface document. Therefore, through the interface unique identifier, the interface document of a specific interface can be accurately identified and reverse updated to avoid confusion and errors.
[0098] In another feasible implementation, the present embodiment may include the following steps after step S40: comparing the multiple interface unique identifiers according to the source design document, and determining whether there is a new code interface based on the comparison result; if there is a new code interface, returning to execute the step of generating the source design document according to the preset interface design document template and the interface design data based on the new code interface, and obtaining a new source design document corresponding to the new code interface.
[0099] It should be noted that the code-added interface refers to a new interface added to the updated interface framework source code. If there is no matching interface when searching for the matching design document in the preset interface design document template, it means that the code-added interface is generated, and the design document of the new interface is generated according to the preset interface design document template.
[0100] In this implementation, if the developer creates a new access point or interaction path when using the interface, the code of other parts can interact with specific functions or data through this new interface. Therefore, for the new interface, the newly added source design document can be reversely generated again according to the preset interface design document template. In this way, the consistency between the interface design document and the source code is maintained.
[0101] Furthermore, the interface framework source code can be dynamically updated in real time, using automated build tools or scripts to update the document synchronously every time the code is deployed or the interface is changed. For example, a message queue or event-driven mechanism can be used to monitor interface change events and update the corresponding document content in a timely manner to ensure that the document system can obtain the latest interface information in real time.
[0102] Furthermore, for different versions of interface codes, version comparison and highlighting can be performed, and different versions of interfaces can be clearly identified in the document, for example, by version numbers. For each version of the interface, the changes are listed in detail, including new parameters, modified parameters, deleted parameters, etc. Use different colors or marks to highlight the differences between versions, such as highlighting new parts in green and modified parts in yellow. Provide a separate version difference comparison page or area to showcase the specific changes of each version. Use visual charts or tables to clearly present the difference details of different versions of interfaces. It is also convenient for users to quickly locate the interface information of a specific version and compare it with other versions through links or indexes.
[0103] The generating device of this embodiment can first extract the text of the interface design data to obtain the corresponding multiple function type data, such as input, output, interface name, request path, module name, permission control rule, interface function description, etc. Then, according to the mapping relationship of the preset interface design document template, fill it into the corresponding position in the preset interface design document template to generate the source design document. After the generation is successful, all files are packaged for users to download. It should be noted that the template can support dynamic modification to adapt to different scene requirements. In this way, the interface design can be completed only according to the preset interface design document template, which improves the design efficiency. Further, the generating device can input the source design document into the preset code production template, obtain a variety of source codes, and fill the generated code into the corresponding position in the code template, and finally generate the interface framework code of the Request, Response and control and service layers, so as to make the code structure clearer. Furthermore, if the developer creates a new access point or interaction path in the use of the interface, the code of other parts can interact with specific functions or data through this new interface. Therefore, for the new interface, the newly added source design document can be reversely generated according to the preset interface design document template again. Thereby maintaining the consistency of the interface design document and the source code.
[0104] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the interface document generation method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0105] This application also provides an interface document generation device, please refer to Figure 4 , Figure 4 This is a schematic diagram of the module structure of the interface document generation device according to an embodiment of the present application; the interface document generation device includes:
[0106] The document generation module 401 is used to receive the interface design data input by the user and generate a source design document according to a preset interface design document template and the interface design data;
[0107] A code generation module 402 is used to input the source design document into a preset code generation template to obtain an interface framework source code corresponding to the source design document;
[0108] The consistency check module 403 is used to detect whether the interface framework source code is updated when receiving the consistency check instruction;
[0109] The reverse generation module 404 is used to perform reverse generation based on the source design document and the updated interface framework source code to obtain an updated interface document if the interface framework source code is updated.
[0110] The interface document generation device provided by the present application adopts the interface document generation method in the above-mentioned embodiment, which can solve the technical problem that the current generation component is more suitable for the characteristic scenario and cannot maintain the consistency of the code and the document when the code is updated. Compared with the prior art, the beneficial effects of the interface document generation device provided by the present application are the same as the beneficial effects of the interface document generation method provided by the above-mentioned embodiment, and the other technical features in the interface document generation device are the same as the features disclosed in the above-mentioned embodiment method, which will not be repeated here.
[0111] The present application provides an interface document generation device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the interface document generation method in the above-mentioned embodiment one.
[0112] Reference below Figure 5 , Figure 5 The device structure diagram of the hardware operating environment involved in the interface document generation method in the embodiment of the present application shows a schematic diagram of the structure of the interface document generation device suitable for implementing the embodiment of the present application. The interface document generation device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The interface document generation device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0113] like Figure 5 As shown, the interface document generating device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the interface document generating device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the interface document generation device to communicate wirelessly or wired with other devices to exchange data. Although the interface document generation device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided alternatively.
[0114] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code 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 device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0115] The interface document generation device provided by the present application adopts the interface document generation method in the above embodiment, which can solve the technical problem that the current generation component is more suitable for the characteristic scenario and cannot maintain the consistency of the code and the document when the code is updated. Compared with the prior art, the beneficial effects of the interface document generation device provided by the present application are the same as the beneficial effects of the interface document generation method provided by the above embodiment, and the other technical features in the interface document generation device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0116] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0117] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0118] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the interface document generation method in the above-mentioned embodiment.
[0119] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, 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 or 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 this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0120] The above-mentioned computer-readable storage medium may be included in the interface document generating device; or it may exist independently without being assembled into the interface document generating device.
[0121] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the interface document generating device, the interface document generating device: receives the interface design data input by the user, and generates a source design document according to the preset interface design document template and the interface design data; inputs the source design document into the preset code production template to obtain the interface framework source code corresponding to the source design document; upon receiving the consistency check instruction, detects whether the interface framework source code is updated; if the interface framework source code is updated, reverse generates according to the source design document and the updated interface framework source code to obtain an updated interface document.
[0122] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0123] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the 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 square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square 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 square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart 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.
[0124] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0125] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned interface document generation method, and can solve the technical problem that the current generation components are more suitable for characteristic scenarios and cannot maintain the consistency of codes and documents when the codes are updated. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the interface document generation method provided by the above-mentioned embodiments, and will not be elaborated here.
[0126] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned interface document generation method when executed by a processor.
[0127] The computer program product provided by this application can solve the technical problem that the current generation components are more suitable for characteristic scenarios and cannot maintain the consistency of code and documents when the code is updated. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the interface document generation method provided by the above embodiment, which will not be repeated here.
[0128] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for generating an interface document, It is characterized in that The method includes: Receiving interface design data input by a user, and generating a source design document according to a preset interface design document template and the interface design data; Input the source design document into a preset code production template to obtain the interface framework source code corresponding to the source design document; Upon receiving a consistency check instruction, detecting whether the interface framework source code is updated; If the interface framework source code is updated, reverse generation is performed based on the source design document and the updated interface framework source code to obtain an updated interface document.
2. The method according to claim 1, It is characterized in that The step of receiving the interface design data input by the user and generating a source design document according to a preset interface design document template and the interface design data comprises: Receiving interface design data input by a user; Performing text extraction on the interface design data to obtain a plurality of function type data corresponding to the interface design data; According to the mapping relationship of the preset interface design document template, the multiple function type data are filled into the corresponding positions of the preset interface design document template to generate a source design document.
3. The method according to claim 1, It is characterized in that The step of inputting the source design document into a preset code production template to obtain the interface framework source code corresponding to the source design document includes: Inputting the source design document into a preset code production template to obtain multiple source codes; Determine a code framework corresponding to the source design document, wherein the code framework includes a request layer, a response layer, a control layer, and a service layer; The multiple source codes are filled into the request layer, the response layer, the control layer and the service layer accordingly, and an interface framework source code corresponding to the source design document is generated.
4. The method according to any one of claims 1 to 3, It is characterized in that After the step of inputting the source design document into a preset code production template to obtain the interface framework source code corresponding to the source design document, the method further includes: Compressing the interface framework source code to obtain compressed interface framework source code; Storing the compressed interface framework source code in an interface project engineering to generate a corresponding code guide directory, wherein the interface project engineering is a collection of various source design documents; Correspondingly, if the interface framework source code is updated, reverse generation is performed based on the source design document and the updated interface framework source code to obtain the updated interface document, and further includes: The updated interface document is stored in the interface project to obtain an updated code guide directory.
5. The method according to claim 4, It is characterized in that If the interface framework source code is updated, the step of reverse engineering the source design document and the updated interface framework source code to obtain an updated interface document comprises: If the interface framework source code is updated, the corresponding interface name and interface path are obtained from the interface project according to the code guide directory; Determine multiple interface unique identifiers corresponding to the updated interface framework source code according to the interface name and interface path; The updated interface framework source code is reverse-engineered using the multiple interface unique identifiers and the source design document to obtain an updated interface document.
6. The method according to claim 5, It is characterized in that After the step of reverse engineering the updated interface framework source code by using the multiple interface unique identifiers and the source design document to obtain the updated interface document, the method further includes: Compare the multiple interface unique identifiers according to the source design document, and determine whether there is a code-added interface according to the comparison result; If the code-added interface exists, then based on the code-added interface, the step of generating the source design document according to the preset interface design document template and the interface design data is returned to obtain the newly added source design document corresponding to the code-added interface.
7. An interface document generating device, It is characterized in that The device comprises: A document generation module, used to receive interface design data input by a user, and generate a source design document according to a preset interface design document template and the interface design data; A code generation module, used to input the source design document into a preset code production template to obtain an interface framework source code corresponding to the source design document; A consistency check module, used to detect whether the interface framework source code is updated when receiving a consistency check instruction; The reverse generation module is used to perform reverse generation based on the source design document and the updated interface framework source code to obtain an updated interface document if the interface framework source code is updated.
8. An interface document generating device, It is characterized in that The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the interface document generation method according to any one of claims 1 to 6.
9. A storage medium, It is characterized in that The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the interface document generation method according to any one of claims 1 to 6 are implemented.
10. A computer program product, It is characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the interface document generation method according to any one of claims 1 to 6 are implemented.
