CN116107586A - Protobuf-based interface management method, device and medium - Google Patents

Protobuf-based interface management method, device and medium Download PDF

Info

Publication number
CN116107586A
CN116107586A CN202310158742.6A CN202310158742A CN116107586A CN 116107586 A CN116107586 A CN 116107586A CN 202310158742 A CN202310158742 A CN 202310158742A CN 116107586 A CN116107586 A CN 116107586A
Authority
CN
China
Prior art keywords
interface
api
protobuf
language type
development language
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310158742.6A
Other languages
Chinese (zh)
Inventor
吕明逸
赵海兴
孙长杰
陈义蒙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Original Assignee
Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chaozhou Zhuoshu Big Data Industry Development Co Ltd filed Critical Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Priority to CN202310158742.6A priority Critical patent/CN116107586A/en
Publication of CN116107586A publication Critical patent/CN116107586A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/37Compiler construction; Parser generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses an interface management method, device and medium based on Protobuf, which are used for solving the technical problems that in the prior art, due to iteration of an interface version, repair and change and the like, the logic of an interface is changed, but the interface cannot be updated in time, and development and test progress are affected. The method comprises the following steps: obtaining all definitions of the API interface and corresponding interface description language IDL files based on a predetermined API interface contract, and storing the all definitions and the corresponding interface description language IDL files in a preset code warehouse; determining an API interface to be called and a corresponding target development language type based on the interface calling request, and determining an interface description language IDL file of the target development language type in a code warehouse; and compiling an interface description language IDL file of the target development language type through the Protobuf compiler to generate a corresponding code and returning the corresponding code to an interface calling party corresponding to the interface calling request, so that the management of the interface is realized, the maintenance workload of the API interface is reduced, and the working efficiency is improved.

Description

Protobuf-based interface management method, device and medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, and a medium for managing an interface based on Protobuf.
Background
At present, agile development and front-back end separation architecture become more and more conventional working modes, and the back end can be used by various clients such as Web, android and the like only by providing a unified API interface, so that low coupling and high cohesion are realized, and the maintainability of codes is improved. However, as the project is continuously advanced and changed, the project scale is also larger and larger, the number of API interfaces is also larger and larger, and the maintenance cost is also higher and higher. After the design of the API interface is finished, the interface document corresponding to the API interface is written, and after the interface is subjected to version iteration, the interface document needs to be updated in time to keep the synchronization of the interface document and the code, so that the workload of maintaining the interface document is very large.
With iteration of interface version, the problem of difficult later maintenance is continuously exposed: because the interface is subjected to multiple iterations and the interface document is not updated in time, deviation occurs between the actual code logic and the content in the interface document, and the interface document is old and unavailable; the interface generates logic change due to repair problems, demand change and other reasons, and the change generated after modification cannot be synchronized to a front-end team and a test team in time, so that development and test progress is affected.
Disclosure of Invention
The embodiment of the application provides an interface management method, device and medium based on Protobuf, which are used for solving the technical problems that in the prior art, due to iteration of an interface version, repair change and the like, the logic of an interface is changed, but the interface cannot be updated in time, and development and test progress are affected.
In one aspect, an embodiment of the present application provides a Protobuf-based interface management method, including:
based on a predetermined API interface contract, obtaining all definitions of an API interface and interface description language IDL files corresponding to all definitions of the API interface, and storing the interface description language IDL files into a preset code warehouse;
determining an API to be called and a target development language type corresponding to the API to be called based on an interface calling request, and determining an interface description language IDL file of the target development language type corresponding to the API to be called in the code warehouse;
compiling the interface description language IDL file of the target development language type through a Protobuf compiler to generate a code of the target development language type, and returning the code to an interface caller corresponding to the interface call request to realize the management of an interface.
In one implementation manner of the present application, the obtaining all definitions of the API interface and interface description language IDL files corresponding to all definitions of the API interface based on the predetermined API interface contract, and storing the interface description language IDL files in a preset code repository specifically includes:
receiving callable API interface information uploaded by an interface provider, and determining an API interface contract corresponding to the callable API interface according to the callable API interface information;
based on the API interface contract corresponding to the callable API interface, obtaining all definitions corresponding to the API interface and interface description language IDL files corresponding to all definitions of the API interface;
and storing the API interface and the interface description language IDL file into a preset code warehouse, and managing the API interface through the code warehouse.
In one implementation manner of the present application, the managing, by the code repository, the API interface specifically includes:
and uniformly managing the development language type corresponding to the API interface in the code warehouse and the interface description language IDL file of the development language type through a code hosting tool.
In one implementation manner of the present application, after the storing the interface description language IDL file in a preset code repository, the method further includes:
acquiring a processing request of an interface provider to an API interface, and determining a to-be-processed API interface corresponding to the processing request in the code warehouse;
according to the processing request, performing corresponding processing operation on the API interface to be processed in the code warehouse file; the processing operations include at least: version change operations or modification operations.
In one implementation manner of the present application, the determining, based on the interface call request, an API to be called and a target development language type corresponding to the API to be called, and determining, in the code repository, an interface description language IDL file corresponding to the API to be called and the target development language type, specifically includes:
receiving an interface calling request of an interface calling party, and determining an API interface to be called corresponding to the interface calling party and a target development language type corresponding to the API interface to be called according to the interface calling request;
and determining an interface description language IDL file of the target development language type corresponding to the API to be called in the code warehouse based on the target development language type corresponding to the API to be called.
In one implementation manner of the present application, the compiling, by a Protobuf compiler, the interface description language IDL file of the target development language type to generate the code of the target development language type specifically includes:
determining a Protobuf compiler of the target development language type;
and generating client codes and server codes of the target development language type through a Protobuf compiler of the target development language type based on the interface description language IDL file of the target development language type.
In one implementation of the present application, all definitions of the API interface include at least one or more of the following: router address, input content, output content, interface name, and field type.
In one implementation of the present application, the target development language type includes at least one of: java development language type, go development language type, cpp development language type.
On the other hand, the embodiment of the application also provides an interface management device based on Protobuf, which comprises:
at least one processor;
and a memory communicatively coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a Protobuf-based interface management method as described above.
In another aspect, embodiments of the present application also provide a non-volatile computer storage medium storing computer-executable instructions configured to:
the interface management method based on Protobuf.
The embodiment of the application provides an interface management method, device and medium based on Protobuf, which at least comprise the following beneficial effects:
the interface description language IDL files corresponding to all definitions of the API interface and all definitions of the API interface are acquired, so that unified management of the interface description language IDL files is facilitated, and workload brought by maintaining the API interface is reduced; and the client-side codes and the server-side codes corresponding to the target development language types are respectively compiled and generated through the Protobuf compiler corresponding to each target development language type, so that the automatic compilation of the codes is realized, and the working efficiency is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
fig. 1 is a flow chart of an interface management method based on Protobuf according to an embodiment of the present application;
fig. 2 is a schematic internal structure of an interface management device based on Protobuf according to an embodiment of the present application.
Detailed Description
For the purposes, technical solutions and advantages of the present application, the technical solutions of the present application will be clearly and completely described below with reference to specific embodiments of the present application and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The embodiment of the application provides an interface management method, device and medium based on Protobuf, which are convenient for unified management of interface description language IDL files and reduce the workload brought by maintaining an API interface by acquiring all definitions of the API interface and interface description language IDL files corresponding to all definitions of the API interface; and the client-side codes and the server-side codes corresponding to the target development language types are respectively compiled and generated through the Protobuf compiler corresponding to each target development language type, so that the automatic compilation of the codes is realized, and the working efficiency is improved. The method solves the technical problems that in the prior art, the interface logic is changed due to iteration or repair change of the interface version, but the interface cannot be updated in time, and development and test progress are affected.
The following describes in detail the technical solutions provided by the embodiments of the present application with reference to the accompanying drawings.
Fig. 1 is a flow chart of an interface management method based on Protobuf according to an embodiment of the present application. As shown in fig. 1, an interface management method based on Protobuf provided in an embodiment of the present application includes:
101. and obtaining all definitions of the API and interface description language IDL files corresponding to all definitions of the API based on a predetermined API contract, and storing the interface description language IDL files into a preset code warehouse.
Protobuf is a platform-independent, language-independent, extensible method of serializing structural data under Google flag. In order to solve the problem that the interface in the interface document is manually changed and the workload of maintaining the interface is large in the prior art, the server can obtain all definitions of the API interface and interface description language IDL files corresponding to all definitions of the API interface by acquiring an API interface contract predetermined by an interface provider, so that unified management of the IDL files can be facilitated, the collaboration efficiency of developers is improved, and the workload brought by daily maintaining the corresponding files of the API interface can be reduced.
Specifically, the server can determine an API interface contract corresponding to the callable API interface according to the callable API interface information by receiving the callable API interface information uploaded by the interface provider, and then obtain all definitions corresponding to the API interface and interface description language IDL files corresponding to all definitions of the API interface based on the API interface contract corresponding to the callable API interface, so as to store the API interface and the interface description language IDL files into a preset code warehouse, thereby facilitating management of the API interface through the code warehouse.
It should be noted that, in the embodiment of the present application, all definitions of the API interface include at least one or more of the following: router address, input content, output content, interface name, and field type. For example: the server defines a routing address of an API interface as/v 1/hello, defines a string type of length 1 to 99 as an entry of a name field corresponding to the interface, and the like.
In one embodiment of the present application, when the server manages the API through the code repository, the server performs unified management and maintenance on the development language type corresponding to the API interface in the code repository and the interface description language IDL file of the development language type through a code hosting tool, for example, a Git tool.
In one embodiment of the application, after storing the interface description language IDL file in a preset code repository, the server obtains a processing request of the interface provider for the API interface, determines a to-be-processed API interface corresponding to the processing request in the code repository, and then performs corresponding processing operation on the to-be-processed API interface in the code repository file according to the processing request, so that a series of operations such as version change or modification on the API interface in the code repository can be realized through a code hosting tool, such as a Git tool, and thus the API interface of the interface description language IDL file in the code repository can be updated in time, and the situation that actual code logic is inconsistent with the interface description language IDL file is avoided.
It should be noted that, the processing operations in the embodiments of the present application at least include: version change operations or modification operations.
102. And determining an API to be called and a target development language type corresponding to the API to be called based on the interface calling request, and determining an interface description language IDL file of the target development language type corresponding to the API to be called in a code warehouse.
The server can determine the API interface to be called and the target development language type corresponding to the API interface to be called according to the received interface calling request, and then the server can determine the interface description language IDL file of the target development language type corresponding to the API interface to be called in the code warehouse.
Specifically, the server receives an interface call request of the interface caller, and can determine an API interface to be called corresponding to the interface caller and a target development language type corresponding to the API interface to be called according to the interface call request, and then determines an interface description language IDL file corresponding to the target development language type of the API interface to be called in the code repository based on the target development language type corresponding to the API interface to be called.
It should be noted that, in the embodiment of the present application, the target development language type to be docked includes at least one of the following: java development language type, go development language type, cpp development language type.
103. Compiling the interface description language IDL file of the target development language type through a Protobuf compiler to generate a code of the target development language type, and returning the code to an interface caller corresponding to the interface call request to realize the management of the interface.
The server compiles the interface description language IDL file of the target development language type through the Protobuf compiler, so that codes of the target development language type can be generated, and then the server returns the generated codes of the target development language type to an interface calling party corresponding to the interface calling request, so that the management of the interface is realized.
Specifically, the server needs to determine a Protobuf compiler of a target development language type, then generates client codes and server codes of the target development language type to be docked through the Protobuf compiler of the target development language type based on an interface description language IDL file of the target development language type, realizes that different development language types can respectively generate the client codes and the server codes corresponding to each development language type through the same interface description language IDL file, simultaneously can avoid repeated code writing, and improves development work efficiency.
The foregoing is a method embodiment presented herein. Based on the same inventive concept, the embodiment of the application also provides an interface management device based on Protobuf, and the structure of the interface management device is shown in fig. 2.
Fig. 2 is a schematic internal structure of an interface management device based on Protobuf according to an embodiment of the present application. As shown in fig. 2, the apparatus includes:
at least one processor;
and a memory communicatively coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor, the instructions being executable by the at least one processor to enable the at least one processor to:
based on a predetermined API interface contract, obtaining all definitions of an API interface and interface description language IDL files corresponding to all definitions of the API interface, and storing the interface description language IDL files into a preset code warehouse;
determining an API to be called and a target development language type corresponding to the API to be called based on the interface calling request, and determining an interface description language IDL file of the target development language type corresponding to the API to be called in a code warehouse;
compiling the interface description language IDL file of the target development language type through a Protobuf compiler to generate a code of the target development language type, and returning the code to an interface caller corresponding to the interface call request to realize the management of the interface.
The embodiments of the present application also provide a nonvolatile computer storage medium storing computer executable instructions configured to:
based on a predetermined API interface contract, obtaining all definitions of an API interface and interface description language IDL files corresponding to all definitions of the API interface, and storing the interface description language IDL files into a preset code warehouse;
determining an API to be called and a target development language type corresponding to the API to be called based on the interface calling request, and determining an interface description language IDL file of the target development language type corresponding to the API to be called in a code warehouse;
compiling the interface description language IDL file of the target development language type through a Protobuf compiler to generate a code of the target development language type, and returning the code to an interface caller corresponding to the interface call request to realize the management of the interface.
In the 90 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable Gate Array, FPGA)) is an integrated circuit whose logic function is determined by the programming of the device by a user. A designer programs to "integrate" a digital system onto a PLD without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented by using "logic compiler" software, which is similar to the software compiler used in program development and writing, and the original code before the compiling is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but not just one of the hdds, but a plurality of kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), lava, lola, myHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers, and embedded microcontrollers, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present specification.
It will be appreciated by those skilled in the art that the present description may be provided as a method, system, or computer program product. Accordingly, the present specification embodiments may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description embodiments may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present description is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the specification. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
The description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for apparatus, devices, non-volatile computer storage medium embodiments, the description is relatively simple, as it is substantially similar to method embodiments, with reference to the section of the method embodiments being relevant.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The foregoing is merely one or more embodiments of the present description and is not intended to limit the present description. Various modifications and alterations to one or more embodiments of this description will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, or the like, which is within the spirit and principles of one or more embodiments of the present description, is intended to be included within the scope of the claims of the present description.

Claims (10)

1. An interface management method based on Protobuf, which is characterized by comprising the following steps:
based on a predetermined API interface contract, obtaining all definitions of an API interface and interface description language IDL files corresponding to all definitions of the API interface, and storing the interface description language IDL files into a preset code warehouse;
determining an API to be called and a target development language type corresponding to the API to be called based on an interface calling request, and determining an interface description language IDL file of the target development language type corresponding to the API to be called in the code warehouse;
compiling the interface description language IDL file of the target development language type through a Protobuf compiler to generate a code of the target development language type, and returning the code to an interface caller corresponding to the interface call request to realize the management of an interface.
2. The Protobuf-based interface management method according to claim 1, wherein the obtaining all definitions of API interfaces and interface description language IDL files corresponding to all definitions of API interfaces based on predetermined API interface contracts, and storing the interface description language IDL files in a preset code repository specifically includes:
receiving callable API interface information uploaded by an interface provider, and determining an API interface contract corresponding to the callable API interface according to the callable API interface information;
based on the API interface contract corresponding to the callable API interface, obtaining all definitions corresponding to the API interface and interface description language IDL files corresponding to all definitions of the API interface;
and storing the API interface and the interface description language IDL file into a preset code warehouse, and managing the API interface through the code warehouse.
3. The Protobuf-based interface management method according to claim 2, wherein the managing the API interface through the code repository specifically comprises:
and uniformly managing the development language type corresponding to the API interface in the code warehouse and the interface description language IDL file of the development language type through a code hosting tool.
4. The Protobuf-based interface management method according to claim 1, wherein after storing the interface description language IDL file in a preset code repository, the method further comprises:
acquiring a processing request of an interface provider to an API interface, and determining a to-be-processed API interface corresponding to the processing request in the code warehouse;
according to the processing request, performing corresponding processing operation on the API interface to be processed in the code warehouse file; the processing operations include at least: version change operations or modification operations.
5. The Protobuf-based interface management method according to claim 1, wherein the determining, based on the interface call request, an API to be called and a target development language type corresponding to the API to be called, and determining, in the code repository, an interface description language IDL file corresponding to the target development language type corresponding to the API to be called specifically includes:
receiving an interface calling request of an interface calling party, and determining an API interface to be called corresponding to the interface calling party and a target development language type corresponding to the API interface to be called according to the interface calling request;
and determining an interface description language IDL file of the target development language type corresponding to the API to be called in the code warehouse based on the target development language type corresponding to the API to be called.
6. The Protobuf-based interface management method according to claim 1, wherein the compiling, by the Protobuf compiler, the interface description language IDL file of the target development language type to generate the code of the target development language type specifically includes:
determining a Protobuf compiler of the target development language type;
and generating client codes and server codes of the target development language type through a Protobuf compiler of the target development language type based on the interface description language IDL file of the target development language type.
7. The Protobuf-based interface management method according to claim 1, wherein the full definition of the API interface comprises at least one or more of the following: router address, input content, output content, interface name, and field type.
8. The Protobuf-based interface management method according to claim 1, wherein the target development language type at least comprises one of: java development language type, go development language type, cpp development language type.
9. A Protobuf-based interface management device, the device comprising:
at least one processor;
and a memory communicatively coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a Protobuf-based interface management method according to any of claims 1-8.
10. A non-transitory computer storage medium storing computer-executable instructions, the computer-executable instructions configured to:
a Protobuf-based interface management method according to any of claims 1-8.
CN202310158742.6A 2023-02-22 2023-02-22 Protobuf-based interface management method, device and medium Pending CN116107586A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310158742.6A CN116107586A (en) 2023-02-22 2023-02-22 Protobuf-based interface management method, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310158742.6A CN116107586A (en) 2023-02-22 2023-02-22 Protobuf-based interface management method, device and medium

Publications (1)

Publication Number Publication Date
CN116107586A true CN116107586A (en) 2023-05-12

Family

ID=86263761

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310158742.6A Pending CN116107586A (en) 2023-02-22 2023-02-22 Protobuf-based interface management method, device and medium

Country Status (1)

Country Link
CN (1) CN116107586A (en)

Similar Documents

Publication Publication Date Title
CN110134668B (en) Data migration method, device and equipment applied to blockchain
CN116185532B (en) Task execution system, method, storage medium and electronic equipment
CN112181378B (en) Method and device for realizing business process
CN117075930B (en) Computing framework management system
CN110046052B (en) Service calling method and device
CN114547024A (en) SQL statement risk detection method, device, equipment and medium
CN111459724B (en) Node switching method, device, equipment and computer readable storage medium
CN111273965B (en) Container application starting method, system and device and electronic equipment
CN111459573B (en) Method and device for starting intelligent contract execution environment
CN111338655B (en) Installation package distribution method and system
CN110874322B (en) Test method and test server for application program
CN110083602B (en) Method and device for data storage and data processing based on hive table
CN116107586A (en) Protobuf-based interface management method, device and medium
US10262054B2 (en) Database and service upgrade without downtime
CN110032433B (en) Task execution method, device, equipment and medium
CN111580938A (en) Transaction processing method, device, equipment and medium for work unit
CN112527387B (en) Application processing method and device
CN117591107A (en) Method, equipment and medium for fast rendering front-end interface
CN113590490B (en) Automatic test method, device and equipment
CN116737367B (en) Minio-based data preservation method, device and medium
CN117519733B (en) Project deployment method and device, storage medium and electronic equipment
CN110704039B (en) Configuration data processing method and device in application development process
CN116341642B (en) Data processing method and device, storage medium and electronic equipment
CN117118523B (en) Information transmission system, method and device, storage medium and electronic equipment
CN116108248A (en) Data query method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination