Standardized Service SDK Automated Generation Method and Related Equipment
By using a standardized service SDK automated generation method, and leveraging annotation processors and code generators to generate uniquely tagged data and code programs, the problem of inconsistent API documentation versions is solved, achieving uniformity and maintainability of API documentation and improving development efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA PING AN PROPERTY INSURANCE CO LTD
- Filing Date
- 2022-11-15
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, the development of service SDKs suffers from issues such as inconsistent API documentation versions, difficulties in maintenance and deployment, and the API documentation is prone to human error, resulting in a poor user experience for interfacing and secondary developers.
A standardized service SDK automated generation method is adopted. The annotation information in the API source code is obtained through a preset annotation processor, the uniquely marked data is generated and stored in a preset database, the packaging instruction is received, parsed and packaged, and the code program is generated using a code generator to achieve the uniformity and maintainability of API documentation.
It achieves uniformity and maintainability of API documentation versions, avoids multiple upload and download operations, improves development coordination and management efficiency, and ensures the stability and reliability of the development platform.
Smart Images

Figure CN115686475B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of collaborative development technology of service SDKs, and in particular to a standardized service SDK automated generation method and related equipment. Background Technology
[0002] Currently, most hybrid-developed client apps have many external service interfaces. For example, in the development of insurance business in financial scenarios, due to the complexity of insurance types and business projects, many external service interfaces need to be developed. The current development situation is that the client provides a large number of external methods, but the external service methods are not unified, and there are no comments indicating the function of the methods. In many cases, every time registration is repeated, it is necessary to re-publish them. However, many external methods are only known to a few people, relying on word of mouth, or maintaining a public API document for external method maintenance.
[0003] If API documentation is separate from the running code, regardless of whether it is presented in Word, Excel, or direct web page input, it is prone to problems such as numerous API documentation versions, difficulties in maintenance and release, inconsistencies between documentation descriptions and code functionality after code changes, and low reliability due to human error. This is extremely unfriendly to the interface parties and secondary developers. Therefore, in the current service SDK development process, there are inconsistent API documentation versions, which, after being modified multiple times by different developers, easily lead to difficulties in maintenance and release. Summary of the Invention
[0004] The purpose of this application is to propose a standardized service SDK automated generation method and related equipment, so as to provide a unified standard service SDK automated generation method for different platforms and ensure the uniformity and maintainability of API document versions.
[0005] To address the aforementioned technical problems, this application provides a method for automatically generating standardized service SDKs, employing the following technical solution:
[0006] A method for automatically generating standardized service SDKs includes the following steps:
[0007] According to the preset annotation processor, the annotation information in the API source code is obtained, wherein the annotation information refers to the annotation text that is pre-written to realize the automated deployment of the API source code and the generation of software development kits;
[0008] The method annotation descriptions in the API source code are filtered out from the annotation information, and the method annotation descriptions are used to generate unique identifier data according to the preset transcoding rules.
[0009] Store the uniquely marked data and the corresponding description object in a preset database;
[0010] Receive a packaging instruction issued to generate a software development kit corresponding to the target service, parse the packaging instruction, and obtain the parsing result;
[0011] Based on different preset packaging conditions and the parsing results, the software development kit is packaged and displayed on a preset development collaboration interface;
[0012] Based on the preset monitoring component, after detecting the extraction command issued in the development collaboration interface to obtain the software development kit corresponding to the target service, the code program corresponding to the software development kit is generated according to the preset code generator, and the code program is uploaded to the preset location for secondary developers to download and use.
[0013] Furthermore, the step of filtering out method annotation descriptions from the annotation information in the API source code and generating unique identifier data from the method annotation descriptions according to preset transcoding rules specifically includes:
[0014] Retrieve all method annotation descriptions from the filtered API source code;
[0015] Treat all the method annotations as a single object, perform serialization processing, and obtain the serialization result;
[0016] The serialization result is used as an input stream for MD5 value processing to obtain the MD5 value. The MD5 value is used as the unique identifier data, and a unique identifier is set for the MD5 value as the description object.
[0017] Furthermore, the step of storing the uniquely identified data and the corresponding description object in a preset database specifically includes:
[0018] The MD5 value is used as a hash value, and the description object is used as a hash object that matches the hash value. They are cached in pairs in the preset database. The description object can be named by concatenating the package name, class name, method name, and return value during development.
[0019] Furthermore, after the step of using the MD5 value as a hash value and the description object as a hash object matching the hash value, and caching them in pairs into the preset database, the method further includes:
[0020] Generate an auto-incrementing version number information corresponding to the MD5 value in the preset database;
[0021] Establish an association between the MD5 value, the description object, and the version number information, and set corresponding entry timestamps for the MD5 value, the description object, and the version number information respectively.
[0022] Furthermore, the packaging instruction issued to generate the software development kit (SDK) corresponding to the target service includes the packaging path of the SSD, and the step of receiving the packaging instruction to generate the SSD corresponding to the target service, parsing the packaging instruction, and obtaining the parsing result specifically includes:
[0023] After receiving the packaging instruction, the packaging instruction is parsed to obtain the packaging path.
[0024] Furthermore, the step of packaging the software development kit and displaying it on a preset development collaboration interface according to different preset packaging conditions and the parsing results specifically includes:
[0025] Based on the packaging path and the different packaging conditions, the auto-incrementing version number information corresponding to the MD5 value is displayed on the development collaboration interface, wherein the different packaging conditions refer to the different compression tools used during packaging.
[0026] Furthermore, the step of generating the code program corresponding to the software development kit according to the preset code generator specifically includes:
[0027] The general method protocol for the code generator is predefined;
[0028] Obtain the array of method calls corresponding to the target description object, wherein the array of method calls includes: method name, call parameters and return value;
[0029] The method call array is parsed to obtain the method name, call parameters, and return value;
[0030] The method name, calling parameters, and return value are used as input parameters of the general method protocol to call the code generator and generate the code program corresponding to the software development kit.
[0031] To address the aforementioned technical problems, this application also provides an automated generation device for standardized service SDKs, employing the following technical solution:
[0032] A standardized service SDK automated generation device includes:
[0033] The annotation information acquisition module is used to acquire annotation information in the API source code according to a preset annotation processor. The annotation information refers to the annotation text that is pre-written to realize the automated deployment of the API source code and the generation of software development kits.
[0034] The method annotation transcoding module is used to filter out the method annotation descriptions in the API source code from the annotation information, and generate uniquely tagged data from the method annotation descriptions according to preset transcoding rules;
[0035] An intermediate object storage module is used to store the uniquely marked data and the description object corresponding to the uniquely marked data into a preset database;
[0036] The packaging instruction parsing module is used to receive packaging instructions issued for generating a software development kit corresponding to the target service, parse the packaging instructions, and obtain the parsing results.
[0037] The packaging module is used to package the software development kit and display it on a preset development collaboration interface according to different preset packaging conditions and the parsing results.
[0038] The service SDK generation module is used to detect, based on a preset monitoring component, an extraction instruction issued in the development collaboration interface to obtain the software development kit corresponding to the target service, generate the code program corresponding to the software development kit according to a preset code generator, and upload the code program to a preset location for secondary developers to download and use.
[0039] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:
[0040] A computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the above-described standardized service SDK automated generation method.
[0041] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:
[0042] A computer-readable storage medium storing computer-readable instructions, which, when executed by a processor, implement the steps of the standardized service SDK automated generation method described above.
[0043] Compared with the prior art, the embodiments of this application have the following main advantages:
[0044] The standardized service SDK automated generation method described in this application embodiment obtains annotation information from API source code according to a preset annotation processor. The annotation information refers to pre-written annotation text for automating the deployment of the API source code and generating a software development kit (SDK). Method annotation descriptions from the API source code are selected from the annotation information, and uniquely tagged data is generated from the method annotation descriptions according to preset transcoding rules. The uniquely tagged data and the corresponding description objects are stored in a preset database. A packaging instruction for generating the SSD corresponding to the target service is received, and the packaging instruction is parsed to obtain a parsing result. The SSD is packaged and displayed on a preset development collaboration interface according to preset different packaging conditions and the parsing result. Based on a preset monitoring component, after detecting an extraction instruction issued in the development collaboration interface for obtaining the SSD corresponding to the target service, the code program corresponding to the SSD is generated according to a preset code generator, and the code program is uploaded to a preset location for secondary developers to download and use. This application uses an intermediate object, namely the description object, to achieve development coordination and management among multiple developers, avoiding multiple upload and download operations of the program source code. This ensures that secondary developers do not need to manipulate the API documentation during development, thus guaranteeing the uniformity and maintainability of the API documentation versions across the entire development platform. Attached Figure Description
[0045] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0047] Figure 2 A flowchart of an embodiment of the standardized service SDK automated generation method according to this application;
[0048] Figure 3 yes Figure 2 A flowchart of a specific implementation of step 202 shown;
[0049] Figure 4 yes Figure 2 A flowchart of a specific implementation of step 206 shown;
[0050] Figure 5 A schematic diagram of the structure of an embodiment of the standardized service SDK automated generation apparatus according to this application;
[0051] Figure 6 A schematic diagram of the structure of an embodiment of the computer device according to this application. Detailed Implementation
[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0053] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0054] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0055] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0056] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0057] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0058] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0059] It should be noted that the standardized service SDK automated generation method provided in this application embodiment is generally executed by a server / terminal device, and correspondingly, the standardized service SDK automated generation device is generally set in the server / terminal device.
[0060] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0061] Continue to refer to Figure 2 The diagram illustrates a flowchart of an embodiment of the automated generation method for standardized service SDKs according to this application. The automated generation method for standardized service SDKs includes the following steps:
[0062] Step 201: Obtain annotation information from the API source code according to the preset annotation processor.
[0063] In this embodiment, the annotation information refers to the annotation text that is pre-written to enable the automated deployment of the API source code and the generation of software development kits.
[0064] In this embodiment, the software development kit can be understood as the source code program of the service. Developers can update the service program and patch it by further developing the source code program of the service, and clients can install and use the service program by downloading the source code program of the service.
[0065] In this embodiment, the step of obtaining annotation information in the API source code according to the preset annotation processor includes: a tool for processing annotation content in JAVA source code, and / or the Annotation Processing Tool (APT) source code processor supported by Gradle.
[0066] In this embodiment, the annotation processor uses tools that utilize annotations in the Java source code, or / and the Annotation Processing Tool (APT) source code processor supported by Gradle. Its main advantage is that it fully leverages the characteristics of the Java compiled language, supporting annotation compilation and processing on major operating systems such as Windows, Linux, Android, and iOS. The Gradle tool only requires Java JDK 8.0 or later to be installed and also supports annotation compilation and processing on major operating systems such as Windows, Linux, Android, and iOS, ensuring the annotation processor's multi-operating system compatibility.
[0067] Step 202: Filter out the method annotation descriptions in the API source code from the annotation information, and generate unique identifier data for the method annotation descriptions according to the preset transcoding rules.
[0068] In this embodiment, the step of filtering out method annotation descriptions from the annotation information in the API source code and generating unique identifier data from the method annotation descriptions according to preset transcoding rules specifically includes: obtaining all method annotation descriptions in the filtered API source code; serializing all the method annotation descriptions as a whole object to obtain the serialization result; processing the serialization result as an input stream for MD5 value processing to obtain the MD5 value; using the MD5 value as the unique identifier data; and setting a unique identifier for the MD5 value as the description object.
[0069] By transcoding all method annotation descriptions into a single object, serializing this object, and then performing MD5 processing, the method annotation descriptions are integrated into one object. This makes it easy to directly retrieve method annotations through this object. Compared to the existing method annotation description processing, this approach firstly reduces the number of annotation objects generated, saving resources when the processor creates multiple objects. Secondly, by integrating the method annotation descriptions of the same service program into one object, the complete method annotation description of the service program can be obtained from this single object, maintaining the integrity and completeness of annotation retrieval.
[0070] Continue to refer to Figure 3 , Figure 3 yes Figure 2 A flowchart of a specific implementation of step 202 shown includes:
[0071] Step 301: Obtain all method annotation descriptions from the filtered API source code;
[0072] In this embodiment, the specific implementation of obtaining all method annotation descriptions in the filtered API source code is as follows: Based on preset annotation specification symbols, obtain all method annotation descriptions in the API source code, wherein the annotation specification symbols are the annotation specification symbols used in the API source code. For example, if the API source code uses the annotation specification symbol / **...* / , then the annotation specification symbol / **...* / is used as one of the preset annotation specification symbols.
[0073] Step 302: Treat all the method annotation descriptions as a whole object, perform serialization processing, and obtain the serialization processing result;
[0074] In this embodiment, the specific implementation of serializing all the method annotation descriptions as a whole object and obtaining the serialization result is as follows: outputting all the obtained method annotation descriptions as a byte stream into a target file; and setting a distinguishing separator in the byte stream according to the different methods corresponding to each method annotation description, thus completing the serialization process; and obtaining the one-dimensional sequence corresponding to the byte stream in the target file, that is, obtaining the serialization result.
[0075] By setting a distinguishing separator in the byte stream during serialization based on the different methods described by the method annotations, the relative independence of each method annotation description within the overall object is ensured.
[0076] Step 303: The serialization result is used as an input stream for MD5 value processing to obtain the MD5 value. The MD5 value is used as the unique identifier data, and a unique identifier is set for the MD5 value as the description object.
[0077] In this embodiment, the specific implementation of processing the serialization result as an input stream to obtain the MD5 value is as follows: the serialization result is input into the MD5 value generator as an input stream, and the MD5 value corresponding to the serialization result is generated, which is the data of the unique tag corresponding to the method annotation description.
[0078] The use of MD5 values ensures the uniqueness of the tag data corresponding to the method annotation description.
[0079] Step 203: Store the uniquely marked data and the description object corresponding to the uniquely marked data in a preset database.
[0080] In this embodiment, the step of storing the uniquely marked data and the description object corresponding to the uniquely marked data into a preset database specifically includes: using the MD5 value as a hash value and the description object as a hash object matching the hash value, and caching them in pairs into the preset database. The description object can be named by concatenating the package name, class name, method name, and return value during development.
[0081] In this embodiment, the description object corresponding to the MD5 value is named by concatenating the package name, class name, method name, and return value during development. In essence, the development path of the source program and the corresponding return value are directly used as the description object. The method annotation description is no longer exposed. Only the program call path and the corresponding return value are exposed. This makes it easier for developers to update the program and for clients to download and install it later. They can directly obtain the service program through the call path and the corresponding return value without having to pay attention to the method annotation description.
[0082] In this embodiment, after the step of caching the MD5 value as a hash value and the description object as a hash object matching the hash value in pairs into the preset database, the method further includes: generating an auto-incrementing version number information corresponding to the MD5 value in the preset database; establishing an association relationship between the MD5 value, the description object, and the version number information; and setting corresponding entry timestamps for the MD5 value, the description object, and the version number information respectively.
[0083] In this embodiment, the method for generating the auto-incrementing version number information is as follows: an accumulation method is adopted. Whenever a secondary developer updates the version and re-uploads the API source code, steps 201 to 203 are repeated to accumulate and update the version number. For example, if the version number of the API source code before this secondary development was 2.0.0, then the version number of the API source code after this secondary development can be updated by incrementing the last digit by 1, thus updating the version number 2.0.0 to 2.0.1.
[0084] By setting the entry timestamp and auto-incrementing version number information, secondary developers can directly obtain the latest API source code when updating the program. This ensures that when multiple developers are developing the same API source code at the same time, each newest developer can obtain the latest API source code, which facilitates online development management.
[0085] Step 204: Receive a packaging instruction issued to generate a software development kit corresponding to the target service, parse the packaging instruction, and obtain the parsing result.
[0086] In this embodiment, the packaging instruction issued to generate the software development kit corresponding to the target service includes the packaging path of the software development kit. The step of receiving the packaging instruction issued to generate the software development kit corresponding to the target service, parsing the packaging instruction, and obtaining the parsing result specifically includes: after receiving the packaging instruction, parsing the packaging instruction and obtaining the packaging path.
[0087] Step 205: Based on different preset packaging conditions and the parsing results, package the software development kit and display it on the preset development collaboration interface.
[0088] In this embodiment, the step of packaging the software development kit and displaying it on a preset development collaboration interface according to different preset packaging conditions and the parsing results specifically includes: displaying the auto-incrementing version number information corresponding to the MD5 value on the development collaboration interface according to the packaging path and the different packaging conditions, wherein the different packaging conditions refer to different compression tools used during packaging.
[0089] The service SDK corresponding to the latest API source code is published to the preset development collaboration interface through the packaging path in the form of an auto-incrementing version number. This makes it easier for each developer to obtain the latest service program version when multiple developers are developing the same API source code at the same time, thus facilitating online development management.
[0090] In this embodiment, the different compression tools used during packaging are actually packaging and compression tools used for different compiled languages, such as jar packaging tools used for Java, and webpack packaging tools used for JS and RN. The purpose is to generate program development packages that are compatible with multiple programming languages in the collaborative development interface, so as to facilitate the coordination of multiple compiled languages for secondary program development and avoid the compilation limitations caused by single compiled language development.
[0091] Step 206: Based on the preset monitoring component, after detecting the extraction instruction issued in the development collaboration interface to obtain the software development kit corresponding to the target service, generate the code program corresponding to the software development kit according to the preset code generator, and upload the code program to the preset location for secondary developers to download and use.
[0092] In this embodiment, the step of generating the code program corresponding to the software development kit according to the preset code generator specifically includes: pre-defining a general method protocol for the code generator; obtaining a method call array corresponding to the target description object, wherein the method call array includes: method name, call parameters, and return value; parsing the method call array to obtain the method name, call parameters, and return value; using the method name, call parameters, and return value as input parameters of the general method protocol, calling the code generator to generate the code program corresponding to the software development kit.
[0093] The code generator generates the code program corresponding to the software development kit by using the general method protocol and the method call array corresponding to the target description object. This allows secondary developers to avoid blindly downloading all source code at once. Instead, they only need to obtain the description object corresponding to the method of the part to be updated according to the development update requirements, and then generate the latest source code program of that part. This reduces the amount of source code that developers need to download to a certain extent.
[0094] Continue to refer to Figure 4 , Figure 4 yes Figure 2 A flowchart of a specific implementation of step 206 shown includes:
[0095] Step 401: Predefine the general method protocol of the code generator;
[0096] Step 402: Obtain the method call array corresponding to the target description object, wherein the method call array includes: method name, call parameters and return value;
[0097] Step 403: Parse the method call array to obtain the method name, call parameters and return value;
[0098] Step 404: Using the method name, calling parameters, and return value as input parameters of the general method protocol, call the code generator to generate the code program corresponding to the software development kit.
[0099] This application obtains annotation information from API source code based on a preset annotation processor. The annotation information refers to pre-written annotation text for automating the deployment of the API source code and generating a software development kit (SDK). It then filters out method annotation descriptions from the API source code from the annotation information and generates uniquely tagged data based on preset transcoding rules. The uniquely tagged data and the corresponding description objects are stored in a preset database. A packaging instruction is received for generating an SSD corresponding to a target service; the packaging instruction is parsed to obtain a parsing result. The SSD is packaged and displayed on a preset development collaboration interface, and the description objects are also packaged and displayed on the same interface. Based on a preset monitoring component, after detecting an extraction instruction issued in the development collaboration interface for obtaining the SSD corresponding to the target service, the application generates the corresponding code program according to a preset code generator and uploads the code program to a preset location for secondary developers to download and use. This application uses an intermediate object, namely the description object, to achieve development coordination and management among multiple developers, avoiding multiple upload and download operations of the program source code. This ensures that secondary developers do not need to manipulate the API documentation during development, thus guaranteeing the uniformity and maintainability of the API documentation versions across the entire development platform.
[0100] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0101] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0102] In this embodiment, the standardized service SDK automated generation method described herein can be managed using an intelligent managed model. When the service SDK program is updated, the intelligent managed model is used automatically to update the description object and the service SDK version number, reducing the workload of manual updates and making it more intelligent and automated.
[0103] Further reference Figure 5 As a response to the above Figure 2The implementation of the method shown in this application provides an embodiment of a standardized service SDK automated generation device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0104] like Figure 5 As shown, the standardized service SDK automated generation device 500 described in this embodiment includes: an annotation information acquisition module 501, a method annotation transcoding module 502, an intermediate object storage module 503, a packaging instruction parsing module 504, a packaging processing module 505, and a service SDK generation module 506.
[0105] in:
[0106] Annotation information acquisition module 501 is used to acquire annotation information in API source code according to a preset annotation processor, wherein the annotation information refers to annotation text pre-written to realize the automated deployment of the API source code and the generation of software development kits;
[0107] The method annotation transcoding module 502 is used to filter out the method annotation descriptions in the API source code from the annotation information, and generate unique identifier data for the method annotation descriptions according to preset transcoding rules;
[0108] The intermediate object storage module 503 is used to store the data of the unique marker and the description object corresponding to the data of the unique marker into a preset database;
[0109] The packaging instruction parsing module 504 is used to receive a packaging instruction issued for generating a software development kit corresponding to the target service, parse the packaging instruction, and obtain a parsing result;
[0110] The packaging processing module 505 is used to package the software development kit and display it on a preset development collaboration interface according to different preset packaging conditions and the parsing results.
[0111] The service SDK generation module 506 is used to detect, based on a preset monitoring component, an extraction instruction issued in the development collaboration interface for obtaining the software development kit corresponding to the target service, generate the code program corresponding to the software development kit according to a preset code generator, and upload the code program to a preset location for secondary developers to download and use.
[0112] This application obtains annotation information from API source code based on a preset annotation processor. The annotation information refers to pre-written annotation text for automating the deployment of the API source code and generating a software development kit (SDK). It then filters out method annotation descriptions from the API source code from the annotation information and generates uniquely tagged data based on preset transcoding rules. The uniquely tagged data and its corresponding description object are stored in a preset database. A packaging instruction for generating an SSD corresponding to a target service is received, and the packaging instruction is parsed to obtain a parsing result. Based on different preset packaging conditions and the parsing result, the SSD is packaged and displayed on a preset development collaboration interface. Based on a preset monitoring component, after detecting an extraction instruction issued in the development collaboration interface for obtaining the SSD corresponding to the target service, the application generates the code program corresponding to the SSD according to a preset code generator and uploads the code program to a preset location for secondary developers to download and use. This application uses an intermediate object, namely the description object, to achieve development coordination and management among multiple developers, avoiding multiple upload and download operations of the program source code. This ensures that secondary developers do not need to manipulate the API documentation during development, thus guaranteeing the uniformity and maintainability of the API documentation versions across the entire development platform.
[0113] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware through computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0114] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0115] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 6 , Figure 6 This is a basic structural block diagram of the computer device in this embodiment.
[0116] The computer device 6 includes a memory 61, a processor 62, and a network interface 63 that are interconnected via a system bus. It should be noted that only the computer device 6 with components 61-63 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0117] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0118] The memory 61 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 61 may be an internal storage unit of the computer device 6, such as the hard disk or memory of the computer device 6. In other embodiments, the memory 61 may also be an external storage device of the computer device 6, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 6. Of course, the memory 61 may include both the internal storage unit and its external storage device of the computer device 6. In this embodiment, the memory 61 is typically used to store the operating system and various application software installed on the computer device 6, such as computer-readable instructions for the automated generation method of standardized service SDKs. In addition, the memory 61 can also be used to temporarily store various types of data that have been output or will be output.
[0119] In some embodiments, the processor 62 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 62 is typically used to control the overall operation of the computer device 6. In this embodiment, the processor 62 is used to execute computer-readable instructions stored in the memory 61 or to process data, for example, to execute computer-readable instructions from the standardized service SDK automated generation method.
[0120] The network interface 63 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 6 and other electronic devices.
[0121] The computer device proposed in this embodiment belongs to the field of service SDK collaborative development technology. This application obtains annotation information from API source code based on a preset annotation processor. The annotation information refers to pre-written annotation text for automating the deployment of the API source code and generating a software development kit (SDK). It filters method annotation descriptions from the API source code from the annotation information and generates uniquely tagged data based on preset transcoding rules. It stores the uniquely tagged data and the corresponding description objects in a preset database. It receives a packaging instruction for generating a SSD corresponding to a target service, parses the packaging instruction, and obtains a parsing result. Based on different preset packaging conditions and the parsing result, it packages the SSD and displays it on a preset development collaboration interface. Based on a preset monitoring component, after detecting an extraction instruction issued in the development collaboration interface for obtaining the SSD corresponding to the target service, it generates the code program corresponding to the SSD according to a preset code generator and uploads the code program to a preset location for secondary developers to download and use. This application uses an intermediate object, namely a description object, to achieve development coordination and management among multiple developers, avoiding multiple uploads and downloads of the program source code. This ensures that secondary developers do not need to interact with the API documentation during development, guaranteeing the uniformity and maintainability of the API documentation versions across the entire development platform.
[0122] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by a processor to cause the processor to perform the steps of the standardized service SDK automated generation method described above.
[0123] The computer-readable storage medium proposed in this embodiment belongs to the field of service SDK collaborative development technology. This application obtains annotation information from API source code based on a preset annotation processor. The annotation information refers to pre-written annotation text for automating the deployment of the API source code and generating a software development kit (SDK). Method annotation descriptions from the API source code are selected from the annotation information, and uniquely tagged data is generated from the method annotation descriptions according to preset transcoding rules. The uniquely tagged data and the corresponding description objects are stored in a preset database. A packaging instruction for generating a SSD corresponding to a target service is received, and the packaging instruction is parsed to obtain a parsing result. The SSD is packaged and displayed on a preset development collaboration interface according to different preset packaging conditions and the parsing result. Based on a preset monitoring component, after detecting an extraction instruction issued in the development collaboration interface for obtaining the SSD corresponding to the target service, the application generates the code program corresponding to the SSD according to a preset code generator and uploads the code program to a preset location for secondary developers to download and use. This application uses an intermediate object, namely the description object, to achieve development coordination and management among multiple developers, avoiding multiple upload and download operations of the program source code. This ensures that secondary developers do not need to manipulate the API documentation during development, thus guaranteeing the uniformity and maintainability of the API documentation versions across the entire development platform.
[0124] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0125] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A method for automatically generating standardized service SDKs, characterized in that, Includes the following steps: According to the preset annotation processor, the annotation information in the API source code is obtained, wherein the annotation information refers to the annotation text that is pre-written to realize the automated deployment of the API source code and the generation of software development kits; The method annotation descriptions in the API source code are filtered from the annotation information, and unique identifier data is generated from the method annotation descriptions according to preset encoding rules. Specifically, this includes: Retrieve all method annotation descriptions from the filtered API source code; Treat all the method annotations as a single object, perform serialization processing, and obtain the serialization result; The serialization result is used as an input stream for MD5 value processing to obtain the MD5 value. The MD5 value is used as the unique identifier data, and a unique identifier is set for the MD5 value as a description object. Store the uniquely marked data and the corresponding description object in a preset database; Receive a packaging instruction issued to generate a software development kit corresponding to the target service, parse the packaging instruction, and obtain the parsing result; Based on different preset packaging conditions and the parsing results, the software development kit is packaged and displayed on a preset development collaboration interface; Based on the preset monitoring component, after detecting the extraction command issued in the development collaboration interface to obtain the software development kit corresponding to the target service, the code program corresponding to the software development kit is generated according to the preset code generator, and the code program is uploaded to the preset location for secondary developers to download and use.
2. The method for automatically generating standardized service SDKs according to claim 1, characterized in that, The step of storing the uniquely identified data and the corresponding description object in a preset database specifically includes: The MD5 value is used as the hash value, and the description object is used as the hash object that matches the hash value. They are cached in pairs in the preset database. The description object is named by concatenating the package name, class name, method name, and return value during development.
3. The method for automatically generating standardized service SDKs according to claim 2, characterized in that, After the step of using the MD5 value as a hash value and the description object as a hash object matching the hash value, and caching them in pairs into the preset database, the method further includes: Generate an auto-incrementing version number information corresponding to the MD5 value in the preset database; Establish an association between the MD5 value, the description object, and the version number information, and set corresponding entry timestamps for the MD5 value, the description object, and the version number information respectively.
4. The method for automatically generating standardized service SDKs according to claim 3, characterized in that, The packaging instruction issued to generate the software development kit (SDK) corresponding to the target service includes the packaging path of the SSD. The step of receiving the packaging instruction to generate the SSD corresponding to the target service, parsing the packaging instruction, and obtaining the parsing result specifically includes: After receiving the packaging instruction, the packaging instruction is parsed to obtain the packaging path.
5. The method for automatically generating standardized service SDKs according to claim 4, characterized in that, The step of packaging the software development kit and displaying it on a preset development collaboration interface according to different preset packaging conditions and the parsing results specifically includes: Based on the packaging path and the different packaging conditions, the auto-incrementing version number information corresponding to the MD5 value is displayed on the development collaboration interface, wherein the different packaging conditions refer to the different compression tools used during packaging.
6. The method for automatically generating standardized service SDKs according to any one of claims 1 to 5, characterized in that, The step of generating the code program corresponding to the software development kit according to the preset code generator specifically includes: The general method protocol for the code generator is predefined; Obtain the array of method calls corresponding to the target description object, wherein the array of method calls includes: method name, call parameters and return value; The method call array is parsed to obtain the method name, call parameters, and return value; The method name, calling parameters, and return value are used as input parameters of the general method protocol to call the code generator and generate the code program corresponding to the software development kit.
7. A standardized service SDK automated generation device, characterized in that, The standardized service SDK automated generation device implements the steps of the standardized service SDK automated generation method as described in any one of claims 1 to 6, wherein the standardized service SDK automated generation device comprises: The annotation information acquisition module is used to acquire annotation information in the API source code according to a preset annotation processor. The annotation information refers to the annotation text that is pre-written to realize the automated deployment of the API source code and the generation of software development kits. The method annotation transcoding module is used to filter out method annotation descriptions from the annotation information in the API source code, and generate unique identifier data for the method annotation descriptions according to preset transcoding rules, specifically including: Retrieve all method annotation descriptions from the filtered API source code; Treat all the method annotations as a single object, perform serialization processing, and obtain the serialization result; The serialization result is used as an input stream for MD5 value processing to obtain the MD5 value. The MD5 value is used as the unique identifier data, and a unique identifier is set for the MD5 value as the description object. An intermediate object storage module is used to store the uniquely marked data and the description object corresponding to the uniquely marked data into a preset database; The packaging instruction parsing module is used to receive packaging instructions issued for generating a software development kit corresponding to the target service, parse the packaging instructions, and obtain the parsing results. The packaging module is used to package the software development kit and display it on a preset development collaboration interface according to different preset packaging conditions and the parsing results. The service SDK generation module is used to detect, based on a preset monitoring component, an extraction instruction issued in the development collaboration interface to obtain the software development kit corresponding to the target service, generate the code program corresponding to the software development kit according to a preset code generator, and upload the code program to a preset location for secondary developers to download and use.
8. A computer device comprising a memory and a processor, the memory storing computer-readable instructions, wherein the processor, when executing the computer-readable instructions, implements the steps of the standardized service SDK automated generation method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the standardized service SDK automated generation method as described in any one of claims 1 to 6.