CN111414161A - Method, device, medium and electronic equipment for generating ID L file - Google Patents

Method, device, medium and electronic equipment for generating ID L file Download PDF

Info

Publication number
CN111414161A
CN111414161A CN202010231517.7A CN202010231517A CN111414161A CN 111414161 A CN111414161 A CN 111414161A CN 202010231517 A CN202010231517 A CN 202010231517A CN 111414161 A CN111414161 A CN 111414161A
Authority
CN
China
Prior art keywords
request
file
function
type
response data
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.)
Granted
Application number
CN202010231517.7A
Other languages
Chinese (zh)
Other versions
CN111414161B (en
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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010231517.7A priority Critical patent/CN111414161B/en
Publication of CN111414161A publication Critical patent/CN111414161A/en
Application granted granted Critical
Publication of CN111414161B publication Critical patent/CN111414161B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • 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

Abstract

The method comprises the steps of obtaining routing files, analyzing each routing file to obtain routing information of each request interface function, obtaining corresponding processing function files based on path information of the processing function files, analyzing each processing function file, obtaining request data and a built-in request operation function of a frame for setting response data, and a set of request data types and response data types corresponding to each request interface function, and generating a first file based on the routing information, the request data types corresponding to the request interface functions and the response data types.

Description

Method, device, medium and electronic equipment for generating ID L file
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a medium, and an electronic device for generating an ID L file.
Background
The existing network application becomes more and more complex, and the efficiency of network application development is generally improved through a function-layered architecture mode and a function-dismantling labor-division mode. Network application development is generally divided into client development and server development. The customer service end and the service end are in butt joint through the application interface. In an ideal development process, a client and a server developer firstly negotiate and determine information of an application interface, then form an interface description document, and finally develop and interface according to the interface description document.
The Interface Description language (called Interface Description L, abbreviated as ID L) is an Interface Description mode widely used by a back-end Remote Procedure Call Protocol (called Remote Procedure Call (RPC) for short) framework, has the advantages of being independent of a programming language, concise and understandable, and the like, however, since the ID L is designed for the RPC Interface, the HTTP Interface cannot be completely described, HTTP Interface information, such as an HTTP method, the position of data in an HTTP request and the like, needs to be extended on the ID L through a labeling method to describe the HTTP Interface, and compared with the HTTP Interface Description modes in JSON formats such as Swagger and YApi, the extended ID L is more concise and readable.
However, writing an ID L document by hand is a very complicated task that is prone to errors.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
The invention aims to provide a method, a device, a medium and an electronic device for generating an ID L file, which can solve at least one technical problem mentioned above.
According to a specific embodiment of the present disclosure, in a first aspect, the present disclosure provides a method for generating an ID L file, including:
acquiring a routing file;
analyzing each routing file to obtain the routing information of each request interface function; wherein the routing information comprises path information and a processing function name of a processing function file associated with the requesting interface function;
acquiring a corresponding processing function file based on the path information of the processing function file;
analyzing each processing function file, acquiring a frame built-in request operation function of request data and setting response data, and a group of request data types and response data types corresponding to each request interface function;
generating a first file based on the routing information, the request data type corresponding to the request interface function and the response data type; wherein the first document is written by an interface description language.
According to a second aspect, the present disclosure provides an apparatus for generating an ID L file, including:
a route file obtaining unit, configured to obtain a route file;
the route file analyzing unit is used for analyzing each route file and acquiring the route information of each request interface function; wherein the routing information comprises path information and a processing function name of a processing function file associated with the requesting interface function;
the processing function file acquiring unit is used for acquiring a corresponding processing function file based on the path information of the processing function file;
the analysis processing function file unit is used for acquiring request data and setting a frame built-in request operation function of response data, and a group of request data types and response data types corresponding to each request interface function;
a first file generating unit, configured to generate a first file based on the routing information, the request data type corresponding to the request interface function, and the response data type; wherein the first document is written by an interface description language.
According to a third aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of generating an ID L file as set forth in any one of the first aspects.
According to a fourth aspect, the present disclosure provides an electronic device comprising one or more processors, storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out the method of generating an ID L file as claimed in any one of the first aspect.
Compared with the prior art, the scheme of the embodiment of the disclosure at least has the following beneficial effects:
compared with a handwritten ID L file, the method can automatically generate the ID L file according to the golang codes, and has higher efficiency and accuracy.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale. In the drawings:
FIG. 1 illustrates a flow diagram of a method of generating an ID L file according to an embodiment of the disclosure;
FIG. 2 illustrates a block diagram of elements of an apparatus for generating an ID L file, according to an embodiment of the disclosure;
fig. 3 shows an electronic device connection structure schematic according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Alternative embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
A first embodiment provided for the present disclosure, namely, an embodiment of a method of generating an ID L file.
An embodiment of the present disclosure is described in detail below with reference to fig. 1, where fig. 1 is a flowchart of a method for generating an ID L file according to an embodiment of the present disclosure.
Step S101, obtaining a routing file.
The functions of the web application service framework include: receiving HTTP request message, processing function and returning HTTP response message. Different HTTP request messages correspond to different processing functions. The distribution of the HTTP request message to the corresponding processing function is the function of routing in the network application framework. The route information completing the route registration is saved in the route file. The user specifies the route file path by means of the command line parameters, and the route file path specified by the user can be obtained by analyzing the command line parameters, so that the route file is obtained.
Step S102, analyzing each routing file, and obtaining the routing information of each request interface function.
Wherein the routing information includes path information and a processing function name of a processing function file associated with the requesting interface function.
The processing function is a context type with an entry as a frame and a back reference as a null function.
When routing, the framework passes the context instance to the processing function and calls the processing function.
The context instance mounts a built-in request operation function of the framework that acquires the request data and sets the response data, for example, "context.
In the processing function, firstly, a request operation function built in a frame of a context instance is called to obtain request data, then business logic processing is carried out according to the request data to obtain return data, and finally, the request operation function built in the frame for setting response data is called to set response data. Whether the request data is acquired or the response data is set, the built-in request operation function of the framework needs to be called.
Specifically, the analyzing each routing file to obtain the routing information of each request interface function includes the following steps:
step S102-1, each routing file is analyzed based on the first syntax analysis model, and a first abstract syntax tree is generated.
The first parsing model includes a go/parser library.
An abstract syntax tree (AST, english acronym abstract syntax tree) is a tree representation of an abstract syntax structure of a source code. Each node on the tree represents a structure in the source code. The syntax is said to be "abstract" in that the syntax does not represent every detail that appears in the true syntax.
And step S102-2, respectively analyzing the first abstract syntax tree according to each request interface function, and acquiring corresponding routing information.
Step S103, acquiring a corresponding processing function file based on the path information of the processing function file.
Step S104, analyzing each processing function file, obtaining the frame built-in request operation function of the request data and the set response data, and a group of request data type and response data type corresponding to each request interface function.
For each request interface function, the get request data and the set response data occur in pairs, that is, in groups. Thus, request data types and response data types also occur in groups. I.e. each of said request interface functions corresponds to a set of said request data type and said response data type.
Specifically, the analyzing each processing function file, obtaining a frame built-in request operation function of the request data and the setting response data, and a group of request data types and response data types corresponding to each request interface function includes the following steps:
and step S104-1, analyzing each processing function file based on the second syntax analysis model to generate a second abstract syntax tree.
The second parsing model includes a go/parser library.
And step S104-2, traversing the second abstract syntax tree based on the built-in request operation function of each frame to obtain a corresponding second abstract syntax sub-tree.
Wherein the second abstract syntax sub-tree comprises a request acquisition code and a response setting code; the request acquisition code is a golang code for acquiring request data; the response setting code is a golang code that sets the response data.
And step S104-3, respectively analyzing a group of request codes and response codes corresponding to each request interface function to obtain corresponding request data types and response data types.
The request data type also includes a data type upon which the request data type depends.
The response data type also includes a data type upon which the response data type depends.
Step S105, generating a first file based on the routing information, the request data type corresponding to the request interface function, and the response data type.
The first file is written by Interface Description language (English full name Interface Description L angle, ID L for short). ID L provides a simple and convenient way to write Interface Description document.
The generating a first file based on the routing information, the request data type corresponding to the request interface function and the response data type includes the following steps:
step S105-1, generating a function type and corresponding first annotation information based on each routing information.
Wherein the function type and the first annotation information are both written in an interface description language, and the first annotation information comprises: and processing the annotation information corresponding to the function.
Since there is a one-to-one correspondence between the type of golang and the type of ID L, the type of golang can be converted into the type of ID L.
The comments associated with the routing information typically include descriptions of the specific meaning of the function and type fields implemented by the interface, which are essential information for the description of the interface, and the translated ID L should also contain these comments.
Step S105-2, generating a first structure type and second annotation information corresponding to the first structure type based on each set of the request data type and the response data type.
Wherein the first structure type and the second annotation information are both written in an interface description language.
The request data type further comprises request type annotation information; the response data type also includes response type annotation information.
In the aforementioned second abstract syntax tree, the second abstract syntax subtree includes a node for requesting type annotation information and a node for responding to type annotation information.
And step S105-3, generating a corresponding service type according to each function type.
Wherein the service type is written by an interface description language.
In ID L, a service type (service) contains several request interface function types, one service type representing a backend service, and one request interface function type representing an interface provided by the backend service.
And step S105-4, aggregating each service type and each first structure type to generate a first file.
That is, all service types and the first structure type are aggregated together to generate a first document composed by ID L.
Compared with a handwritten ID L file, the method disclosed by the embodiment of the disclosure can automatically generate the ID L file according to the golang codes, and has higher efficiency and accuracy.
Since the second embodiment is basically similar to the first embodiment, the description is simple, and the relevant parts can be referred to the corresponding description of the first embodiment.
FIG. 2 illustrates an embodiment of an apparatus for generating an ID L file provided by the present disclosure FIG. 2 is a block diagram of elements of an apparatus for generating an ID L file provided by an embodiment of the present disclosure.
Referring to fig. 2, the present disclosure provides an apparatus for generating an ID L file, which includes a route file obtaining unit 201, a route file analyzing unit 202, a processing function file obtaining unit 203, a processing function file analyzing unit 204, and a first file generating unit 205.
An acquire routing file unit 201, configured to acquire a routing file;
an analysis routing file unit 202, configured to analyze each routing file and obtain routing information of each request interface function; wherein the routing information comprises path information and a processing function name of a processing function file associated with the requesting interface function;
an obtaining processing function file unit 203, configured to obtain a corresponding processing function file based on the path information of the processing function file;
an analysis processing function file unit 204, configured to obtain a frame built-in request operation function of the request data and the set response data, and a set of request data types and response data types corresponding to each request interface function;
a first file generating unit 205, configured to generate a first file based on the routing information, the request data type corresponding to the request interface function, and the response data type; wherein the first document is written by an interface description language.
Optionally, the analyzing the routing file unit 202 includes:
generating a first abstract syntax tree subunit, which is used for analyzing each routing file based on the first syntax analysis model and generating a first abstract syntax tree;
and the routing information obtaining subunit is used for analyzing the first abstract syntax tree according to each request interface function respectively to obtain corresponding routing information.
Optionally, the analyzing and processing function file unit 204 includes:
generating a second abstract syntax tree subunit, configured to analyze each processing function file based on a second syntax analysis model, and generate a second abstract syntax tree;
a second abstract syntax sub-tree subunit is obtained, which is used for traversing the second abstract syntax tree based on each frame built-in request operation function to obtain a corresponding second abstract syntax sub-tree; wherein the second abstract syntax sub-tree comprises a request acquisition code and a response setting code; the request acquisition code is a golang code for acquiring request data; the response setting code is a golang code that sets response data;
and the data type obtaining subunit is used for respectively analyzing a group of request codes and response codes corresponding to each request interface function and obtaining corresponding request data types and response data types.
Optionally, the request data type further includes a data type on which the request data type depends;
the response data type also includes a data type upon which the response data type depends.
Optionally, in the first file generating unit 205, the method includes:
a first routing information generation subunit, configured to generate a function type and corresponding first annotation information based on each piece of routing information; wherein the function type and the first annotation information are both written in an interface description language, and the first annotation information comprises: processing annotation information corresponding to the function;
a first request information generation subunit configured to generate, based on each set of the request data type and the response data type, a first structure type and second annotation information corresponding to the first structure type; wherein the first structure type and the second annotation information are both written in an interface description language;
generating a first service subunit, which is used for generating a corresponding service type according to each function type; wherein the service type is written by an interface description language;
and generating a first file subunit, configured to aggregate each service type and each first structure type, and generate a first file.
Optionally, the request data type further includes request type annotation information; the response data type also includes response type annotation information.
Compared with a handwritten ID L file, the device disclosed by the embodiment of the disclosure can automatically generate the ID L file according to the golang code, and has higher efficiency and accuracy.
The disclosed embodiment provides a third embodiment, namely an electronic device for generating an ID L file, the electronic 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 one processor to cause the at least one processor to perform the method of generating an ID L file as described in the first embodiment.
The disclosed embodiments provide a fourth embodiment, namely a computer storage medium generating an ID L file, the computer storage medium storing computer-executable instructions that can perform the method of generating an ID L file as described in the first embodiment.
Referring now to FIG. 3, shown is a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 3 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 3, the electronic device may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 301 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)302 or a program loaded from a storage device 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
In general, input devices 306 including, for example, touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc., output devices 307 including, for example, liquid crystal displays (L CD), speakers, vibrators, etc., storage devices 308 including, for example, magnetic tape, hard disks, etc., and communication devices 309, communication devices 309 may allow the electronic device to communicate wirelessly or wiredly with other devices to exchange data.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 309, or installed from the storage means 308, or installed from the ROM 302. The computer program, when executed by the processing device 301, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText transfer protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communications network). examples of communications networks include local area networks ("L AN"), wide area networks ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
Computer program code for carrying out operations of the present disclosure may be written in any combination of one or more programming languages, including but not limited to AN object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
For example, without limitation, exemplary types of hardware logic that may be used include Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CP L D), and so forth.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (9)

1. A method of generating an ID L file, comprising:
acquiring a routing file;
analyzing each routing file to obtain the routing information of each request interface function; wherein the routing information comprises path information and a processing function name of a processing function file associated with the requesting interface function;
acquiring a corresponding processing function file based on the path information of the processing function file;
analyzing each processing function file, acquiring a frame built-in request operation function of request data and setting response data, and a group of request data types and response data types corresponding to each request interface function;
generating a first file based on the routing information, the request data type corresponding to the request interface function and the response data type; wherein the first document is written by an interface description language.
2. The method of claim 1, wherein analyzing each routing file to obtain routing information for each request interface function comprises:
analyzing each routing file based on a first syntax analysis model and generating a first abstract syntax tree;
and analyzing the first abstract syntax tree according to each request interface function to obtain corresponding routing information.
3. The method of claim 1, wherein analyzing each processing function file, obtaining a request data and setting a built-in request operation function of a frame of response data, and a set of request data type and response data type corresponding to each request interface function comprises:
analyzing each processing function file based on a second syntax analysis model to generate a second abstract syntax tree;
traversing the second abstract syntax tree based on each frame built-in request operation function to obtain a corresponding second abstract syntax sub-tree; wherein the second abstract syntax sub-tree comprises a request acquisition code and a response setting code; the request acquisition code is a golang code for acquiring request data; the response setting code is a golang code that sets response data;
and respectively analyzing a group of request codes and response codes corresponding to each request interface function to obtain corresponding request data types and response data types.
4. The method of claim 3, wherein the request data type further comprises a data type upon which the request data type depends;
the response data type also includes a data type upon which the response data type depends.
5. The method of claim 1, wherein generating a first file based on the routing information, a set of the request data types corresponding to the request-built-in operation function, and the response data type comprises:
generating a function type and corresponding first annotation information based on each routing information; wherein the function type and the first annotation information are both written in an interface description language, and the first annotation information comprises: processing annotation information corresponding to the function;
generating a first structure type and second annotation information corresponding to the first structure type based on each set of the request data type and the response data type; wherein the first structure type and the second annotation information are both written in an interface description language;
generating a corresponding service type according to each function type; wherein the service type is written by an interface description language;
and aggregating each service type and each first structure type to generate a first file.
6. The method of claim 5, wherein the request data type further comprises request type annotation information; the response data type also includes response type annotation information.
7. An apparatus for generating an ID L file, comprising:
a route file obtaining unit, configured to obtain a route file;
the route file analyzing unit is used for analyzing each route file and acquiring the route information of each request interface function; wherein the routing information comprises path information and a processing function name of a processing function file associated with the requesting interface function;
the processing function file acquiring unit is used for acquiring a corresponding processing function file based on the path information of the processing function file;
the analysis processing function file unit is used for acquiring request data and setting a frame built-in request operation function of response data, and a group of request data types and response data types corresponding to each request interface function;
a first file generating unit, configured to generate a first file based on the routing information, the request data type corresponding to the request interface function, and the response data type; wherein the first document is written by an interface description language.
8. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method according to any one of claims 1 to 6.
9. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out the method of any one of claims 1 to 6.
CN202010231517.7A 2020-03-27 2020-03-27 Method, device, medium and electronic equipment for generating IDL file Active CN111414161B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010231517.7A CN111414161B (en) 2020-03-27 2020-03-27 Method, device, medium and electronic equipment for generating IDL file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010231517.7A CN111414161B (en) 2020-03-27 2020-03-27 Method, device, medium and electronic equipment for generating IDL file

Publications (2)

Publication Number Publication Date
CN111414161A true CN111414161A (en) 2020-07-14
CN111414161B CN111414161B (en) 2023-05-12

Family

ID=71491465

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010231517.7A Active CN111414161B (en) 2020-03-27 2020-03-27 Method, device, medium and electronic equipment for generating IDL file

Country Status (1)

Country Link
CN (1) CN111414161B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111930363A (en) * 2020-08-07 2020-11-13 北京字节跳动网络技术有限公司 Block interface code generation method and device

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120304150A1 (en) * 2011-05-24 2012-11-29 Microsoft Corporation Binding between a layout engine and a scripting engine
CN103473045A (en) * 2013-08-27 2013-12-25 广州华多网络科技有限公司 Method and device for generating interface documents
US20150012911A1 (en) * 2012-01-31 2015-01-08 United States Government As Represented By The Secretary Of The Navy Interface simulator for test rig in data distribution service
CN107463376A (en) * 2017-07-21 2017-12-12 珠海牛角科技有限公司 The method and device for automatically generating back end interface document based on Javadoc
CN108038796A (en) * 2017-12-11 2018-05-15 厦门亿力吉奥信息科技有限公司 GIS service operation method, storage medium based on C++
CN109032663A (en) * 2018-07-09 2018-12-18 深圳市小牛在线互联网信息咨询有限公司 Generation method, device, computer equipment and the storage medium of interface document
CN109375922A (en) * 2018-09-26 2019-02-22 深圳壹账通智能科技有限公司 A kind of automatic generation method and terminal device of interface document
CN109976872A (en) * 2019-02-21 2019-07-05 北京达佳互联信息技术有限公司 Data processing method, device, electronic equipment and storage medium
CN110162296A (en) * 2019-04-15 2019-08-23 平安科技(深圳)有限公司 Generation method, device and the terminal device of application programming interface document
CN110308930A (en) * 2019-06-18 2019-10-08 广州华多网络科技有限公司 Interface document generation method, device, computer equipment and storage medium
CN110377273A (en) * 2019-07-01 2019-10-25 北京字节跳动网络技术有限公司 A kind of method, apparatus of data processing, medium and electronic equipment
CN110457144A (en) * 2019-08-05 2019-11-15 北京字节跳动网络技术有限公司 A kind of method, apparatus that realizing front end applications, medium and equipment
CN110704102A (en) * 2019-09-12 2020-01-17 北京字节跳动网络技术有限公司 Page jump protocol interface document generation method, system, medium and electronic device
CN110795084A (en) * 2019-11-01 2020-02-14 腾讯科技(深圳)有限公司 Method, device and equipment for generating interface description file and readable storage medium

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120304150A1 (en) * 2011-05-24 2012-11-29 Microsoft Corporation Binding between a layout engine and a scripting engine
US20150012911A1 (en) * 2012-01-31 2015-01-08 United States Government As Represented By The Secretary Of The Navy Interface simulator for test rig in data distribution service
CN103473045A (en) * 2013-08-27 2013-12-25 广州华多网络科技有限公司 Method and device for generating interface documents
CN107463376A (en) * 2017-07-21 2017-12-12 珠海牛角科技有限公司 The method and device for automatically generating back end interface document based on Javadoc
CN108038796A (en) * 2017-12-11 2018-05-15 厦门亿力吉奥信息科技有限公司 GIS service operation method, storage medium based on C++
CN109032663A (en) * 2018-07-09 2018-12-18 深圳市小牛在线互联网信息咨询有限公司 Generation method, device, computer equipment and the storage medium of interface document
CN109375922A (en) * 2018-09-26 2019-02-22 深圳壹账通智能科技有限公司 A kind of automatic generation method and terminal device of interface document
CN109976872A (en) * 2019-02-21 2019-07-05 北京达佳互联信息技术有限公司 Data processing method, device, electronic equipment and storage medium
CN110162296A (en) * 2019-04-15 2019-08-23 平安科技(深圳)有限公司 Generation method, device and the terminal device of application programming interface document
CN110308930A (en) * 2019-06-18 2019-10-08 广州华多网络科技有限公司 Interface document generation method, device, computer equipment and storage medium
CN110377273A (en) * 2019-07-01 2019-10-25 北京字节跳动网络技术有限公司 A kind of method, apparatus of data processing, medium and electronic equipment
CN110457144A (en) * 2019-08-05 2019-11-15 北京字节跳动网络技术有限公司 A kind of method, apparatus that realizing front end applications, medium and equipment
CN110704102A (en) * 2019-09-12 2020-01-17 北京字节跳动网络技术有限公司 Page jump protocol interface document generation method, system, medium and electronic device
CN110795084A (en) * 2019-11-01 2020-02-14 腾讯科技(深圳)有限公司 Method, device and equipment for generating interface description file and readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111930363A (en) * 2020-08-07 2020-11-13 北京字节跳动网络技术有限公司 Block interface code generation method and device
CN111930363B (en) * 2020-08-07 2023-11-24 抖音视界有限公司 Block interface code generation method and device

Also Published As

Publication number Publication date
CN111414161B (en) 2023-05-12

Similar Documents

Publication Publication Date Title
CN111324342B (en) Method, device, medium and electronic equipment for generating interface layer code
CN111930534A (en) Data calling method and device and electronic equipment
CN111679990B (en) Test data generation method and device, readable medium and electronic equipment
CN110753089A (en) Method, device, medium and electronic equipment for managing client
CN112395253B (en) Index file generation method, terminal device, electronic device and medium
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN111596991A (en) Interactive operation execution method and device and electronic equipment
CN110377273B (en) Data processing method, device, medium and electronic equipment
CN111338813A (en) Method, device, medium and electronic equipment for dynamically generating middleware
CN114721656A (en) Interface structure extraction method, device, medium and electronic equipment
CN113220281A (en) Information generation method and device, terminal equipment and storage medium
CN111355784B (en) Method, device, medium and electronic equipment for processing request information
CN111949746A (en) Data processing method and device, electronic equipment and computer readable medium
CN111414161B (en) Method, device, medium and electronic equipment for generating IDL file
CN111752644A (en) Interface simulation method, device, equipment and storage medium
CN111240801A (en) Method, device, medium and electronic equipment for generating heap memory snapshot file
CN111241137A (en) Data processing method and device, electronic equipment and storage medium
CN114513552A (en) Data processing method, device, equipment and storage medium
CN111881216A (en) Data acquisition method and device based on shared template
CN115102992B (en) Data publishing method and device, electronic equipment and computer readable medium
CN111399902B (en) Client source file processing method and device, readable medium and electronic equipment
CN114253520B (en) Interface code generation method and device
CN112688863B (en) Gateway data processing method and device and electronic equipment
CN111400322B (en) Method, apparatus, electronic device and medium for storing data
US20240086850A1 (en) Method, apparatus, device and storage medium for data processing

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
GR01 Patent grant
GR01 Patent grant