A method, device, electronic terminal and storage medium for generating a calling code

By pulling and processing API raw data from the interface management platform and generating call code based on preset templates, the high cost and inefficiency problems of developers manually positioning and writing API services in the existing technology are solved, and automated interface call code generation is realized , improves development efficiency and experience.

CN113535147BActive Publication Date: 2024-12-13GUAHAO (HANGZHOU) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110819368.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-20
Publication Date
2024-12-13
Estimated Expiration
2041-07-20

AI Technical Summary

Technical Problem

In the prior art, developers need to manually locate APIs and write API services, resulting in high development costs, low efficiency and poor experience.

Method used

By pulling raw data from the interface management platform and processing it into a preset format, calling code is generated based on the preset template to realize automated interface calling code generation.

Benefits of technology

It reduces development costs, improves development efficiency and development experience, and realizes automated interface call code generation in different generation scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113535147B_ABST
    Figure CN113535147B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method, device, electronic terminal and storage medium for generating a call code, the method comprising: in response to a generation instruction, pulling the original data of the first interface corresponding to the current project from the interface management platform, and processing the original data into the first data conforming to a preset format; based on the type of the generation instruction, generating the call code of the first interface according to the first data and a preset template; wherein the preset template is generated based on the attribute fields contained in the preset format. The interface data required for the current project can be pulled from the automatic platform and the call code can be generated, thereby reducing development costs, improving development efficiency and the development experience of developers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to computer technology, and in particular to a method, device, electronic terminal and storage medium for generating a calling code. Background Art

[0002] During the software development process, when the front-end project calls the Application Programming Interface (API), it cannot directly call the API description information in the API document provided by the API management platform. Instead, it is necessary to encapsulate the API description information first and generate the basic call definition of the API in the code, that is, generate the API service (API service), that is, generate the API call code. Then, the front-end project can call the API by calling the API service.

[0003] In the prior art, the development terminal can first respond to the search instructions input by the developer, locate the API document of the API required for the project from the API management platform, and display it to the developer; then, it can generate the API service in response to the writing operation input by the developer.

[0004] The shortcomings of existing technologies include at least the need for developers to locate APIs on the API management platform and the need to manually write API services, which results in high development time and labor costs, low development efficiency, and poor development experience. Summary of the invention

[0005] In view of this, the embodiments of the present invention provide a method, device, electronic terminal and storage medium for generating a calling code, which can reduce development costs, improve development efficiency and the development experience of developers.

[0006] In a first aspect, an embodiment of the present invention provides a method for generating a calling code, comprising:

[0007] In response to the generation instruction, original data of the first interface corresponding to the current project is pulled from the interface management platform, and the original data is processed into first data conforming to a preset format;

[0008] Based on the type of the generation instruction, the calling code of the first interface is generated according to the first data and a preset template; wherein the preset template is generated based on the attribute fields included in the preset format.

[0009] In a second aspect, an embodiment of the present invention further provides a device for generating a calling code, comprising:

[0010] an acquisition processing module, configured to, in response to a generation instruction, pull original data of a first interface corresponding to a current project from an interface management platform, and process the original data into first data conforming to a preset format;

[0011] A generation module is used to generate a calling code of the first interface based on the type of the generation instruction, according to the first data and a preset template; wherein the preset template is generated based on the attribute field included in the preset format.

[0012] In a third aspect, an embodiment of the present invention further provides an electronic terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a method for generating a calling code as provided in any embodiment of the present application is implemented.

[0013] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements a method for generating a calling code as provided in any embodiment of the present application.

[0014] An embodiment of the present invention provides a method, device, electronic terminal and storage medium for generating a calling code. The method for generating a calling code includes: in response to a generation instruction, pulling original data of a first interface corresponding to a current project from an interface management platform, and processing the original data into first data that conforms to a preset format; based on the type of the generation instruction, generating a calling code for the first interface according to the first data and a preset template; wherein the preset template is generated based on an attribute field included in a preset format.

[0015] By presetting the format that the original data of the interface needs to be processed into (i.e., the preset format), and pre-generating a template for generating the call code according to the attribute fields contained in the preset format (i.e., the preset template), when receiving the generation instruction, the original data of the first interface corresponding to the current project can be first pulled from the interface management platform, and processed into the first data that conforms to the preset format; then, based on different types of generation instructions, the first interface call code can be generated according to the first data and the preset template using a generation method corresponding to the type. In this way, the call code of the interface corresponding to the current project can be automatically generated in different generation scenarios, which reduces the development cost, improves the development efficiency and the development experience of developers. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a flowchart of a method for generating a calling code provided in the first embodiment of the present invention;

[0017] Figure 2 It is a flowchart of a method for generating a calling code provided in Embodiment 2 of the present invention;

[0018] Figure 3 It is a flowchart of another method for generating a calling code provided in Embodiment 2 of the present invention;

[0019] Figure 4 It is a schematic diagram of the processing flow of each module of the generation tool in a method for generating a calling code provided in the second embodiment of the present invention;

[0020] Figure 5 It is a flowchart of data comparison in a method for generating a calling code provided in Embodiment 3 of the present invention;

[0021] Figure 6 It is a structural diagram of a device for generating a calling code provided in Embodiment 5 of the present invention;

[0022] Figure 7 It is a structural schematic diagram of an electronic terminal provided in Embodiment 6 of the present invention. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described through implementation methods with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. In the following embodiments, each embodiment provides optional features and examples at the same time. The various features recorded in the embodiments can be combined to form multiple optional solutions. Each numbered embodiment should not be regarded as only one technical solution.

[0024] Embodiment 1

[0025] Figure 1 It is a flowchart of a method for generating a call code provided in the first embodiment of the present invention. This embodiment can be applied to the case of generating the call code of the interface, for example, it is applicable to the case of incrementally updating the call code of the interface corresponding to the project after the interface required by the project changes. The method can be executed by the call code generation device provided in the embodiment of the present invention, which can be implemented in software and / or hardware, and can be configured in an electronic terminal, for example, installed in a development terminal such as a computer.

[0026] See also Figure 1 The method for generating a calling code provided in this embodiment includes the following steps:

[0027] S110 . In response to a generation instruction, original data of a first interface corresponding to a current project is pulled from an interface management platform, and the original data is processed into first data conforming to a preset format.

[0028] In the embodiment of the present invention, the generation device for executing the call code generation method provided in the embodiment of the present invention can be integrated into the generation tool. When the developer uses the development terminal to develop a software project, a front-end project (also called a local project) can be created in the development terminal; the generation tool can be installed in the front-end project in the form of an NPM package; and a back-end interface document project corresponding to the front-end project can be created on the interface management platform, and the project identifier, the API required by the project and other information in the back-end interface document project can be configured.

[0029] After the backend interface document project configuration is completed, the initialized generation tool can be run. The step of obtaining the original data of the first interface through the generation tool may include: first, searching the interface management platform for a backend interface document project with the same project identifier as the frontend project; then, based on the identification information (such as the interface identifier) ​​of at least one first interface currently required by the project recorded in the found backend interface document project; finally, pulling the original data of at least one first interface corresponding to the identification information from the interface management platform. This enables pulling the original data of the first interface corresponding to the current project from the interface management platform.

[0030] The interface management platform can store and manage API documents used for project development, and the API documents can include description information of the API. Accordingly, the raw data of at least one first interface pulled by the generation tool can be considered as the description information in the API document of at least one first interface pulled.

[0031] The description information of the API may include but is not limited to: the API interface identifier, interface name, calling method, calling path, parameter description and document related information. The interface identifier can be considered as a unique identifier of the interface that is computer-oriented, poorly readable, and composed of at least one of numbers, letters or symbols; the interface name can be considered as information that is human-oriented, well-readable, and composed of text and other information that summarizes the interface function; the calling method can be considered as the name of the method used to implement the interface function contained in the API; the calling path can be considered as the calling address of the API; the parameter description may include parameters such as the input / output parameters of the calling method, as well as information such as the format of each parameter; the document related information may include information such as the document maintainer, maintenance time, and the project to which the interface belongs.

[0032] Among them, the original data can be considered as data in text format. Since the text format is not conducive to computer processing, a format that is easy to be processed by a computer, that is, a preset format, can be pre-defined in the generation tool. Among them, the preset format is, for example, a format that can characterize a key-value relationship, such as an array or a variable assignment statement. Exemplarily, at least one attribute field can be set in the preset format as key information. For each first interface, by associating the description information of each part in its original data to the corresponding attribute field in the preset format as the value information corresponding to the key information, it is possible to process all the original data of at least one first interface into first data that conforms to the preset format.

[0033] S120. Based on the type of the generation instruction, generate a calling code of the first interface according to the first data and a preset template; wherein the preset template is generated based on an attribute field included in a preset format.

[0034] In the generation tool, a template for the calling code can also be generated in advance, and the template can be generated based on the core attribute fields in the preset format. Among them, the core attribute fields can be specifically set by the developer according to the specific development scenario. Exemplarily, the preset template is generated based on the core attribute fields in the preset format, and can include: generating a string template for the calling code containing placeholders, wherein each placeholder has a corresponding relationship with a core attribute field. In addition, the placeholders in the string template can be replaced by specific data, so that the calling code of the first interface can be generated according to the first data and the preset template.

[0035] The types of generation instructions may include, but are not limited to, new generation instructions and update instructions. Corresponding generation instructions may be triggered in different generation scenarios. For example, in the generation scenario of generating the calling code of the interface for the front-end project for the first time, the new generation instruction may be triggered; in the generation scenario of the calling code of the interface for the subsequent update of the front-end project, the update instruction may be triggered.

[0036] When different types of generation instructions are received, different generation methods can be used to generate the calling code of the first interface according to the first data and the preset template. For example, when the type of the generation instruction is a new creation instruction, the calling code of the first interface can be generated directly according to the first data and the preset template. When the type of the generation instruction is an update instruction, the calling code of the first interface can be generated directly according to the updated first data and the preset template; or, according to the updated first data, the preset template to which the data before the update has been assigned can be incrementally updated to generate the calling code of the first interface. Among them, the incremental update can be considered as updating only the different parts.

[0037] By pre-setting the format into which the original data of the interface needs to be processed (i.e., the preset format), and pre-generating a template for generating calling code based on the attribute fields contained in the preset format (i.e., the preset template), it is possible to automatically generate calling code for the interface corresponding to the current project in different generation scenarios, thereby reducing development costs and improving development efficiency and the development experience of developers.

[0038] In some optional implementations, the calling code of the first interface is written into a local file, so that the current project calls the first interface according to the local file.

[0039] After generating the call code of the interface required by the current project, the generation tool can also write the call code into a local file of the development terminal. For example, the call code of at least one first interface is written into at least one local file. The local file can be a file in a directory pre-specified by the developer. For example, if a function requires multiple first interfaces to support, the local files corresponding to the multiple first interfaces can be specified in the same directory corresponding to the function.

[0040] In these optional implementations, by writing the calling code into a local file, when an interface call is made in the current project, the first interface corresponding to the local file can be called by calling the local file.

[0041] A method for generating a calling code provided by an embodiment of the present invention, in response to a generation instruction, pulls original data of a first interface corresponding to a current project from an interface management platform, and processes the original data into first data that conforms to a preset format; based on the type of the generation instruction, generates a calling code for the first interface according to the first data and a preset template; wherein the preset template is generated based on attribute fields contained in a preset format.

[0042] By presetting the format that the original data of the interface needs to be processed into (i.e., the preset format), and pre-generating a template for generating the call code according to the attribute fields contained in the preset format (i.e., the preset template), when receiving the generation instruction, the original data of the first interface corresponding to the current project can be first pulled from the interface management platform, and processed into the first data that conforms to the preset format; then, based on different types of generation instructions, the first interface call code can be generated according to the first data and the preset template using a generation method corresponding to the type. In this way, the call code of the interface corresponding to the current project can be automatically generated in different generation scenarios, which reduces the development cost, improves the development efficiency and the development experience of developers.

[0043] Embodiment 2

[0044] The method for generating the call code provided in this embodiment can be combined with the various optional schemes in the method for generating the call code provided in the above embodiments. The method for generating the call code provided in this embodiment describes in detail the steps of generating the call code according to different types of generation instructions. It can be achieved that when the type of the generation instruction is a new creation instruction, the preset template can be directly assigned according to the first data to generate the call code. It can also be achieved that when the type of the generation instruction is an update instruction, the first data and the second data corresponding to the project before the update can be compared, and the places that need to be updated can be incrementally updated according to the comparison results and the preset template to generate the call code. Thereby, it is possible to generate the call code of the interface corresponding to the current project in different generation scenarios using different generation methods, making the method of generating the call code more flexible, improving the development efficiency and the development experience of developers.

[0045] Figure 2 Schematic diagram of a method for generating a calling code provided by Embodiment 2 of the present invention. Figure 2 The method for generating a calling code provided in this embodiment, wherein the type of instruction generated is a new instruction, comprises the following steps:

[0046] S210. In response to a new creation instruction, original data of a first interface corresponding to a current project is pulled from an interface management platform, and the original data is processed into first data conforming to a preset format.

[0047] The new creation instruction may be an instruction input to the generation tool by the developer after creating the front-end project (i.e., the current project) and configuring the back-end interface document project on the interface management platform. The generation tool may, according to the new creation instruction, go to the interface management platform to pull the original data of the first interface corresponding to the current project, and process the original data into the first data conforming to the preset format.

[0048] S220. Based on the data of the attribute field in the first data, assign a value to a template field in the preset template corresponding to the attribute field, and generate a calling code for the first interface.

[0049] When the type of the generated instruction is a new instruction, it can be considered that the calling code of the first interface corresponding to the current project is created for the first time. Since the first data conforms to the preset format, and the preset template is generated based on the attribute fields contained in the preset format, the data required to be assigned to the template fields in the preset template can be considered to be included in the data corresponding to the attribute fields of the first data. By directly assigning values ​​to the template fields corresponding to the attribute fields in the preset template according to the data in the attribute fields in the first data, the calling code of the first interface can be generated.

[0050] Exemplarily, assuming that the preset template is a string template of a calling code containing placeholders, wherein each placeholder has a corresponding relationship with a template field, and the template field is contained in an attribute field. Then, according to the data of the attribute field in the first data, the placeholder corresponding to the attribute field in the preset template can be directly assigned a value, thereby generating a string of the calling code of the first interface.

[0051] Figure 3 FIG. 1 is a flow chart of another method for generating a calling code provided by Embodiment 2 of the present invention. Figure 3 Another method for generating a calling code provided in this embodiment, wherein the type of the generated instruction is an update instruction, comprises the following steps:

[0052] S310. In response to an update instruction, original data of a first interface corresponding to a current project is pulled from an interface management platform, and the original data is processed into first data conforming to a preset format.

[0053] The update instruction may be an instruction input to the generation tool after the developer changes the API information required for the backend interface document project; or it may be an instruction automatically triggered when the generation tool detects a change in the configuration of the backend interface document project by periodically polling the configuration of the backend interface document project, or it may be an instruction to notify the user of the perceived change to prompt the user to input the update instruction. According to the update instruction, the generation tool may go to the interface management platform to pull the original data of the first interface corresponding to the updated current project, and process the original data into the first data conforming to the preset format.

[0054] S320, comparing the first data with the second data to obtain a comparison result; wherein the second data is obtained by parsing a calling code of a second interface corresponding to the project before the update in response to the update instruction.

[0055] While the generation tool determines the first data in response to the update instruction, it can also parse the calling code of the second interface corresponding to the project before the update in response to the update instruction to obtain the second data in a preset format. The calling code of the second interface corresponding to the project before the update can be obtained from the local file. The second interface corresponding to the project before the update can include at least one; accordingly, by parsing the calling code of the second interface, at least one second data in a preset format can be obtained.

[0056] The process of parsing the call code can be regarded as the reverse process of generating the call code. Exemplarily, by extracting the data with the placeholder position in the call code string and assigning the extracted data to the attribute field contained in the preset format corresponding to the placeholder, the call code of the second interface can be parsed into the second data conforming to the preset format.

[0057] The first data corresponds to at least one first interface corresponding to the current project (i.e., the updated project), the second data corresponds to at least one second interface corresponding to the project before the update, and both the first data and the second data conform to a preset format. The first data and the second data are compared by comparing the data of the same attribute field in the first data with the data in the second data according to the attribute field included in the preset format.

[0058] By comparing the first data with the second data, it is possible to compare the unchanged interfaces, modified interfaces, and deleted interfaces in at least one second interface compared to at least one first interface. Also, it is possible to compare the newly added interfaces in at least one first interface. Furthermore, the specific data of the unchanged interfaces, modified interfaces, and deleted interfaces in the second interface, as well as the newly added interfaces in the first interface, can be used as comparison results.

[0059] S330: incrementally update the calling code of the second interface according to the comparison result and the preset template to generate the calling code of the first interface.

[0060] Among them, based on the comparison results and the preset template, the calling code of the second interface is incrementally updated, which can include: for the interface that has not changed in the second interface, the calling code of the second interface is not changed; for the interface that has been modified / deleted in the second interface, the preset template that is assigned the data of the modified / deleted interface is modified / deleted accordingly to update the calling code of the second interface; for the newly added interface in the first interface, the data of the newly added interface is assigned to the preset template to generate a new calling code.

[0061] When the type of the generated instruction is an update instruction, it can be considered that the generated call code of the second interface is updated. By performing incremental updates based on the comparison results instead of completely deleting the original call code of the second interface and regenerating all the call codes of the first interface, the generation time of the call code can be reduced to a certain extent, and the generation efficiency can be improved.

[0062] For example, Figure 4 Schematic diagram of the processing flow of each module of the generation tool in a method for generating a calling code provided in the second embodiment of the present invention. Figure 4,The generation tools may include but are not limited to: a login module, a data acquisition module, a data processing module, a generation module, a writing module, a parsing module and a comparison module.

[0063] When the generated instruction is a new instruction, the processing flow may include:

[0064] The generation tool logs in to the interface management platform through the login module; in response to the new creation instruction, the original data of the first interface corresponding to the current project is pulled from the interface management platform through the data acquisition module; the original data is processed into first data that conforms to a preset format through the data processing module; through the generation module, based on the data of the attribute field in the first data, the template field corresponding to the attribute field in the preset template is assigned to generate a character string of the calling code of the first interface; through the writing module, the received character string of the calling code is written into the local file, so that the current project calls the first interface according to the local file.

[0065] When the generated instruction is an update instruction, the processing flow may include:

[0066] The generation tool logs in to the interface management platform through the login module; in response to the newly added instruction, the original data of the first interface corresponding to the current project is pulled from the interface management platform through the data acquisition module; and the call code of the second interface corresponding to the project before the update is parsed through the parsing module to obtain the second data conforming to the preset format;

[0067] The original data is processed into first data that conforms to a preset format through a data processing module; the first data is compared with the second data through a comparison module to obtain a comparison result; the calling code of the second interface is incrementally updated according to the comparison result and a preset template through a generation module to generate a character string of the calling code of the first interface; the received calling code character string is written into a local file through a writing module, so that the current project calls the first interface according to the local file.

[0068] It is worth noting that Figure 4 The processing flow shown is only an exemplary flow. In some optional implementations, when the generation instruction is a new creation instruction, after the first data is obtained by processing the data processing module, it may also include: inputting the first data into the comparison module. At this time, since the second data is empty, the comparison result output by the comparison module can be a newly added identifier and the first data corresponding to the newly added identifier. Correspondingly, the generation module can receive the comparison result input by the comparison module, and generate a character string of the calling code of the first interface according to the newly added identifier and the first data corresponding to the newly added identifier.

[0069] It can be considered that the division of modules and the division of operations performed by modules in this embodiment are merely exemplary descriptions, and other feasible module division methods and division methods of operations performed by modules all fall within the protection scope of the embodiments of the present invention.

[0070] The method for generating call code provided in an embodiment of the present invention describes in detail the steps of generating call code according to different types of generation instructions. When the type of the generation instruction is a new creation instruction, the preset template can be directly assigned according to the first data to generate the call code. It can also be achieved that when the type of the generation instruction is an update instruction, the first data and the second data corresponding to the project before the update can be compared, and the places that need to be updated can be incrementally updated according to the comparison results and the preset template to generate the call code. Thereby, it is possible to generate the call code of the interface corresponding to the current project using different generation methods in different generation scenarios, making the method of generating the call code more flexible, and improving the development efficiency and the development experience of developers.

[0071] In addition, the method for generating the calling code provided in this embodiment and the method for generating the calling code provided in the above embodiment belong to the same technical concept. The technical details not described in detail in this embodiment can be referred to the above embodiment, and the same technical features have the same beneficial effects in this embodiment and the above embodiment.

[0072] Embodiment 3

[0073] The method for generating the call code provided in this embodiment can be combined with the various optional solutions in the method for generating the call code provided in the above embodiments. The method for generating the call code provided in this embodiment describes in detail the comparison process of the first data and the second data when the type of the generated instruction is an update instruction, and the process of generating the call code according to the comparison result and the preset template.

[0074] In some optional implementations, comparing the first data with the second data to obtain a comparison result includes:

[0075] S1. traverse the first data, and compare the data of the target field in the currently traversed first data with the data of the target field in the second data according to the priority order of the target field in the attribute field.

[0076] Among them, since the first data is the data corresponding to at least one first interface, by traversing the first data, the first data of the first interface currently traversed can be compared with the second data corresponding to at least one second interface. Among them, when comparing the data of a first interface with at least one second interface, it is possible to first determine whether the second interface contains the first interface. Among them, if the interface contained in the second interface is substantially the same as the first interface, that is, the functions implemented by the interfaces are the same, then it can be considered that the second interface contains the first interface. By determining that the two interfaces are substantially the same, it can be helpful to further determine whether the first interface contained in the second interface has been updated.

[0077] In different business scenarios, different factors can be combined to make a substantive judgment of the same interface. In the process of developing the generation tool, the target field that can be used to characterize the essence of the interface can be selected from the attribute field in advance according to the specific business scenario, and the comparison priority of the target field can be defined inside the generation tool. Furthermore, the generation tool can compare the data of the target field in the first data currently traversed with the data of the target field in the second data according to the priority order of the target field to determine whether the first interface currently traversed is included in the second interface.

[0078] S2. According to the comparison result, determine whether the interface represented by the first data currently traversed is included in the interface represented by the second data.

[0079] Among them, according to the comparison results, it is judged whether the interface represented by the first data currently traversed is included in the interface represented by the second data. It is not that the first interface currently traversed is considered to be included in the second interface only when the data of each target field is matched and consistent, but the comparison results of each target field are comprehensively considered to judge whether the first interface currently traversed is included in the second interface.

[0080] For example, assuming that the target fields are in the following order from high to low priority: interface identifier, calling method and calling path, interface name. When the interface identifiers of the first interface currently traversed are consistent with those of an interface in the second interface, it is highly likely that the two interfaces are substantially the same; unless the calling method, calling path, and interface name are all different, then the two interfaces are judged to be substantially different.

[0081] In addition, when the interface management platform uniformly re-imports the interface documents, the interface identifiers of all interfaces may change. In this case, although the interface identifiers of the first interface currently traversed are inconsistent with those of the interfaces in the second interface, if it is further determined that the first interface currently traversed is consistent with a certain interface call method and call path in the second interface, and / or the interface name is consistent, it can also be determined that the two interfaces are essentially the same.

[0082] S3. If not, determine the first data currently traversed as the newly added data.

[0083] If the interface represented by the currently traversed first data is not included in the interface represented by the second data, the interface represented by the currently traversed first data can be considered as a newly added interface, and the currently traversed first data can be determined as the newly added data.

[0084] S4. If so, the data contained in the second data representing the same interface as the currently traversed first data is taken as the target data; the data of the target field in the currently traversed first data and the target field different from the data of the target field in the target data are taken as the difference field; the data of the difference field in the currently traversed first data is determined as the modified data.

[0085] If the interface represented by the currently traversed first data is included in the interface represented by the second data, the data of the same interface represented by the currently traversed first data contained in the second data is used as the target data. The target field with different data in the target data and the target data is used as the difference field. The data in the difference field in the target data is determined as the data of the currently traversed first interface before modification; the data in the difference field in the currently traversed first data is determined as the data of the currently traversed first interface after modification.

[0086] S5. When the traversal of the first data is completed, the data corresponding to the interfaces other than the interface represented by the first data contained in the second data is determined as deleted data.

[0087] If the second data also contains data corresponding to other interfaces besides the interface represented by the first data when the first data traversal is completed, the data corresponding to the other interfaces can be determined as deleted data. It can be considered that the updated current project does not need to call the calling codes corresponding to the other interfaces.

[0088] For example, Figure 5 1 is a flow chart of data comparison in a method for generating a calling code provided in Embodiment 3 of the present invention. Figure 5 , the comparison branches can be referred to as branch 1, branch 2, ..., branch 9 from left to right.

[0089] For branch 1, when judging that the interface identifier of the first interface currently traversed is consistent with that of an interface in the second interface, auxiliary judgment can be made by comparing the modification time of the interface in the backend interface document project. When the modification time of the two interfaces is also the same, it can be considered that the two interfaces are essentially the same and no modification has occurred, that is, the two interfaces are exactly the same.

[0090] For branches 2 to 5, when it is determined that the interface identifier of the first interface currently traversed is consistent with that of a certain interface in the second interface, but the modification time of the two interfaces in the backend interface document project is different, the calling method and the calling path can be further compared. When the calling method and the calling path are the same, the two interfaces can be considered to be essentially the same, and when it is further determined in branch 2 that the parameters of the calling method are the same, it can be considered that the two interfaces have not been modified, that is, the two interfaces are exactly the same; when it is further determined in branch 3 that the parameters of the calling method are different, it can be considered that the parameters in the calling method have been modified. When there is any difference between the calling method and the calling path, the interface names can be further compared to see if they are the same. In branch 4, when the interface names are the same, it can be considered that the two interfaces are essentially the same, but the calling method and / or the calling path have been modified; in branch 5, when the interface names are also different, it can be considered that the two interfaces are completely different, and the first interface currently traversed is a newly added interface.

[0091] For branches 6 to 9, when it is determined that the interface identifiers of the first interface currently traversed are inconsistent with those of the interfaces in the second interface, the calling method and the calling path can be further compared. When the calling method and the calling path are the same, the two interfaces can be considered to be substantially the same, and when it is further determined in branch 6 that the parameters of the calling method are the same, it can be considered that the interface identifiers of the two interfaces have been modified; when it is further determined in branch 7 that the parameters of the calling method are different, it can be considered that the interface identifiers of the two interfaces and the parameters in the calling method have been modified. When there is any difference between the calling method and the calling path, the interface names can be further compared to see if they are the same. In branch 8, when the interface names are the same, it can be considered that the two interfaces are substantially the same, but the interface identifiers, calling methods and / or calling paths have been modified; in branch 9, when the interface names are also different, it can be considered that the two interfaces are completely different, and the first interface currently traversed is a newly added interface.

[0092] In these optional implementations, by comparing the target fields in the first data and the second data in turn according to the priority order of the target fields in the attribute field, it is possible to determine whether the interface represented by the first data is included in the interface represented by the second data; if yes, the data that needs to be modified in the preset template can be determined; if not, the data that needs to be added in the preset template can be determined; and if the second data contains data of other interfaces except the interface represented by the first data, the data corresponding to the other interfaces can be determined as the data that needs to be deleted in the preset template. In this way, the data that needs to be incrementally modified in the preset template can be determined, that is, the comparison result can be obtained.

[0093] In some optional implementations, the comparison result includes a comparison mark and comparison data corresponding to the comparison mark, wherein the comparison mark may include but is not limited to an identical mark, a new mark, a deleted mark, and a modified mark.

[0094] If the comparison result is that the target data in the second data is the same as each target field in the first data currently being traversed, the same identifier can be set for the target data and the first data currently being traversed. At this time, the target data and the first data currently being traversed can be considered as comparison data corresponding to the same identifier.

[0095] If the comparison result is that the target data in the second data has a difference field with the first data currently traversed, a modification flag can be set for the difference field in the target data and the first data currently traversed. At this time, the data in the difference field in the target data can be considered as the data before the difference field is modified; the data in the difference field in the first data currently traversed can be considered as the data after the difference field is modified; and the data in the difference field in the target data and the first data currently traversed can be considered as the comparison data corresponding to the modification flag.

[0096] If the comparison result shows that the interface represented by the currently traversed first data is not included in the interface represented by the second data, a new identifier can be set for the currently traversed first data. In this case, the currently traversed first data is the comparison data corresponding to the new identifier.

[0097] If the comparison result is data corresponding to other interfaces in the second data except the interface represented by the first data, a deletion mark can be set for the data of other interfaces. In this case, the data of other interfaces in the second data is the comparison data corresponding to the deletion mark.

[0098] Correspondingly, based on the comparison results and the preset template, the calling code of the second interface is incrementally updated to generate the calling code of the first interface, including: based on the comparison identifier, the comparison data corresponding to the comparison identifier, and the preset template, the calling code of the second interface is incrementally updated to generate the calling code of the first interface.

[0099] If the comparison identifier is a newly added identifier, a calling code of the newly added interface is generated according to the first data corresponding to the newly added identifier and the preset template; the calling code of the newly added interface and the calling code of the second interface are used as the calling code of the first interface. Based on the data of the attribute field in the first data corresponding to the newly added identifier, the template field corresponding to the attribute field in the preset template is assigned a value to generate the calling code of the newly added interface.

[0100] Wherein, if the comparison identifier is a modification identifier, the preset template assigned with the second data corresponding to the modification identifier is modified according to the first data corresponding to the modification identifier to obtain the modified calling code of the second interface; the modified calling code of the second interface is used as the calling code of the first interface. Wherein, based on the data of the difference field in the first data corresponding to the modification identifier, the preset template assigned with the data of the difference field in the second data corresponding to the modification identifier is replaced to obtain the modified calling code of the second interface.

[0101] Among them, if the comparison identifier is a deletion identifier, the preset template that has been assigned the second data corresponding to the deletion identifier is deleted to obtain the calling code of the deleted second interface; the calling code of the deleted second interface is used as the calling code of the first interface.

[0102] In addition, if the comparison identifier is the same identifier, the call code of the second interface may not be updated. Moreover, the generation tool can also generate a prompt message based on the comparison result before incrementally updating the call code of the second interface according to the comparison result and the preset template, to prompt the user whether to agree to incrementally update the call code of the second interface according to the comparison result. For example, before adding, modifying, or deleting the call code of the second interface, a prompt message is generated to prompt the user whether to agree to update the call code of the second interface, such as adding, modifying, or deleting. Thereby, unnecessary call code updates caused by misoperation can be avoided to a certain extent, and the development experience of developers can be further improved.

[0103] In these optional implementations, based on comparison identifiers and comparison data, unchanged parts of the calling code of the second interface can be reused in situ, and changed parts can be incrementally replaced, thereby improving the updating efficiency of the calling code to a certain extent.

[0104] In these optional implementations, it is possible to incrementally update the calling code according to the comparison identifier contained in the comparison result, the comparison data corresponding to the comparison identifier, and the preset template. For example, the calling code can be added according to the first data corresponding to the new identifier and the preset template; the second data assigned in the preset template can be modified according to the first data corresponding to the modification identifier to modify the calling code; and the preset template of the assigned second data can be deleted according to the second data corresponding to the deletion identifier. Therefore, when updating the interface corresponding to the project, there is no need to make a full change to the interface of the project, but only to incrementally update the calling code according to the comparison result, thereby improving development efficiency.

[0105] The method for generating a calling code provided by an embodiment of the present invention describes in detail the comparison process of the first data and the second data, and the process of generating a calling code according to the comparison result and the preset template. By comparing the target fields in the first data and the second data in turn according to the priority order of the target fields in the attribute field, it is possible to determine whether the interface represented by the first data is included in the interface represented by the second data; if so, the data that needs to be modified in the preset template can be determined; if not, the data that needs to be added to the preset template can be determined; and if the second data contains data of other interfaces except the interface represented by the first data, the data corresponding to the other interfaces can be determined as the data that needs to be deleted in the preset template. In this way, the data that needs to be incrementally modified in the preset template can be determined, and the comparison result can be obtained.

[0106] In addition, by using the comparison identifiers contained in the comparison results, the comparison data corresponding to the comparison identifiers, and the preset templates, when updating the interface corresponding to the project, there is no need to make complete changes to the project interface. Instead, only the calling code needs to be incrementally updated based on the comparison results, thereby improving development efficiency.

[0107] The method for generating the calling code provided in this embodiment and the method for generating the calling code provided in the above embodiment belong to the same technical concept. The technical details not fully described in this embodiment can be referred to the above embodiment, and the same technical features have the same beneficial effects in this embodiment and the above embodiment.

[0108] Embodiment 4

[0109] The method for generating the calling code provided in this embodiment can be combined with the various optional solutions in the method for generating the calling code provided in the above embodiments. The method for generating the calling code provided in this embodiment describes in detail the code prompt information for generating the calling code.

[0110] In some optional implementations, the preset template includes an annotated code block; accordingly, based on the first data and the preset template, the calling code of the first interface is generated, including: based on the first data and the annotated code block, generating code prompt information corresponding to the calling code of the first interface; wherein the code prompt information is displayed in response to the call of the first interface.

[0111] In addition to the template for generating the calling code, the preset template may also include an annotation code block. The annotation code block may be a code block for annotating the calling code using JS Doc. The code prompt information generated using the annotation code block may include, but is not limited to, the calling method in the calling code, the input / output parameters of the calling method, and the format of each parameter.

[0112] If the type of the generated instruction is a new instruction, the annotation code block can be used to extract data of the attribute field corresponding to the code prompt information to be generated in the first data to generate code prompt information corresponding to the calling code of the first interface.

[0113] Among them, if the type of the generated instruction is an update instruction, the data of the attribute field corresponding to the code prompt information to be generated in the first data and the second data can be compared first; then the existing code prompt information can be incrementally updated according to the comparison result. For example, if the input parameter of a calling method has not changed, but the output parameter has changed, the annotation of the input parameter part of the calling method in the original code prompt information can be left unchanged, and only the annotation of the output parameter part of the calling method in the original code prompt information can be changed to incrementally update the code prompt information corresponding to the calling code.

[0114] By setting the annotation code block in the preset template, code prompt information corresponding to the calling code can be generated. Furthermore, when the development terminal calls the calling code of the first interface, the first interface currently called can be intelligently prompted according to the code prompt information, thereby improving the development experience of developers.

[0115] In these optional implementations, by setting an annotation code block in the preset template, code prompt information of the calling code can be generated while generating the calling code according to the first data and the preset template, thereby realizing intelligent code prompting.

[0116] The method for generating a calling code provided in an embodiment of the present invention describes in detail the code prompt information for generating the calling code. By setting an annotation code block in a preset template, it is possible to generate code prompt information for the calling code while generating the calling code according to the first data and the preset template, thereby realizing intelligent code prompting. The method for generating a calling code provided in this embodiment and the method for generating a calling code provided in the above embodiment belong to the same technical concept, and the technical details not described in detail in this embodiment can be referred to the above embodiment, and the same technical features have the same beneficial effects in this embodiment and in the above embodiment.

[0117] Embodiment 5

[0118] Figure 6 This is a schematic diagram of a structure of a device for generating a calling code provided by Embodiment 5 of the present invention. This embodiment is applicable to generating calling codes of interfaces, for example, to incrementally update calling codes of interfaces corresponding to a project after the interfaces required by the project are changed.

[0119] See also Figure 6 The device for generating a calling code provided by the present invention comprises:

[0120] The acquisition processing module 610 is used to pull the original data of the first interface corresponding to the current project from the interface management platform in response to the generation instruction, and process the original data into the first data conforming to the preset format;

[0121] The generation module 620 is used to generate the calling code of the first interface based on the type of the generation instruction, according to the first data and the preset template; wherein the preset template is generated based on the attribute field included in the preset format.

[0122] In some optional implementations, if the type of the generated instruction is a new instruction, the generation module can be used to: assign values ​​to template fields corresponding to the attribute fields in the preset template based on the data of the attribute fields in the first data, and generate calling code for the first interface.

[0123] In some optional implementations, if the type of the generated instruction is an update instruction, the generation module may be used to:

[0124] Comparing the first data with the second data to obtain a comparison result; wherein the second data is obtained by obtaining the processing module in response to the update instruction and parsing the calling code of the second interface corresponding to the project before the update;

[0125] According to the comparison result and the preset template, the calling code of the second interface is incrementally updated to generate the calling code of the first interface.

[0126] In some optional implementations, the generating module includes:

[0127] A comparison unit is used to traverse the first data, and compare the data of the target field in the currently traversed first data with the data of the target field in the second data according to the priority order of the target field in the attribute field; based on the comparison result, it is determined whether the interface represented by the currently traversed first data is included in the interface represented by the second data; if not, the currently traversed first data is determined as newly added data; if so, the data contained in the second data with the same interface represented by the currently traversed first data is used as the target data; the target field of the target field in the currently traversed first data and the target field different from the data of the target field in the target data are used as the difference field; the data of the difference field in the currently traversed first data is determined as the modified data; when the traversal of the first data is completed, the data corresponding to other interfaces contained in the second data except the interface represented by the first data is determined as deleted data.

[0128] In some optional implementations, the comparison result includes a comparison identifier and comparison data corresponding to the comparison identifier;

[0129] Accordingly, the generated modules include:

[0130] A generating unit is used to incrementally update the calling code of the second interface according to the comparison identifier, the comparison data corresponding to the comparison identifier, and a preset template to generate the calling code of the first interface.

[0131] In some optional implementations, the preset template includes an annotated code block; accordingly, the generation module is also used to: generate code prompt information corresponding to the calling code of the first interface based on the first data and the annotated code block; wherein the code prompt information is displayed in response to the call of the first interface.

[0132] In some optional implementations, the generating device further includes:

[0133] The writing module is used to write the calling code of the first interface into a local file, so that the current project calls the first interface according to the local file.

[0134] The device for generating the calling code provided in the embodiment of the present invention can execute the method for generating the calling code provided in the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail, please refer to the method for generating the calling code provided in the embodiment of the present invention.

[0135] Embodiment 6

[0136] Figure 7 It is a structural schematic diagram of an electronic terminal provided in Embodiment 6 of the present invention. Figure 7 A block diagram of an exemplary electronic terminal 12 suitable for use in implementing embodiments of the present invention is shown. Figure 7 The electronic terminal 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention. The device 12 is typically an electronic terminal that undertakes the function of generating the calling code.

[0137] like Figure 7 As shown, the electronic terminal 12 is in the form of a general purpose computing device. The components of the electronic terminal 12 may include, but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 connecting different components (including the memory 28 and the processing unit 16).

[0138] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. For example, these architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.

[0139] The electronic terminal 12 typically includes a variety of computer readable media. These media can be any available media that can be accessed by the electronic terminal 12, including volatile and non-volatile media, removable and non-removable media.

[0140] The memory 28 may include computer device readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic terminal 12 may further include other removable / non-removable, volatile / non-volatile computer storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 7 not shown, usually called a "hard drive"). Although Figure 7 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a read-only optical disk (Compact Disc-Read Only Memory, CD-ROM), a digital video disk (Digital Video Disc-Read Only Memory, DVD-ROM) or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product 40, which has a set of program modules 42, which are configured to perform the functions of various embodiments of the present invention. The program product 40 may be stored in, for example, the memory 28, such program modules 42 include but are not limited to one or more sub-applications, other program modules and program data, each of which or some combination may include the implementation of a network environment. The program module 42 generally performs the functions and / or methods in the embodiments described in the present invention.

[0141] The electronic terminal 12 may also communicate with one or more external devices 14 (e.g., keyboard, mouse, camera, etc., and display), one or more devices that enable a user to interact with the electronic terminal 12, and / or any device that enables the electronic terminal 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 22. In addition, the electronic terminal 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic terminal 12 through a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic terminal 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (Redundant Arrays of Independent Disks, RAID) devices, tape drives, and data backup storage devices.

[0142] The processor 16 executes various functional applications and data processing by running the program stored in the memory 28, for example, the method for generating the calling code provided in the above embodiment of the present invention includes:

[0143] In response to a generation instruction, original data of a first interface corresponding to a current project is pulled from an interface management platform, and the original data is processed into first data conforming to a preset format; based on the type of generation instruction, a calling code of the first interface is generated according to the first data and a preset template; wherein the preset template is generated based on attribute fields contained in a preset format.

[0144] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the method for generating the calling code provided in the embodiment of the present invention.

[0145] Embodiment 7

[0146] Embodiment 7 of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for generating a calling code provided in the embodiment of the present invention is implemented. The method includes:

[0147] In response to a generation instruction, original data of a first interface corresponding to a current project is pulled from an interface management platform, and the original data is processed into first data conforming to a preset format; based on the type of generation instruction, a calling code of the first interface is generated according to the first data and a preset template; wherein the preset template is generated based on attribute fields contained in a preset format.

[0148] Of course, the computer program stored on the computer-readable storage medium provided by the embodiment of the present invention is not limited to the above method operation, and can also execute the method for generating the calling code provided by the embodiment of the present invention.

[0149] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor device, device or component, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution device, a device or a device or used in combination with it.

[0150] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution device, apparatus, or device.

[0151] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0152] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0153] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for generating a calling code, characterized in that: include: In response to the generation instruction, original data of the first interface corresponding to the current project is pulled from the interface management platform, and the original data is processed into first data conforming to a preset format; wherein the original data of the first interface is description information in the API document of the first interface; Based on the type of the generation instruction, generating the calling code of the first interface according to the first data and a preset template; wherein the preset template is generated based on the attribute field included in the preset format; If the type of the generating instruction is an updating instruction, then generating the calling code of the first interface according to the first data and the preset template includes: Comparing the first data with the second data to obtain a comparison result; wherein the second data is obtained by parsing a calling code of a second interface corresponding to the project before the update in response to the update instruction; Incrementally updating the calling code of the second interface according to the comparison result and the preset template to generate the calling code of the first interface, rather than regenerating all the calling codes of the first interface; Among them, the calling code of the second interface is incrementally updated according to the comparison result and the preset template, including: for the interface that has not changed in the second interface, the calling code of the second interface is not changed; for the interface that has been modified or deleted in the second interface, the preset template that assigns the data of the modified or deleted interface is modified or deleted accordingly to update the calling code of the second interface; for the newly added interface in the first interface, the data of the newly added interface is assigned to the preset template to generate a new calling code.

2. The method according to claim 1, characterized in that If the type of the generating instruction is a new generating instruction, the generating of the calling code of the first interface according to the first data and the preset template includes: Based on the data of the attribute field in the first data, a template field in a preset template corresponding to the attribute field is assigned a value to generate a calling code for the first interface.

3. The method according to claim 1, characterized in that The comparing the first data with the second data to obtain a comparison result includes: Traversing the first data, and comparing the data of the target field in the currently traversed first data with the data of the target field in the second data according to the priority order of the target fields in the attribute fields; According to the comparison result, determining whether the interface represented by the first data currently traversed is included in the interface represented by the second data; If not, the first data currently traversed is determined as the newly added data; If yes, the data of the second data that represents the same interface as the first data currently traversed is used as the target data; the data of the target field in the first data currently traversed and the target field that is different from the data of the target field in the target data are used as the difference field; the data of the difference field in the first data currently traversed is determined as the modified data; When the traversal of the first data is completed, data corresponding to other interfaces contained in the second data except the interface represented by the first data is determined as deleted data.

4. The method according to claim 1, characterized in that The comparison result includes a comparison mark and comparison data corresponding to the comparison mark; Correspondingly, the incrementally updating the calling code of the second interface according to the comparison result and the preset template to generate the calling code of the first interface includes: According to the comparison identifier, the comparison data corresponding to the comparison identifier, and the preset template, the calling code of the second interface is incrementally updated to generate the calling code of the first interface.

5. The method according to claim 1, characterized in that The preset template includes an annotated code block; accordingly, generating the calling code of the first interface according to the first data and the preset template includes: According to the first data and the annotated code block, code prompt information corresponding to the calling code of the first interface is generated; wherein the code prompt information is displayed in response to the calling of the first interface.

6. The method according to claim 1, characterized in that Also includes: The calling code of the first interface is written into a local file, so that the current project calls the first interface according to the local file.

7. A device for generating a calling code, characterized in that: include: an acquisition processing module, configured to, in response to a generation instruction, pull original data of a first interface corresponding to a current project from an interface management platform, and process the original data into first data conforming to a preset format; wherein the original data of the first interface is description information in an API document of the first interface; A generating module, configured to generate a calling code of the first interface based on the type of the generating instruction, according to the first data and a preset template; wherein the preset template is generated based on the attribute field included in the preset format; Wherein, if the type of the generation instruction is an update instruction, the generation module is specifically used for: Comparing the first data with the second data to obtain a comparison result; wherein the second data is obtained by parsing the calling code of the second interface corresponding to the project before the update in response to the update instruction; incrementally updating the calling code of the second interface according to the comparison result and a preset template to generate the calling code of the first interface, rather than regenerating all the calling codes of the first interface; Among them, the calling code of the second interface is incrementally updated according to the comparison result and the preset template, including: for the interface that has not changed in the second interface, the calling code of the second interface is not changed; for the interface that has been modified or deleted in the second interface, the preset template that assigns the data of the modified or deleted interface is modified or deleted accordingly to update the calling code of the second interface; for the newly added interface in the first interface, the data of the newly added interface is assigned to the preset template to generate a new calling code.

8. An electronic terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method for generating a calling code as described in any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for generating a calling code as described in any one of claims 1 to 6 is implemented.