CN-121979567-A - Target interface document generation method and device
Abstract
The embodiment of the disclosure provides a method and equipment for generating a target interface document, and relates to the technical field of application programming interfaces. The method comprises the steps of obtaining a natural language requirement document, inputting the natural language requirement document into a first document generation model, outputting an initial interface document, obtaining a target code file generated based on the initial interface document, inputting the target code file into a second document generation model, and generating the target interface document. By adopting the technical scheme, the interface document is automatically generated by using the document generation model, so that the efficiency can be improved.
Inventors
- Yu Pingchun
Assignees
- 浙江吉利控股集团有限公司
- 吉利汽车研究院(宁波)有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260112
Claims (10)
- 1. A method for generating a target interface document, the method comprising: The method comprises the steps of obtaining a natural language requirement document, inputting the natural language requirement document into a first document generation model, and outputting an initial interface document, wherein the natural language requirement document comprises a text describing requirements of a user, and the requirements of the user are used for indicating to generate the interface document; And acquiring an object code file generated based on the initial interface document, inputting the object code file into a second document generation model, and generating a target interface document, wherein the target interface document is a real interface document matched with the requirement of the user.
- 2. The method of claim 1, wherein inputting the natural language requirements document into a first document generation model, outputting an initial interface document, comprises: inputting the natural language requirement document into a first document generation model, and processing the natural language requirement document to obtain interface description information, interface parameter information and error code information; And generating the initial interface document according to the interface description information, the interface parameter information and the error code information.
- 3. The method of claim 2, wherein the interface description information is at least one of interface function description information, interface request mode, interface initial request path information, authentication mode, and interface content type.
- 4. The method of claim 1, wherein the obtaining an object code file generated based on the initial interface document, inputting the object code file into a second document generation model, comprises: In response to a triggering operation for a document development interface, acquiring the target code file generated based on the initial interface document from the document development interface; the object code file is input to the second document generation model.
- 5. The method of claim 1, wherein said inputting the object code file into the second document generation model comprises: And storing the target code file into a code database, reading the target code file from the code database, and inputting the target code file into the second document generation model, wherein the code database is used for inquiring the target code file.
- 6. The method of any of claims 1-4, further comprising, after the obtaining the object code file generated based on the initial interface document, inputting the object code file to a second document generation model, generating an object interface document: executing by the second document generation model: Comparing the consistency of the target interface document and the initial interface document, and And in response to the comparison result indicates that the consistency requirement is not met, updating the target code file to obtain an updated code file, and generating a new target interface document according to the updated code file through the second document generation model.
- 7. The method of claim 6, wherein updating the object code file to obtain an updated code file comprises: Determining at least one target interface element corresponding to the interface specification difference value and the difference type of the target interface element based on the comparison result, wherein the target interface element comprises at least one of target interface description information, target interface parameter information or target error code information; and updating codes corresponding to the target interface elements in the target code file according to the difference types of the target interface elements.
- 8. The method of claim 7, wherein the code update comprises at least one of adding code, deleting code, modifying code, altering code structure.
- 9. The method of claim 1, wherein the first document generation model is trained based on a training dataset comprising historical natural language requirements documents, historical initial interface documents corresponding to the historical natural language requirements documents, historical target code files, and historical target interface documents corresponding to the historical target code files, and/or The second document generation model is obtained after training based on a training data set, wherein the training data set comprises a historical natural language requirement document, a historical initial interface document corresponding to the historical natural language requirement document, a historical target code file and a historical target interface document corresponding to the historical target code file.
- 10. An electronic device, comprising: a processor and a memory, wherein the memory has stored therein a computer program which, when executed by the processor, performs the method of any of claims 1-9.
Description
Target interface document generation method and device Technical Field The embodiment of the disclosure relates to the technical field of application programming interfaces, in particular to a method and equipment for generating a target interface document. Background With the popularity of microservice architecture, application programming interfaces have become the core tie of interactions between modern software systems. Furthermore, the interface document of the application programming interface is particularly important to the developers of the parties. However, the interface documents of current application programming interfaces are written manually or are generated semi-automatically. Instead of the differences between the natural language requirement descriptions written by technicians, such as product managers or business analysts, and the exact interface documents that the developer needs to implement, the manual conversion is inefficient. Therefore, a method for generating a target interface document is needed to automatically generate an accurate interface document, thereby improving efficiency. Disclosure of Invention In order to solve the above technical problems or at least partially solve the above technical problems, an embodiment of the present disclosure provides a method and apparatus for generating a target interface document. A first aspect of an embodiment of the present disclosure provides a target interface document generation method, including: The method comprises the steps of obtaining a natural language requirement document, inputting the natural language requirement document into a first document generation model, and outputting an initial interface document, wherein the natural language requirement document comprises a text describing requirements of a user, and the requirements of the user are used for indicating to generate the interface document; And acquiring an object code file generated based on the initial interface document, inputting the object code file into a second document generation model, and generating a target interface document, wherein the target interface document is a real interface document matched with the requirement of the user. A second aspect of an embodiment of the present disclosure provides a target interface document generation apparatus, the apparatus comprising: The system comprises a first acquisition module, a first generation module and a second generation module, wherein the first acquisition module is used for acquiring a natural language requirement document, inputting the natural language requirement document into a first document generation model and outputting an initial interface document, the natural language requirement document comprises a text describing requirements of a user, and the requirements of the user are used for indicating to generate the interface document; and the second acquisition module is used for acquiring an object code file generated based on the initial interface document, inputting the object code file into a second document generation model and generating an object interface document, wherein the object interface document is a real interface document matched with the requirement of the user. A third aspect of the disclosed embodiments provides an electronic device comprising a processor and a memory, wherein the memory has stored therein a computer program which, when executed by the processor, performs the method of the first aspect described above. A fourth aspect of the disclosed embodiments provides a computer readable storage medium having stored therein a computer program which, when executed by a processor, can implement the method of the first aspect described above. A fifth aspect of the disclosed embodiments provides a computer program product comprising a computer program which, when executed by a processor, implements the method as described in the first aspect. The embodiment of the disclosure provides a target interface document generation method and device, wherein the method comprises the following steps: the method comprises the steps of obtaining a natural language requirement document, inputting the natural language requirement document into a first document generation model, outputting an initial interface document, obtaining a target code file generated based on the initial interface document, inputting the target code file into a second document generation model, and generating a target interface document. By adopting the technical scheme, the interface document is automatically generated by using the document generation model, so that the efficiency can be improved. Drawings The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure. In order to more clearly illustrate the embodiments of the present disclosure