Automatic integration method and system for front-end and back-end independent development interfaces
The method of generating interface files through interface management warehouses and automated scripts solves the problem of cumbersome interface file maintenance in the front-end and back-end separate development mode, and realizes automatic generation of interface files, which improves development efficiency and reduces costs.
Patent Information
- Application Number
- CN202411945434.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-05-30
AI Technical Summary
In the independent development model of front-end and back-end separation, developers need to manually create and maintain interface files, which leads to large workloads and error-prone, and it is cumbersome to modify interface files synchronously when requirements change.
By providing a front-end independent development interface automation integration method, the interface management warehouse is used to unify the storage interface definition and data structure definition, corresponding interface file templates are generated, and front-end interface files are automatically generated through scripts.
It realizes that front-end developers do not need to manually create maintenance interface services and interface files, but only integrate and update configurations to automatically generate files, reducing development costs and improving development efficiency.
Smart Images

Figure CN120066463A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software development, and particularly relates to a method and system for automatic integration of front-end and back-end independent development interfaces. Background Art
[0002] With the continuous popularization and development of software development technologies, the software system architecture design has become more and more diversified. In the current software system development process, most system project architecture designs adopt the front-end and back-end separation and independent development mode. As shown in Figure 1 the following: Back-end developers manually create service services for interface services, provide interface designs and interface documents, and then notify front-end personnel; front-end developers create each interface api file and data parameter model definition one by one according to the interface documents.
[0003] Such a development mode has a large amount of code work, high complexity and is error-prone. With the increase of system function services and requirements, the corresponding interfaces will also increase exponentially; this will bring several problems to system development: (1) Developers need to continuously maintain interface files and data parameter models, with a large amount of work; (2) When requirements change, interfaces change, and parameters change, developers need to find the corresponding interface files one by one to synchronize and modify, which is more cumbersome and error-prone; (3) The communication cost for interface changes and iterations between front-end and back-end developers increases; (4) When multiple people collaborate on development, the differences in interface definitions and data models cannot be unified. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method and system for automatic integration of front-end and back-end independent development interfaces, so that back-end personnel only need to write interface implementations, and front-end personnel only need to write interface calls without continuing to declare the internal parameter types of the interfaces, greatly reducing the errors caused by manual interface construction and reducing the workload.
[0005] In a first aspect, the present invention provides a method for automatic integration of front-end and back-end independent development interfaces, including:
[0006] Interface management process: Form proto files for the interface definitions and data structure definitions required for each software development project, and store them uniformly in the interface management repository; customize interface file templates corresponding to the front-end and back-end interface language grammars according to proto characteristics; when the proto files of each software development project are updated and pushed to the interface management repository, a corresponding unique version number is generated;
[0007] Back-end interface file generation process: According to the back-end interface file template, read the latest proto file of the specified software development project in the interface management repository to generate back-end interface files;
[0008] Front - end interface file generation process: After obtaining the unique version number specified by the front - end and the proto files to be compiled, pull the specified proto files from the interface management repository and automatically generate front - end interface files according to the front - end interface file template.
[0009] Further, the interface management repository includes at least one system folder. Each system folder corresponds to a software development project. Each system folder includes at least one module folder. Each module folder corresponds to a functional module of the system. Each module folder is used to store the proto files corresponding to the functional module.
[0010] Further, based on protobuf, it supports automatically generating templates for the corresponding front - end and back - end interface files in the form of protoc script commands.
[0011] Further, the front - end configures the interface management repository address, unique version number, and proto files to be compiled through a json file.
[0012] Further, the front - end interface file template is automatically compiled through a script to generate front - end interface files; the back - end interface file template is embedded in the project engineering in the form of a sub - module, automatically reads the latest proto files in the interface management repository, and generates back - end interface files.
[0013] In the second aspect, the present invention provides a front - end and back - end independent development interface automated integration system, including:
[0014] An interface management module, which is used to form proto files for the interface definitions and data structure definitions required for each software development project, and store them uniformly in the interface management repository; customize interface file templates corresponding to the front - end and back - end interface language grammars according to the proto characteristics; generate a corresponding unique version number when the proto files of each software development project are updated and pushed to the interface management repository;
[0015] A back - end interface file generation module, which is used to generate back - end interface files by reading the latest proto files of the specified software development project in the interface management repository according to the back - end interface file template;
[0016] A front - end interface file generation module, which is used to pull the specified proto files from the interface management repository and automatically generate front - end interface files according to the front - end interface file template after obtaining the unique version number specified by the front - end and the proto files to be compiled.
[0017] Further, the interface management repository includes at least one system folder, each system folder corresponds to a software development project, each system folder includes at least one module folder, each module folder corresponds to a functional module of the system, and each module folder is used to store the proto file corresponding to the functional module.
[0018] Further, in the interface management module, based on protobuf, it supports automatically generating templates of corresponding front-end and back-end interface files in the form of protoc script commands.
[0019] Further, the front end configures the interface management repository address, unique version number, and proto files to be compiled through a json file.
[0020] Further, the front-end interface file template is automatically compiled through a script to generate front-end interface files; the back-end interface file template is embedded in the project engineering in the form of a sub-module, automatically reads the latest proto file in the interface management repository, and generates back-end interface files.
[0021] The technical solutions provided in the embodiments of the present invention have at least the following technical effects:
[0022] By providing a standardized interface mode for different platforms and application services, different systems and data sources are quickly integrated, realizing script automation management of the interface files required for production of the front and back ends, integrating different systems for unified management, and solving the collaborative development problem in the form of a remote repository; during the project development process, front-end and back-end R & D personnel will not need to manually create and maintain interface services and interface files, and only need to integrate and update the configuration and execute the front-end and back-end template generation instructions to achieve automatic file generation. While realizing resource sharing between multiple platforms, it also simplifies the development work of developers, improves development efficiency, and reduces development costs.
[0023] The above description is only an overview of the technical solutions of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the following specifically describes the embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The present invention will be further described below with reference to the drawings in conjunction with embodiments.
[0025] Figure 1 It is a framework schematic diagram of the front-end and back-end separation and independent development mode in the prior art;
[0026] Figure 2 It is a framework schematic diagram of the front-end and back-end separation and independent development mode in the embodiments of the present invention;
[0027] Figure 3 It is the overall flowchart of the method in the first embodiment of the present invention;
[0028] Figure 4 It is the architecture diagram of the Repository warehouse in the first embodiment of the present invention;
[0029] Figure 5 It is the directory structure diagram of the Repository warehouse in the first embodiment of the present invention
[0030] Figure 6 It is the schematic diagram of the json configuration file in the first embodiment of the present invention;
[0031] Figure 7 It is the schematic diagram of the repository hash update record in the first embodiment of the present invention;
[0032] Figure 8 It is the structural schematic diagram of the system in the second embodiment of the present invention. Detailed implementation manners
[0033] In the embodiments of the present invention, by providing a method and system for automated integration of front-end and back-end independent development interfaces, it is realized that back-end personnel only need to write interface implementations, and front-end personnel only need to write interface calls without continuing to declare the internal parameter type definitions of the interfaces, greatly reducing errors caused by manual construction of interfaces and reducing the workload.
[0034] The overall idea of the technical solution in the embodiments of the present invention is as follows:
[0035] The present invention mainly aims at Figure 1 optimizing the process of the part within the frame line in the existing technology system project architecture design that adopts the front-end and back-end separation independent development process shown in the figure. The front-end and back-end modules are stripped out and integrated through automated interfaces, so that front-end and back-end personnel are freed from manually creating interface files. Back-end personnel only need to write interface implementations, and front-end personnel only need to write interface calls without continuing to declare the internal parameter type definitions of the interfaces, greatly reducing errors caused by manual construction of interfaces and reducing the workload.
[0036] The overall idea architecture diagram is as shown in Figure 2 shown. Based on protobuf as the carrier, the interface definitions and data structure definitions of each software development project are all separated, and the interfaces are uniformly managed by the remote warehouse (Repository). By customizing the templates of the interface files corresponding to the front-end and back-end interface language grammars through proto features, such as generating TypeScript or javascript templates for the front-end and java grammar templates for the back-end, it can be realized that Figure 1The modules in the box are stripped, and the interface files required for the front and back ends of production are managed through script automation. Different systems are integrated for unified management, and the collaborative development problem is solved in the form of a remote repository. During the project development process, front-end and back-end R & D personnel will not need to manually create and maintain interface services and interface files. They only need to integrate and update the configuration and execute the front-end and back-end template generation instructions to automatically generate files.
[0037] Embodiment 1
[0038] This embodiment provides a method for automatically integrating front-end and back-end independent development interfaces. As Figure 3 shown, it includes:
[0039] S1. Interface management process: The interface definitions and data structure definitions required for each software development project are formed into proto files (proto files are used to define the request method and request structure of the interface), which are uniformly stored in the interface management repository; Interface file templates corresponding to the front-end and back-end interface language grammars are customized according to proto characteristics; When the proto file of each software development project is updated and pushed to the interface management repository, a corresponding unique version number is generated.
[0040] In a possible implementation, the interface management repository includes at least one system folder, each system folder corresponds to a software development project, each system folder includes at least one module folder, each module folder corresponds to a functional module of the system, and each module folder is used to store the proto file corresponding to the functional module. Based on protobuf, it supports automatically generating templates for corresponding front-end and back-end interface files in the form of protoc script commands.
[0041] S2. Back-end interface file generation process: According to the back-end interface file template, the latest proto file of the specified software development project in the interface management repository is read to generate the back-end interface file.
[0042] S3. Front-end interface file generation process: After obtaining the unique version number specified by the front end and the proto file to be compiled, the specified proto file in the interface management repository is pulled and the front-end interface file is automatically generated according to the front-end interface file template. The front end can configure the interface management repository address, unique version number, and proto file to be compiled through a json file, as Figure 6 shown.
[0043] Among them, the execution of the back-end interface file generation process and the front-end interface file generation process is not sequential. As long as the proto file of the software development project is updated to the repository, after obtaining the generation instruction, the corresponding interface file can be automatically generated according to the template. However, in a preferred implementation, the front-end interface file template is automatically compiled through a script to generate the front-end interface file; the back-end interface file template is embedded in the project through a sub-module method, automatically reads the latest proto file in the interface management repository, and generates the back-end interface file. That is, the front-end interface file needs to be automatically generated after the front-end personnel write and run the script, and the back-end interface file will be automatically generated as long as the proto file in the repository is updated. In this implementation, the back-end interface file generation process usually precedes the front-end interface file generation process.
[0044] In a specific embodiment, the remote repository (Repository) is used as the interface management repository, and its architecture is as Figure 2 shown. R & D personnel of different systems uniformly maintain the interface files of each system in the Repository repository. All server-side interface files are based on proto files. Different systems can be divided by project name as a module, such as Figure 4As shown, system1 and system2 represent different systems, including the module division of each system, module1, and the functional module interfaces of module1. Subsequently, based on protobuf, the corresponding front-end and back-end interface files are supported to be automatically generated in the form of protoc script commands. System1 system personnel only need to maintain the service.proto file under the systemt1 project. After the R & D personnel merge the interface definition code into the Repository remote repository, the front-end R & D personnel only need to introduce the commit version record hash identifier of this project Repository warehouse project and specify the corresponding service.proto as the proto source file for generating the front-end ts file. For example, specify: a single file system1 / module1 / service1.proto, multiple files system1 / module1 / *.proto. Then, through the protoc script tool, the service1.proto interface file or all proto files in the system1 / module1 / directory can be quickly generated and synchronized to their respective project projects, such as compiling the front-end file service1.ts in the front-end project api directory; the front-end personnel do not need to maintain the interface files in the api directory, and the back-end personnel automatically generate the interface definition service.java file. This reduces the interface maintenance costs of developers at each end. In subsequent project interface iterations, such as adding or modifying content in system / module1 / service1.proto, when the front-end and back-end personnel collaborate, each end only needs to synchronize the interface version record hash version identifier. Each end will automatically generate the corresponding code template to the corresponding directory, which can also reduce the interface synchronization error operations in the collaborative development process.
[0045] The overall implementation can include the following steps:
[0046] (1) R & D personnel create Figure 4 the Repository interface warehouse address information for managing interfaces in
[0047] (2) R & D personnel for different systems add their respective system directories such as system1, system2, system3 and manage the modules and sub-modules respectively;
[0048] (3) R & D personnel classify and maintain the proto files of relevant interfaces according to the business requirements for each interface definition by module and push them to the remote interface warehouse. For example, Figure 5 the service.proto interface file of system1 in
[0049] (4) Front-end developers create a generateConfig.json file in their respective development project engineering to configure the required hash version numbers of the Repository repository and specify the proto files to be compiled; the configuration method is as Figure 6 ;
[0050] (5) During the local development of front-end personnel, when they need to execute script commands in the local terminal, they will pull the remote repository information according to the generateConfig.json configuration and automatically generate interface files according to the configured compilation files and store them in the api directory. For the production deployment of the front-end project, there is no need to upload the api directory, only the generateConfig.json file needs to be uploaded;
[0051] (6) There are also differences in the processing methods for embedding interface files in the front-end and back-end project engineering. The front-end pulls the latest interface repository hash version number through a script according to the template of the customized requirements and compiles and generates the front-end interface document api file. The back-end is embedded in the project engineering through the sub-module method and automatically reads the latest interfaces in the remote repository to generate service files.
[0052] (7) R & D personnel need to modify and merge the interface proto files into the remote interface repository. The Repository hash update record is as Figure 7 shown; R & D personnel at each end only need to execute the script to automatically obtain the latest hash version number or manually modify the hash version number in the file created in step 3, and execute the script to automatically generate interface files;
[0053] (8) During the front-end and back-end production deployment, the front-end will read the hash configuration and the proto interface files to be compiled in the generateConfig.json configuration. The back-end will, according to the hash information configured by the current sub-module, pull the code information of the Repository repository address when compiling the front-end and back-end codes, and automatically generate modules as needed and use protoc to compile and generate the final code packages required by each system for release.
[0054] Based on the same inventive concept, the present application also provides a system corresponding to the method in Embodiment 1. For details, see Embodiment 2.
[0055] Embodiment 2
[0056] In this embodiment, a front-end and back-end independent development interface automation integration system is provided, as Figure 8 shown, including:
[0057] The interface management module is used to form a proto file from the interface definitions and data structure definitions required for each software development project, and store them uniformly in the interface management repository; customize the interface file templates corresponding to the front-end and back-end interface languages according to the proto characteristics; when the proto file of each software development project is updated and pushed to the interface management repository, a corresponding unique version number is generated.
[0058] The back-end interface file generation module is used to generate back-end interface files by reading the latest proto file of the specified software development project in the interface management repository according to the back-end interface file template.
[0059] The front-end interface file generation module is used to pull the specified proto file in the interface management repository and automatically generate front-end interface files according to the front-end interface file template after obtaining the unique version number specified by the front-end and the proto file to be compiled.
[0060] Furthermore, the interface management repository includes at least one system folder, each system folder corresponds to a software development project, each system folder includes at least one module folder, each module folder corresponds to a functional module of the system, and each module folder is used to store the proto file corresponding to the functional module.
[0061] Specifically, in the interface management module, based on protobuf, it supports automatically generating the templates of the corresponding front-end and back-end interface files in the form of protoc script commands.
[0062] Preferably, the front-end configures the interface management repository address, unique version number, and the proto file to be compiled through a json file.
[0063] Preferably, the front-end interface file template is automatically compiled to generate front-end interface files through a script; the back-end interface file template is embedded in the project engineering in the form of a sub-module, and automatically reads the latest proto file in the interface management repository and generates back-end interface files.
[0064] Since the system introduced in the second embodiment of the present invention is the system adopted for implementing the method in the first embodiment of the present invention, based on the method introduced in the first embodiment of the present invention, those skilled in the art can understand the specific structure and variations of the system, so it will not be elaborated here. Any system adopted by the method in the first embodiment of the present invention falls within the scope of protection of the present invention.
[0065] The present invention provides a standardized interface mode for different platforms and application services, quickly integrates different systems and data sources, realizes script automation management of interface files required for the front and back ends of production, integrates different systems for unified management, and solves the collaborative development problem in the form of a remote repository; during the project development process, front-end and back-end R & D personnel will not need to manually create and maintain interface services and interface files, but only need to integrate and update configurations and execute front-end and back-end template generation instructions to realize automatic file generation. While realizing resource sharing between multiple platforms, it also simplifies the development work of developers, improves development efficiency, and reduces development costs.
[0066] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0067] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, as well as the combination of flows and / or blocks in the flowchart and / or block diagram. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate for implementation in the process Figure 1 one process or multiple processes and / or blocks Figure 1 a device for the functions specified in one block or multiple blocks.
[0068] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device realizes the process Figure 1 one process or multiple processes and / or blocks Figure 1 a device for the functions specified in one block or multiple blocks.
[0069] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide for implementation in the process Figure 1One process or multiple processes and / or boxes Figure 1 Steps of functions specified in one box or multiple boxes.
[0070] Although the specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments we described are illustrative rather than used to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should all be covered by the scope protected by the claims of the present invention.
Claims
1. A method for automated integration of front-end and back-end independent development interfaces, characterized in that: include: Interface management process: The interface definition and data structure definition required for each software development project are formed into proto files and stored uniformly in the interface management warehouse; Customize the interface file templates corresponding to the front-end and back-end interface language syntax according to the proto characteristics; When the proto file of each software development project is updated and pushed to the interface management warehouse, a corresponding unique version number is generated; Backend interface file generation process: According to the backend interface file template, read the latest proto file of the specified software development project in the interface management warehouse to generate the backend interface file; Front-end interface file generation process: After obtaining the unique version number specified by the front-end and the proto file that needs to be compiled, pull the specified proto file from the interface management warehouse and automatically generate the front-end interface file according to the front-end interface file template.
2. The method according to claim 1, characterized in that: The interface management warehouse includes at least one system folder, each system folder corresponds to a software development project, each system folder includes at least one module folder, each module folder corresponds to a functional module of the system, and each module folder is used to store the proto file corresponding to the functional module.
3. The method according to claim 1, characterized in that: Based on protobuf, the template for automatically generating corresponding front-end and back-end interface files is supported through the protoc script command form.
4. The method according to claim 1, characterized in that: The front end manages the warehouse address, unique version number, and proto files that need to be compiled through the json file configuration interface.
5. The method according to claim 1, characterized in that: The front-end interface file template is automatically compiled and generated through scripts; the back-end interface file template is embedded in the project as a sub-module, automatically reads the latest proto file in the interface management warehouse and generates the back-end interface file.
6. A front-end and back-end independent development interface automation integration system, characterized in that: include: The interface management module is used to convert the interface definition and data structure definition required for each software development project into proto files, which are uniformly stored in the interface management warehouse; Customize the interface file templates corresponding to the front-end and back-end interface language syntax according to the proto characteristics; When the proto file of each software development project is updated and pushed to the interface management warehouse, a corresponding unique version number is generated; The back-end interface file generation module is used to generate the back-end interface file by reading the latest proto file of the specified software development project in the interface management warehouse according to the back-end interface file template; The front-end interface file generation module is used to obtain the unique version number specified by the front-end and the proto file that needs to be compiled, pull the specified proto file from the interface management warehouse, and automatically generate the front-end interface file according to the front-end interface file template.
7. The system according to claim 6, characterized in that: The interface management warehouse includes at least one system folder, each system folder corresponds to a software development project, each system folder includes at least one module folder, each module folder corresponds to a functional module of the system, and each module folder is used to store the proto file corresponding to the functional module.
8. The system according to claim 6, characterized in that: In the interface management module, the templates for automatically generating corresponding front-end and back-end interface files are supported based on protobuf through protoc script commands.
9. The system according to claim 6, characterized in that: The front end manages the warehouse address, unique version number, and proto files that need to be compiled through the json file configuration interface.
10. The system according to claim 6, characterized in that: The front-end interface file template is automatically compiled and generated through scripts; the back-end interface file template is embedded in the project as a sub-module, automatically reads the latest proto file in the interface management warehouse and generates the back-end interface file.