Back-end interface document generation method and device, electronic equipment and storage medium

By separating the API interface definition project from the target backend project, and using the interface to convert the core device to analyze and format the interface information to automatically generate the backend interface document, the problem of inefficient front-end interface information docking in the existing technology is solved, and efficient interface information docking and document generation is achieved.

CN119829123APending Publication Date: 2025-04-15CHINA MOBILE GROUP DESIGN INST +1

Patent Information

Application Number
CN202411309582.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

In the prior art, front-end and back-end interface information docking efficiency is low, and developers need to manually enter interface information and write documents, resulting in inefficient efficiency.

Method used

By separating the API interface definition project from the target backend project, using the target interface conversion class in the core device to parse the interface information, converting its format and synchronizing it to the target interface management platform, and automatically generate backend interface documents.

Benefits of technology

This greatly reduces the workload of manual writing and document generation of interface information, and improves the efficiency of front-end and back-end interface information docking.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829123A_ABST
    Figure CN119829123A_ABST
Patent Text Reader

Abstract

The invention relates to the field of computers, and provides a back-end interface document generation method and device, electronic equipment and a storage medium. The method comprises the following steps: separating an API interface definition item from an obtained target back-end item; analyzing the target interface item based on a target interface conversion class in the interface conversion core device to obtain target interface information corresponding to the target interface item; the target interface item is determined from the API interface definition item based on the target interface conversion class; the target interface information is subjected to format conversion, the target interface information subjected to format conversion is synchronized to a target interface management platform, and the target interface management platform is used for generating a rear-end interface document corresponding to the target interface information. According to the embodiment of the invention, the workload of manual compiling of the interface information and generation of the back-end interface document can be greatly reduced, so that the docking efficiency in the whole docking process of the front-end interface information and the back-end interface information is greatly 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 technology, and in particular to a back-end interface document generation method, device, electronic device and storage medium. Background Art

[0002] With the prevalence of microservices in Web (World Wide Web) development, front-end and back-end separation has become the basic model for medium and large Web projects. How to properly handle the relationship between front-end calls and back-end interfaces, or between service callers and API (Application Programming Interface) providers, has become a problem that must be solved before developing each Web project.

[0003] In the prior art, the problem of front-end and back-end interface information docking can be solved by selecting an API management tool, such as Springboot Swagger and RAP (Rapid Application Prototyping). However, Springboot Swagger requires developers to manually enter interface information, and RAP requires developers to write interface documents and manually enter interfaces, resulting in low efficiency in front-end and back-end interface information docking. Summary of the invention

[0004] The embodiments of the present application provide a back-end interface document generation method, device, electronic device and storage medium to solve the technical problem of low efficiency of front-end and back-end interface information docking in the prior art.

[0005] In a first aspect, an embodiment of the present application provides a method for generating a backend interface document, comprising: Separate the API interface definition project from the acquired target backend project; Parsing the target interface project based on the target interface conversion class in the interface conversion core device to obtain the target interface information corresponding to the target interface project; the target interface project is determined from the API interface definition project based on the target interface conversion class; The target interface information is format-converted, and the target interface information after format conversion is synchronized to a target interface management platform, and the target interface management platform is used to generate a back-end interface document corresponding to the target interface information.

[0006] In one embodiment, the target interface conversion class in the interface conversion core device is used to parse the target interface item to obtain the target interface information corresponding to the target interface item, including: Based on the metadata location information in the target interface conversion class, a target interface project is determined from the API interface definition project; there is an association relationship between the metadata location information and the target interface project; Extracting parameter elements from the target interface item; Based on the interface parsing model in the interface conversion core device, the parameter elements are encapsulated to obtain the target interface information corresponding to the target interface item; the interface parsing model is a preset element encapsulation structure.

[0007] In one embodiment, the method further comprises: In the case where there is a missing element with missing annotation information in the target interface information, determining an input parameter corresponding to the missing element; the input parameter includes a parameter element corresponding to the missing element, or the parameter element and a method element; Sending the input parameter to a large language model to obtain an annotation text corresponding to the missing element output by the large language model; The annotation text is marked, and the target interface information is updated based on the marked annotation text.

[0008] In one embodiment, converting the target interface information into a format includes: In response to user-related operations, determine the target format supported by the target interface management platform; The target interface information is format converted based on the target format.

[0009] In one embodiment, synchronizing the target interface information after format conversion to a target interface management platform includes: Obtaining the project identifier corresponding to the target interface conversion class; Determining interface synchronization information based on the project identifier and the target interface information; The interface synchronization information is manually or automatically synchronized to the target interface management platform.

[0010] In one embodiment, determining the interface synchronization information based on the project identifier and the target interface information includes: In a case where the item identifier is a null value, determining the target interface information after format conversion as the interface synchronization information; When the project identifier is a non-null value, the historical interface information sent by the target interface management platform is compared with the target interface information to determine the interface synchronization information.

[0011] In a second aspect, an embodiment of the present application provides a backend interface document generation device, including: A separation module is used to separate the API interface definition project from the acquired target backend project; A parsing module, used for parsing a target interface project based on a target interface conversion class in an interface conversion core device to obtain target interface information corresponding to the target interface project; the target interface project is determined from the API interface definition project based on the target interface conversion class; The synchronization module is used to convert the format of the target interface information and synchronize the target interface information after the format conversion to a target interface management platform, and the target interface management platform is used to generate a backend interface document corresponding to the target interface information.

[0012] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory storing a computer program, wherein when the processor executes the program, the steps of the back-end interface document generation method described in the first aspect are implemented.

[0013] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described back-end interface document generation methods.

[0014] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the back-end interface document generation method described in the first aspect.

[0015] The back-end interface document generation method, device, electronic device and storage medium provided in the embodiment of the present application separate the API interface definition project from the target back-end project, determine the target interface project of the specified namespace from the API interface definition project through the target interface conversion class in the interface conversion core device, parse the target interface project, obtain the target interface information corresponding to the target interface project, and after format conversion of the target interface information, synchronize the format-converted target interface information to the target interface management platform, and automatically generate the back-end interface document corresponding to the target interface information through the target interface management platform. In the embodiment of the present application, only the separated API interface definition project is parsed, which reduces the amount of parsed code and improves the parsing efficiency. Through the automatic generation of the target interface information, the workload of manual writing of the interface information and generation of the back-end interface document is greatly reduced, thereby greatly improving the docking efficiency in the entire front-end and back-end interface information docking process. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0017] Figure 1 It is a flow chart of the front-end and back-end interface information connection provided by the prior art.

[0018] Figure 2 This is one of the flow charts of the back-end interface document generation method provided in the embodiment of the present application.

[0019] Figure 3 It is a schematic diagram of the element encapsulation structure of the interface parsing model provided in an embodiment of the present application.

[0020] Figure 4 This is the second flow chart of the back-end interface document generation method provided in the embodiment of the present application.

[0021] Figure 5 It is a structural diagram of the back-end interface document generation device provided in an embodiment of the present application.

[0022] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0024] In the existing technology, API (Application Programming Interface) management tools such as Springboot Swagger and RAP (Rapid Application Prototyping) are generally used to divide the front-end and back-end tasks. Among them: (1) Springboot Swagger is a representation method based on the REST API (Representational State Transfer Application Programming Interface) architecture. This representation method is both machine-readable and user-readable. It can be used as an interactive document of the REST API architecture or as a formalized interface description of the REST API architecture, thereby generating corresponding codes for the client and server. Springboot Swagger includes three parts: Swagger API Spec, Swagger UI, and Swagger Editor. Among them, Swagger API Spec is a language for describing the REST API architecture, Swagger UI is a module for displaying Swagger API Spec through HTML pages, and Swagger Editor is an editor for Swagger API Spec. Springboot Swagger can use annotations to add document descriptions, and interfaces can be written during the development process. The display interface of Springboot Swagger is inherited from the dependency package. After starting the project, you can access the specified URL (Uniform Resource Locator) to obtain the interface list. After that, you can call the interface in the interface list interface and view detailed request and response information.

[0025] (2) RAP is a Web interface management tool based on GUI (Graphical User Interface) tools. In RAP, you can define the URL of the interface, the format of request and response details, etc., and use GUI tools to achieve visualization and editable functions. At the same time, RAP also provides automation tools such as Mock services and testing services to help development teams develop efficiently.

[0026] However, Springboot Swagger does not support Mock (Mocking) interface calls, and other tools are needed to implement interface mocks. Secondly, developers are required to manually enter access information in the code writing project. RAP requires developers to manually write interface documents, and interface information can be entered manually or in batches, and cannot be automatically generated. In the prior art, the docking method of front-end and back-end interface information is as follows Figure 1As shown in the figure. Due to the large number of businesses and interfaces during the development process, it takes a long time to manually connect the front-end and back-end interface information during the front-end and back-end joint debugging process, resulting in low efficiency in front-end and back-end interface information connection. In addition, the interface parameters may change during the joint debugging process, and each change requires the developer to re-enter the interface information, further reducing the efficiency of the front-end and back-end interface information connection.

[0027] In view of the above problems in the prior art, the present invention provides a method for generating a backend interface document. Figure 2 This is one of the flow charts of the back-end interface document generation method provided in the embodiment of the present application, such as Figure 2 As shown, the backend interface document generation method includes the following steps 210 to 230.

[0028] Step 210: Separate the API interface definition project from the acquired target backend project.

[0029] Specifically, after obtaining the target backend project, the application in the target backend project can be separated from the interface. The application refers to the entire backend service, which is used to process business needs, execute business rules, interact with the database and process data, etc. The backend service may include components such as business logic, data access, service layer and data model. The interface refers to the API interface, which is used to provide a function that enables a client (such as a front-end application or a mobile application, etc.) to access and use the backend service. When separating the application from the interface in the target backend project, the API interface can be identified from the target backend project, and then the API interface is defined using the OpenAPI specification or other API description language, a blank API interface definition project is created, and a data model class is created for the API request and response in the blank API interface definition project, and annotations or configuration files are used in the API interface definition project to describe the path, supported operations and parameters of the API interface, etc. After that, a controller interface or abstract class is written to declare the API interface and the corresponding method signature. Based on this, the API interface definition project corresponding to the interface and the backend implementation project corresponding to the application can be separated from the target backend project, and the backend implementation project depends on the API interface definition project. The API interface definition project does not contain a specific business logic implementation, but only an interface definition. For example, the target backend project of the scheduling center is split to obtain the backend implementation project and API interface definition project corresponding to the scheduling center. The backend implementation project corresponding to the scheduling center can be named java-szsz-ddzx-dubbo, and the API interface definition project corresponding to the scheduling center can be named java-szsz-ddzx-api.

[0030] In the embodiment of the present application, by separating the API interface definition project from the target backend project, only the code corresponding to the API interface definition project is parsed later, reducing the amount of code to be parsed later and improving the parsing efficiency. At the same time, the separation of the API interface definition project can ensure the independence and clarity of the target interface information determined later.

[0031] Step 220: parse the target interface project based on the target interface conversion class in the interface conversion core device to obtain the target interface information corresponding to the target interface project; the target interface project is determined from the API interface definition project based on the target interface conversion class.

[0032] Specifically, after the API interface definition project is separated, the API interface definition project can be input into the interface conversion core device, and the target interface project can be parsed through the target interface conversion class predefined in the interface conversion core device to obtain the target interface information with structural specifications. Through the interface conversion core device, manual intervention in the target interface information parsing process can be reduced, the parsing efficiency can be improved, and then the docking efficiency in the entire front-end and back-end docking process can be improved.

[0033] It should be noted that an interface conversion class is predefined in the interface conversion core device, and the interface conversion class can be named APIParser, and multiple member variables are declared in the interface conversion class, each of which can include the interface project name, interface project version number, interface project introduction, project identification or scan path, etc. The assignment of each member variable can be determined by responding to the user's input operation. After determining the assignment of each member variable based on the user's input operation, the updated target interface conversion class can be obtained. In addition, the init() method can also be used in the interface conversion class to initialize the class loader and search for class files. When initializing the interface conversion class, first obtain the class loader and class list, then search for class files according to the scan path, and set the source code path.

[0034] It should be noted that after the user sets the scan path to be scanned in the interface conversion class, he can specify the namespace corresponding to the interface to be scanned in the API interface definition project, thereby locating the target interface project in the API interface definition project. The target interface project is part of the interface project or all of the interface projects in the API interface definition project.

[0035] Before executing step 220, the interface conversion core device can be introduced into the API interface definition project through Maven, and in response to the input operation of the developer, metadata location information is input in the interface conversion class to obtain the target interface conversion class, and the metadata location information is the assignment of each member variable in the interface conversion class. For example, the program code corresponding to the target interface conversion class is as follows: "SystemElement element = new SystemElement(); element.setName("java-szsj-ddzx-api"); element.setInterfaceManageName("RAP"); element.setIntroduction("Scheduling Center Project Backend Interface API"); element.setVersion("1.0.0.0"); APIParser parser = new APIParser(element); parser.setProjectId(90); parser.setScanPath("com.szsj.ddzx"); parser.init(); parser.parse(); parser.printInputStr();".

[0036] From the above, we can see that in response to the developer's input operation, the interface project name Name is named "java-szsj-ddzx-api"; the target interface management platform InterfaceManageName is specified as "RAP"; the interface project introduction Introduction is set to "Dispatching Center Project Backend Interface API", and the interface project version number Version is specified as "1.0.0.0"; the project identifier ProjectId is set to "90", and the scan path ScanPath is specified as "com.szsj.ddzx".

[0037] In addition, an interface parsing model is predefined in the interface conversion core device, and the interface parsing model can be a preset element encapsulation structure. Figure 3 is a schematic diagram of the element encapsulation structure of the interface parsing model provided in the embodiment of the present application, such as Figure 3As shown, the model elements involved in the interface parsing model may include: system elements, module elements, page elements, method elements and parameter elements, and the parameter elements include input parameters and output parameters. Among them: the element level of each model element decreases in the order of system elements, module elements, page elements, method elements and parameter elements, that is, the element level of parameter elements is the lowest, and the element level of system elements is the highest. Each model element is encapsulated in sequence in the order of increasing element level, that is, the method element includes corresponding input parameters and output parameters, the page element includes at least one corresponding method element, the module element includes page elements, and the system element includes at least one module element. The preset encapsulation structure is used in the entire interface parsing model for unified encapsulation, so that the structure of the target interface information parsed from different target interface projects is unified.

[0038] Further, the target interface project is parsed based on the target interface conversion class in the interface conversion core device to obtain the target interface information corresponding to the target interface project, including: Based on the metadata location information in the target interface conversion class, the target interface project is determined from the API interface definition project; there is an association relationship between the metadata location information and the target interface project; Extract parameter elements in the target interface project; Based on the interface parsing model in the interface conversion core device, the parameter elements are encapsulated to obtain the target interface information corresponding to the target interface item; the interface parsing model is a preset element encapsulation structure.

[0039] Specifically, after the target interface project is separated, the target interface conversion class can be executed. First, the metadata location information entered by the developer is identified, for example, the scan path and interface project name entered by the developer are identified, and the target interface project of the specific namespace to be scanned is located from the API interface definition project. After that, the target interface project is parameter parsed to obtain all parameter elements in the target interface project, for example, the parameter list in each method signature in the target interface project is identified, and then the parameter element is extracted from the parameter list, which may include information such as name, type, comment, whether it is required and description. In addition, in the parameter element, the input parameter inherits BaseRequest and the output parameter inherits BaseResult. After the parameter element is extracted, the interface method corresponding to the parameter element can be extracted, and a method element is created according to the interface method, and the parameter element with the same interface method is encapsulated into the method element. The method element includes the request connection, request parameter list and response parameter list of the interface method. After the method element is encapsulated, the corresponding method element can be encapsulated into the page element, and the basic information such as the page element name and introduction corresponding to the page element is set. After that, the corresponding page element can be encapsulated into the module element, and then the corresponding module element can be encapsulated into the system element. In this way, the parameter elements can be encapsulated in the order from low to high element levels, and then the target interface information that conforms to the preset element encapsulation structure can be obtained.

[0040] Further, Figure 4 This is the second flow chart of the back-end interface document generation method provided in the embodiment of the present application, such as Figure 4 As shown, the method also includes: In the case where there is a missing element with missing annotation information in the target interface information, determining the input parameter corresponding to the missing element; the input parameter includes a parameter element corresponding to the missing element, or a parameter element and a method element; Send the input parameters to the large language model and obtain the annotation text corresponding to the missing elements output by the large language model; The comment text is marked, and the target interface information is updated based on the marked comment text.

[0041] Specifically, when parsing parameter elements, method elements, and page elements, annotation information can be obtained. If the annotation information is missing, the missing element that is missing the annotation information can be further determined. If the missing element is a parameter element, the parameter element is used as an input parameter. If the missing element is a method element, the parameter element and other method information corresponding to the method element are used as input parameters, and the input parameters are sent to the Large Language Model (LLM). The large language model automatically generates annotation text corresponding to the input parameters based on the input parameters to make up for the lack of annotation information. In order to facilitate subsequent developers to clarify the source of the annotation text, that is, to determine which annotation texts are automatically generated by the large language model and which are parsed from the target interface project, after the large language model generates the annotation text, special tags can be added to the annotation text to facilitate subsequent developers to make adjustments on this basis.

[0042] Furthermore, the process of determining the annotation text may include: obtaining the key corresponding to the large language model to select the final large language model. Then, use the Java HTTP (Hypertext Transfer Protocol) client to create an HTTP request, in which the request header is set by the API key and the target URL is set. Then, use the Java HTTP client to build an HTTP POST request, and use the input parameter as the request body to update the HTTP POST request. Send the HTTP POST request to the Open API. After the large language model generates the annotation text, a response message can be returned. By parsing the response body in the response message, the annotation text generated by the large language model can be obtained.

[0043] Step 230: convert the target interface information into a format, and synchronize the converted target interface information to a target interface management platform, where the target interface management platform is used to generate a backend interface document corresponding to the target interface information.

[0044] Specifically, after parsing and encapsulating the target interface information with a unified structure, the target interface information can be formatted and then synchronized to the target interface management platform to avoid manual input of interface information. The back-end interface document is then automatically generated through the target interface management platform, reducing manual participation and improving the efficiency of front-end and back-end interface docking.

[0045] Furthermore, the target interface information is formatted, including: Respond to user-related operations and determine the target format supported by the target interface management platform; The target interface information is formatted based on the target format.

[0046] Specifically, the target interface management platform specified by the user can be extracted from the target interface conversion class, and then the access link and account of the target interface management platform, as well as the target format supported by the target interface management platform, can be obtained. The target interface management platform may include RAP or a self-developed front-end development tool. If the target interface management platform is RAP, the target format supported by RAP may be Json format. If the target interface management platform is a self-developed front-end development tool, the target format may be Json format or XML format. After determining the target format, the target interface information may be formatted according to the target format. For example, taking the target format as Json format, the input parameters of the Map type in the target interface information may be converted to string type, and the input parameters of the List type or Set type may be converted to array<> type.

[0047] Furthermore, synchronizing the target interface information after format conversion to the target interface management platform includes: Get the project ID corresponding to the target interface conversion class; Determine interface synchronization information based on the project identifier and the target interface information; Manually or automatically synchronize the interface synchronization information to the target interface management platform.

[0048] Specifically, after the target interface information is formatted, the project identifier ProjectId can be extracted from the target interface conversion class. The project identifier is used as the unique identifier of the target backend project, and then the target generation method of the backend interface document corresponding to the target interface information is determined according to the project identifier. The target generation method can be a full generation method or an incremental generation method. After determining the target generation method, the interface synchronization information can be determined according to the target generation method and the target interface information. The interface synchronization information is the interface information to be synchronously sent to the target interface management platform. Afterwards, a connection is established with the target interface management platform through the access link and account of the target interface management platform. Afterwards, the interface synchronization information can be synchronized to the target interface management platform in response to the user's sending operation. The synchronization method can be determined by the user, and the synchronization method can be an automatic synchronization method or a manual synchronization method.

[0049] Further, based on the project identifier and the target interface information, the interface synchronization information is determined, including: When the item identifier is a null value, the target interface information after format conversion is determined as the interface synchronization information; When the project identifier is a non-null value, the historical interface information sent by the target interface management platform is compared with the target interface information to determine the interface synchronization information.

[0050] Specifically, after extracting the project identifier ProjectId from the target interface conversion class, if the project identifier is a null value, it indicates that the target backend project corresponding to the project identifier is a new project. Prior to this, the front-end and back-end interfaces of the target backend project have not been connected, that is, the backend interface document of the target backend project has not been generated. At this time, it can be determined that the target generation method of the backend interface document is a full generation method, that is, the target interface information after format conversion is determined as the interface synchronization information, and the backend interface document is generated according to all the information in the target interface information. If the project identifier is a non-null value, it indicates that the target backend project corresponding to the project identifier is a historical project. Prior to this, the front-end and back-end interfaces of the target backend project have been connected, that is, the historical backend interface document corresponding to the target backend project has been generated. At this time, it can be determined that the target generation method of the backend interface document is an incremental generation method, that is, the historical backend interface document can be obtained from the target interface management platform through an HTTP request, and the historical interface information can be parsed from the historical backend interface document. Afterwards, the historical interface information is compared with the target interface information after format conversion. For example, the system elements, module elements, page elements, method elements and parameter elements are compared one by one in order of element level from high to low, and the interface synchronization information after local information changes is gradually generated, and the back-end interface document is generated based on the interface synchronization information after local information changes.

[0051] The back-end interface document generation method provided in the embodiment of the present application separates the API interface definition project from the target back-end project, determines the target interface project of the specified namespace from the API interface definition project through the target interface conversion class in the interface conversion core device, and parses the target interface project to obtain the target interface information corresponding to the target interface project. After formatting the target interface information, the format-converted target interface information is synchronized to the target interface management platform, and the back-end interface document corresponding to the target interface information is automatically generated through the target interface management platform. In the embodiment of the present application, only the separated API interface definition project is parsed, which reduces the amount of parsed code and improves the parsing efficiency. Through the automatic generation of the target interface information, the workload of manual writing of the interface information and generation of the back-end interface document is greatly reduced, thereby greatly improving the docking efficiency in the entire front-end and back-end interface information docking process.

[0052] The back-end interface document generation device provided in the present application is described below. The back-end interface document generation device described below and the back-end interface document generation method described above can be referenced to each other.

[0053] The present application also provides a back-end interface document generation device. Figure 5 is a schematic diagram of the structure of the back-end interface document generation device provided in an embodiment of the present application, such as Figure 5As shown, the backend interface document generating device 500 includes: a separation module 510, a parsing module 520 and a synchronization module 530.

[0054] A separation module 510 is used to separate the API interface definition project from the acquired target backend project; The parsing module 520 is used to parse the target interface project based on the target interface conversion class in the interface conversion core device to obtain the target interface information corresponding to the target interface project; the target interface project is determined from the API interface definition project based on the target interface conversion class; The synchronization module 530 is used to convert the target interface information into a format, and synchronize the converted target interface information to a target interface management platform, and the target interface management platform is used to generate a backend interface document corresponding to the target interface information.

[0055] The back-end interface document generation device provided in the embodiment of the present application separates the API interface definition project from the target back-end project, determines the target interface project of the specified namespace from the API interface definition project through the target interface conversion class in the interface conversion core device, and parses the target interface project to obtain the target interface information corresponding to the target interface project. After formatting the target interface information, the format-converted target interface information is synchronized to the target interface management platform, and the back-end interface document corresponding to the target interface information is automatically generated through the target interface management platform. In the embodiment of the present application, only the separated API interface definition project is parsed, which reduces the amount of parsed code and improves the parsing efficiency. Through the automatic generation of the target interface information, the workload of manual writing of the interface information and generation of the back-end interface document is greatly reduced, thereby greatly improving the docking efficiency in the entire front-end and back-end interface information docking process.

[0056] Optionally, the parsing module 520 is specifically configured to: Based on the metadata location information in the target interface conversion class, a target interface project is determined from the API interface definition project; there is an association relationship between the metadata location information and the target interface project; Extracting parameter elements from the target interface item; Based on the interface parsing model in the interface conversion core device, the parameter elements are encapsulated to obtain the target interface information corresponding to the target interface item; the interface parsing model is a preset element encapsulation structure.

[0057] Optionally, the backend interface document generating device 500 further includes: a comment updating module, which is specifically used to: In the case where there is a missing element with missing annotation information in the target interface information, determining an input parameter corresponding to the missing element; the input parameter includes a parameter element corresponding to the missing element, or the parameter element and a method element; Sending the input parameter to a large language model to obtain an annotation text corresponding to the missing element output by the large language model; The annotation text is marked, and the target interface information is updated based on the marked annotation text.

[0058] Optionally, the synchronization module 530 is specifically configured to: In response to user-related operations, determine the target format supported by the target interface management platform; The target interface information is format converted based on the target format.

[0059] Optionally, the synchronization module 530 is specifically configured to: Obtaining the project identifier corresponding to the target interface conversion class; Determining interface synchronization information based on the project identifier and the target interface information; The interface synchronization information is manually or automatically synchronized to the target interface management platform.

[0060] Optionally, the synchronization module 530 is specifically configured to: In a case where the item identifier is a null value, determining the target interface information after format conversion as the interface synchronization information; When the project identifier is a non-null value, the historical interface information sent by the target interface management platform is compared with the target interface information to determine the interface synchronization information.

[0061] Figure 6 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 6 As shown, the electronic device may include: a processor 610, a communications interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communications interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the back-end interface document generation method, which includes: Separate the API interface definition project from the acquired target backend project; Parsing the target interface project based on the target interface conversion class in the interface conversion core device to obtain the target interface information corresponding to the target interface project; the target interface project is determined from the API interface definition project based on the target interface conversion class; The target interface information is format-converted, and the target interface information after format conversion is synchronized to a target interface management platform, and the target interface management platform is used to generate a back-end interface document corresponding to the target interface information.

[0062] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0063] On the other hand, the present application also provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the back-end interface document generation method provided by the above methods, the method includes: Separate the API interface definition project from the acquired target backend project; Parsing the target interface project based on the target interface conversion class in the interface conversion core device to obtain the target interface information corresponding to the target interface project; the target interface project is determined from the API interface definition project based on the target interface conversion class; The target interface information is format-converted, and the target interface information after format conversion is synchronized to a target interface management platform, and the target interface management platform is used to generate a back-end interface document corresponding to the target interface information.

[0064] In another aspect, the present application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the back-end interface document generation method provided by the above methods, the method comprising: Separate the API interface definition project from the acquired target backend project; Parsing the target interface project based on the target interface conversion class in the interface conversion core device to obtain the target interface information corresponding to the target interface project; the target interface project is determined from the API interface definition project based on the target interface conversion class; The target interface information is format-converted, and the target interface information after format conversion is synchronized to a target interface management platform, and the target interface management platform is used to generate a back-end interface document corresponding to the target interface information.

[0065] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.

[0066] Through the description of the above implementation modes, those skilled in the art can clearly understand that each implementation mode can be implemented by means of software plus a necessary general hardware platform, or of course by hardware. Based on such an understanding, the above technical solution can essentially or in other words be embodied in the form of a software product that contributes to the prior art. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.

[0067] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for generating a back-end interface document, characterized in that: include: Separate the API interface definition project from the acquired target backend project; Parsing the target interface item based on the target interface conversion class in the interface conversion core device to obtain the target interface information corresponding to the target interface item; The target interface project is determined from the API interface definition project based on the target interface conversion class; The target interface information is format-converted, and the target interface information after format conversion is synchronized to a target interface management platform, and the target interface management platform is used to generate a back-end interface document corresponding to the target interface information.

2. The method for generating a backend interface document according to claim 1, characterized in that: The target interface conversion class in the interface conversion core device is used to parse the target interface item to obtain the target interface information corresponding to the target interface item, including: Based on the metadata location information in the target interface conversion class, a target interface project is determined from the API interface definition project; there is an association relationship between the metadata location information and the target interface project; Extracting parameter elements from the target interface item; Based on the interface parsing model in the interface conversion core device, the parameter elements are encapsulated to obtain the target interface information corresponding to the target interface item; the interface parsing model is a preset element encapsulation structure.

3. The method for generating a backend interface document according to claim 2, characterized in that: The method further comprises: In the case where there is a missing element with missing annotation information in the target interface information, determining an input parameter corresponding to the missing element; the input parameter includes a parameter element corresponding to the missing element, or the parameter element and a method element; Sending the input parameter to a large language model to obtain an annotation text corresponding to the missing element output by the large language model; The annotation text is marked, and the target interface information is updated based on the marked annotation text.

4. The method for generating a backend interface document according to any one of claims 1 to 3, characterized in that: The format conversion of the target interface information includes: In response to user-related operations, determine the target format supported by the target interface management platform; The target interface information is format converted based on the target format.

5. The method for generating a backend interface document according to any one of claims 1 to 3, characterized in that: The step of synchronizing the target interface information after format conversion to the target interface management platform includes: Obtaining the project identifier corresponding to the target interface conversion class; Determining interface synchronization information based on the project identifier and the target interface information; The interface synchronization information is manually or automatically synchronized to the target interface management platform.

6. The method for generating a backend interface document according to claim 5, characterized in that: The determining the interface synchronization information based on the project identifier and the target interface information includes: In a case where the item identifier is a null value, determining the target interface information after format conversion as the interface synchronization information; When the project identifier is a non-null value, the historical interface information sent by the target interface management platform is compared with the target interface information to determine the interface synchronization information.

7. A back-end interface document generation device, characterized in that: include: A separation module is used to separate the API interface definition project from the acquired target backend project; A parsing module, used for parsing the target interface item based on the target interface conversion class in the interface conversion core device, and obtaining the target interface information corresponding to the target interface item; The target interface project is determined from the API interface definition project based on the target interface conversion class; The synchronization module is used to convert the format of the target interface information and synchronize the target interface information after the format conversion to a target interface management platform, and the target interface management platform is used to generate a backend interface document corresponding to the target interface information.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the back-end interface document generation method as described in any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the back-end interface document generation method as described in any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the back-end interface document generation method as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Interface document generation method and device, computer equipment and storage medium

    CN114168190A

  • Method for generating interface document and related device

    CN117055951A

Cited By

  • Interface metadata processing method, system and device, client and storage medium

    CN120371302A

  • Interface metadata processing method, system, device, client and storage medium

    CN120371302B