Interface management method, system and equipment and storage medium

By extracting and associating interface metadata and code comments during the compilation period, real-time updated interface management documents are generated, and the accuracy and timeliness of traditional interface management tools are solved under the microservice architecture, improving development efficiency and flexibility in document generation.

CN120560658APending Publication Date: 2025-08-29BEIJING BAIJU YIXING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510534337.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-08-29

AI Technical Summary

Technical Problem

In the prior art, the accuracy and generation timeliness of interface management documents are poor, especially when multiple teams are collaboratively developed under the microservice architecture. Traditional invasive programming tools lead to low development efficiency, inability to be compatible with non-HTTP interfaces, and rely on the runtime generation of documents implemented by the interface.

Method used

By using the annotation processor to extract the interface metadata of the compiled file during the project construction stage, and associating code annotations during the compilation period, generating machine-readable and human-understood interface management documents, embedded in the compilation process, dynamic mapping of interface metadata and code annotations is realized, ensuring real-time update of the document.

Benefits of technology

It improves the consistency between interface metadata and project source code, reduces manual errors, improves the accuracy and timeliness of interface management documents, supports multiple interface types, reduces development thresholds and modification costs, and is suitable for rapid iteration under the microservice architecture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120560658A_ABST
    Figure CN120560658A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of code compiling, and particularly discloses an interface management method, an interface management system, computer equipment and a computer readable storage medium. The interface management method comprises the steps that an annotation processor is injected into a project management tool, and when project source code compiling is executed, the annotation processor extracts interface metadata in a compiling file compiled by the project management tool and associates the interface metadata with code annotations of the interface metadata in the project source code; the technical problem that the accuracy and the generation timeliness of the interface management document are poor is solved, the annotation processor is introduced to generate the interface management document in the project source code compiling period, and the generation efficiency of the interface management document is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of code compilation technology, and in particular to an interface management method, an interface management system, a computer device, and a computer-readable storage medium. Background Art

[0002] With the continuous development of computer technology, network technology, etc., the number of independent services under the microservice architecture continues to increase. In the process of collaborative development among multiple teams, the accuracy and timeliness of interface management documents have become a factor restricting rapid iteration.

[0003] For example, when collaborative development is carried out based on the currently commonly used HTTP (Hypertext Transfer Protocol) interface, the interface management document usually adopts an intrusive programming application programming interface management document generation tool as a solution. That is, it is required to describe and explain the source code through the annotations provided by the application programming interface management document generation tool. This results in the need to repeatedly add annotations to a large amount of existing historical code for declaration, and it can only scan and generate interface management documents for a single HTTP interface, and is not compatible with other types of interfaces. At the same time, intrusive programming tools usually require that the interface management document can only be provided after the program is running, that is, the extraction of the interface management document must rely on a valid interface implementation, resulting in low development efficiency. Summary of the Invention

[0004] The present application provides an interface management method, an interface management system, a computer device, and a computer-readable storage medium to at least solve the technical problems of poor accuracy and generation timeliness of interface management documents in related technologies.

[0005] The present application provides an interface management method, comprising: compiling a project source code in response to a project management tool to obtain a compiled file, extracting interface metadata from the compiled file by an annotation processor, associating the interface metadata with its code comments in the project source code, and writing the code comments and their associated interface metadata into an interface management document.

[0006] The present application also provides an interface management system, including: a project management tool and an annotation processor, a control module, connected to the project management tool and the annotation processor, and used to execute any of the above-mentioned interface management method steps.

[0007] The present application also provides a computer device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned interface management methods when executing the computer program.

[0008] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned interface management methods are implemented.

[0009] This application helps reduce errors that may be caused by manual recording by extracting interface metadata from compiled files through the annotation processor during the project construction phase, thereby improving the consistency between the interface metadata and the interface defined by the project source code, so as to provide a more reliable data source for the subsequent generation of interface management documents. At the same time, the annotation processor can dynamically associate project code annotations with interface metadata, establish a mapping relationship between the unstructured descriptions (i.e., code annotations) written in the project source code and the extracted interface metadata, realize the fusion of technical parameters and business semantics, and help the interface management document contain both machine-readable data formats and human-understandable business contexts, and write the associated interface metadata and code annotations into the interface management document. Since document generation is embedded in the compilation process, it is also beneficial to trigger the update of the interface management document in a timely manner when the project source code changes, thereby improving the timeliness of the interface management document. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0011] Figure 1 An application environment diagram of an interface management method provided in an embodiment of the present application;

[0012] Figure 2 A flowchart of an interface management method provided in an embodiment of the present application;

[0013] Figure 3 A flowchart of another interface management method provided in an embodiment of the present application;

[0014] Figure 4 A schematic diagram of the structure of an interface management system provided in an embodiment of the present application;

[0015] Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0016] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0017] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.

[0018] It should be noted that the terms "S1", "S2", etc. are used only for the purpose of describing the steps and do not specifically refer to the order or sequence, nor are they used to limit this application. They are merely for the convenience of describing the method of this application and should not be understood as indicating the order of the steps. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that ordinary technicians in this field can implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0019] The interface management method provided in this application can be applied to Figure 1 In the application environment shown, the terminal 12 communicates with the server 14 via a network. The terminal 12 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the server 14 can be implemented as an independent server or a server cluster consisting of multiple servers.

[0020] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0021] The embodiment of the present application provides an interface management method, and the method is described in detail in conjunction with the execution process of the interface management method.

[0022] In one embodiment, if Figure 2 As shown, Figure 2 A flowchart of an interface management method provided in an embodiment of the present application.

[0023] S201: In response to a project management tool compiling a project source code to obtain a compiled file, an annotation processor extracts interface metadata of the compiled file.

[0024] In this embodiment, when the project management tool executes the compilation command, the code compiler is started to compile the project source code and generate a compiled file (such as a .class bytecode file). During the compilation process, the annotation processor is dynamically injected into the compilation process through a custom project management tool plug-in. The annotation processor scans all interface definitions during compilation, extracts interface metadata, converts the extracted interface metadata into a standard format, and generates an independent interface management document file. This process does not require modifying the existing code, and directly utilizes the existing code comments and interface definitions, solving the invasive problem of the traditional solution requiring manual annotation.

[0025] S203: Associating the interface metadata with its code comments in the project source code.

[0026] In this embodiment, the annotation processor associates the interface metadata with the code description, method, parameter, etc. of the code annotations in the target source code.

[0027] Among them, the code description includes purpose and design instructions; the method includes method name and parameter type; the parameters include parameter declaration order, etc.

[0028] S205: Write the code comments and their associated interface metadata into the interface management document.

[0029] In this embodiment, the project source code is compiled by a project management tool that includes an annotation processor, and the annotation processor generates an interface management document containing interface information based on the code annotations and interface metadata. In this embodiment, during the project construction phase, the annotation processor parses the interface definition in the source code, extracts the interface metadata, eliminates manual recording errors, ensures that the interface metadata is strictly consistent with the code implementation, provides an accurate data source for subsequent document generation, further dynamically associates the code annotations with the interface metadata, establishes a mapping relationship between the unstructured descriptions written by the developer and the extracted interface metadata, realizes the fusion of technical parameters and business semantics, and makes the document contain both machine-readable data format and human-understandable business context, and writes the associated interface metadata and annotations into the interface management document. Since document generation is embedded in the compilation process, any code changes trigger real-time updates of the document.

[0030] For example, if the project source code is Java (a widely used object-oriented programming language), the project management tool can be the Maven build tool. Maven is a project management and build tool, mainly used for the construction, dependency management and project information management of Java projects.

[0031] The plugin can be APT (Annotation Processing Tool). As an extension of the Java compiler, the APT plugin can parse code structure during compilation without waiting for the program to run. It allows developers to process annotations during compilation and generate additional source files or resource files. Interface metadata includes the interface name, method name, method parameter definitions, method return definition, etc., as well as Javadoc comments embedded in the source code (such as method descriptions and parameter descriptions) and related annotations.

[0032] Among them, Javadoc comment types include method comments, field comments, and status code comments.

[0033] Compilation is the process of converting source code into target code (such as machine code or bytecode).

[0034] Javadoc comments refer to a tool provided by Java that helps developers write and maintain high-quality code documentation by embedding comments in a specific format in the code, making the code easier to understand, use, and maintain.

[0035] The APT plugin automatically binds the structured interface metadata of an interface to the Javadoc comments in the code during compilation. During the Java compilation phase, the APT plugin is triggered by Maven and parses the project's abstract syntax tree to obtain the interface metadata for all interface definitions (such as classes, methods, and parameters). The APT plugin also scans for Javadoc comments directly associated with the interface definitions. Mappings are established using code elements such as class names and method signatures.

[0036] After the APT plug-in completes the association between interface metadata and Javadoc comments during compilation, it merges the two into a structured data object and converts the structured data into a standardized interface management document. In the CI / CD process, the interface management document files can be automatically collected and uploaded to the interface management platform.

[0037] Among them, CI / CD (CI: Continuous Integration, CD: Continuous Delivery) deployment aims to simplify and accelerate the software development life cycle through automated processes and tools.

[0038] The interface management document refers to the basic introduction of the API (Application Programming Interface), including its purpose, main functions, and the format definition of requests and responses.

[0039] In one embodiment, a preset extension port of a code compiler can be connected. The code compiler is scheduled by a project management tool and is used to compile the project source code. During the compilation period of the project source code, the code comments of the project source code are obtained through the preset extension port. The interface metadata is associated with the code comments corresponding to it. In this way, it is possible to associate the interface metadata with the code comments in the project source code. That is to say, in this embodiment, the generation of the interface management document occurs during the compilation period of the project source code. Through the preset extension port of the code compiler, the interface metadata can be associated with the code comments in the project source code. The annotation processor generates an interface management document containing interface information based on the associated interface metadata and the code comments in the project source code.

[0040] Specifically, the extension port reserved by the code compiler can be used to obtain the compiled file during the compilation period, and the corresponding code comments can be obtained at the same time. Then, the interface metadata can be obtained through the compiled file and associated with the source code comments.

[0041] For example, the code compiler may be a Java compiler, which is responsible for compiling Java source code into bytecodes (files in .class format).

[0042] The default extension port refers to the APT plug-in interface of the Java compiler.

[0043] The connection method can be to register the custom APT plug-in into the compiler's annotation processing chain when building the project through Maven.

[0044] When executing a compile command, Maven parses the project description file, loads project dependencies, including the injected APT plugin, starts the Java compiler, and passes the custom APT plugin as a compile parameter. When the compiler parses the source code, it triggers the APT plugin's processing logic. During compilation, the APT plugin accesses the compiler's abstract syntax tree to extract the following interface metadata and code comments. The interface metadata is then bound to the corresponding Javadoc comments.

[0045] This embodiment schedules the compiler through project management tools such as Maven, and uses document extraction as part of the standard compilation process. Developers can trigger document generation without additional operations, lowering the usage threshold. The code structure is parsed during compilation (rather than runtime annotations) to extract any interface type. During compilation, code comments and interface metadata are directly obtained through the compiler's preset extension port. Developers do not need to modify the source code or add additional annotations, avoiding invasive changes to the existing code base. At the same time, interface metadata and annotations are extracted during compilation to ensure that the document information is strictly consistent with the current code version, which can eliminate version lag problems caused by manual maintenance.

[0046] In one embodiment, the code annotation types may include method annotations, field annotations, and status code annotations. In this embodiment, a non-statistical code annotation acquisition method is configured for code annotations of different annotation types.

[0047] Specifically, in response to the code comment being a method comment or a field comment, a compile-time application programming interface reserved for the code language is used as a preset extension port to obtain the code comment through the preset extension port. In response to the compile-time detection, a status code object is compiled, and the comment type of the code comment associated therewith is determined to be a status code comment. The code information and the code comment of the status code object are obtained using a reflection mechanism.

[0048] In the previous example, the APT plugin parses the abstract syntax tree at compile time and distinguishes annotation types based on the code element type. Because the APT plugin runs at compile time, Java provides a standard compile-time API to obtain method and field annotations.

[0049] Method comments are Javadoc comments attached to Java methods, describing the method's functionality, parameters, and return value. Examples include the order placement and cancelation interfaces. Field comments are Javadoc comments attached to class member variables, describing the meaning or constraints of the field. Examples include order number, order placement time, and user ID. Status code comments are Javadoc comments attached to status code constants, describing the meaning of the status code, which is a special object with a unified convention.

[0050] If a status code object is detected during compilation, Java's reflection mechanism can be used to obtain the code information and annotations of the status code. When the compiler detects that a status code object has been compiled, processing logic is automatically triggered. The Java reflection API is used to obtain the status code name and value, and the APT plugin is used to extract the associated Javadoc comments.

[0051] Among them, Java's reflection mechanism refers to the function of dynamically obtaining information and dynamically calling object methods. During the running of the program, the properties and methods of the class can be known; for any object, any method and property of it can be called.

[0052] The code information of the status code refers to the name and value of the status code.

[0053] This embodiment uses compile-time static analysis to accurately distinguish method annotations from field annotations, ensuring that both types of annotations are fully extracted. A pre-set extension based on the APT plug-in interface directly parses the standard Javadoc structure without requiring code modification. The type and value of the status code object are dynamically read through a compile-time reflection mechanism, decoupling from the specific implementation and not occupying runtime resources, thus minimizing the impact on service performance.

[0054] In one embodiment, a compiled binary program file may be obtained as a compiled file; and the interface metadata may be obtained from the compiled file using a reflection mechanism.

[0055] Specifically, during the compilation phase, a Java project goes through a process where the source code is compiled into a binary file using a compiler. During this process, the annotation information on the source code is not retained in the binary file, which is equivalent to the program code being output as a binary program file. In layman's terms, the basic principle of an annotation processor is similar to a callback hook. That is, after the Maven compilation process is completed, the Java compiler notifies the APT plug-in of the compiled binary file. The APT plug-in, combined with the API, parses the class name, method signature, annotation, and other information in the binary file. Custom processing can be performed at this step.

[0056] The binary file refers to the bytecode file generated by the Java compiler, which contains structured binary data converted from the source code.

[0057] In one embodiment, the method further includes identifying whether the project source code includes a preset identifier, and in response to including the preset identifier, determining that the target region field carrying the preset identifier is a code comment.

[0058] The preset identifier refers to a Javadoc tag customized by the developer, which is used to mark the comment area to be extracted.

[0059] Specifically, when parsing Javadoc comments during compilation, it is detected whether a preset tag exists. If so, the comment block is marked as a target area, and its content is extracted and associated with the interface metadata.

[0060] This embodiment extracts interface metadata directly from compiled binary files, ensuring that the information is fully consistent with the code implementation. It also filters comments using preset identifiers to prevent irrelevant comments from being mixed into the interface management document. Custom identifiers are supported to adapt to the documentation requirements of different teams.

[0061] In one embodiment, an interface query instruction is obtained; index information carried by the interface query instruction is parsed; an index identifier matching the index information in the interface management document is searched as a target identifier; and a code comment carrying the target identifier and its interface metadata are retrieved.

[0062] Specifically, the user or system initiates a query request through an interface management platform or other paths, enters the interface identifier to be retrieved, generates a structured query instruction, extracts index information from the query instruction, selects to perform a quick search based on the index information, returns a matching index identifier, and extracts complete interface metadata and its associated code comments from the interface management document based on the index identifier.

[0063] This embodiment achieves accurate filtering through index information, improves matching efficiency, and helps to strictly bind interface management documents to code versions.

[0064] In one embodiment, in response to the project management tool compiling the project source code, the annotation processor is triggered to obtain process data including interface information generated during the compilation of the compiled file; the process data is assembled into the description format of the interface management file and stored in the root directory of the compiled product; the project information of the project description file is extracted, and the project information is used as an index identifier for the code annotations and their interface metadata.

[0065] Specifically, when Maven calls the Java compiler and activates the custom APT plug-in to obtain process data including interface information, the extracted process data is converted into a standardized description format. It is output to the root directory of the Maven compilation product, for example, in a Maven project, it is divided into a source code directory and a compilation output directory, that is,

[0066] " / src source code directory

[0067] / target compilation output directory"

[0068] The specific path can be customized through the project description file.

[0069] The process data including interface information includes interface metadata, Javadoc comments, all interface types covered, and intermediate data generated during compilation.

[0070] The description format may be an OpenAPI format. OpenAPI refers to an open application programming interface, and the OpenAPI format is JSON or YAML.

[0071] In addition to extracting interface metadata and annotations, the project information in the project description file will also be extracted, that is, the package name and version number of this interface will be extracted, and the interface package name and version number will be used as an index identifier for the interface management document.

[0072] In this embodiment, the process data is converted into a standard format and output to the compilation product directory, which can avoid secondary conversion due to the format, so that the interface management document can be automatically collected by CI / CD and pushed to the interface management document platform. At the same time, the storage path is separated from the compilation product, which can reduce the pollution of the source code directory and facilitate version control.

[0073] In one embodiment, if Figure 3 As shown, Figure 3A flow chart of another interface management method provided for an embodiment of the present application. According to S301, the dependency management modified by the dependent project description file is injected into the annotation processor, and after the injection is completed, S302 is executed: Maven is compiled, wherein the project description file is used to make the project management tool parse, and the project dependencies are loaded based on the dependency management therein to inject the annotation processor, so that a dependency relationship is established between the annotation processor and the second-party package management platform and the interface management document platform. Execute S303, Maven generates a compilation file through the normal compilation process, execute S304, and generate an interface management document through the APT plug-in. After the two documents are generated, execute S305 to submit the compilation file to the second-party package management platform, that is, S306 submits the interface management document to the interface management document platform.

[0074] Specifically, in current Java projects, most are built using Maven, and each project will have its own project description file, which is a text file in the standard pom.xml format. To adjust the dependency management of the pom.xml file in Maven, the developer modifies the pom.xml and declares the APT plug-in dependency. The process of extracting the plug-in from the additional interface management document uses Maven's standard pom.xml format processing capabilities to add the APT plug-in to the project description file, and finally outputs a new pom.xml file containing the APT plug-in. When Maven parses the new pom.xml, it automatically downloads the compiled file of the APT plug-in from the second-party package management platform. During the compilation phase, Maven injects the APT plug-in into the annotation processing chain of the Java compiler. This process adds the APT plug-in to the project's dependencies, eliminating the cost of manually adding dependencies, and the content of the pom.xml file modified in this way complies with Maven's specifications.

[0075] In one embodiment, the pom.xml file can also be modified through a script, such as Shell or Python, in a text editing manner.

[0076] The pom.xml file refers to the Maven project description file.

[0077] Specifically, Maven uploads compilation files to the second-party package management platform and interface management documents to the interface management document platform. The interface management document platform receives the interface management documents from CI / CD. The second-party package management platform processes the normal Maven compilation results, namely the compilation files. The second-party package management platform receives and saves the compilation files, which other internal services will rely on and use. The interface document platform processes the interface management documents, and the compilation file information is saved as index information in the system. At the same time, the interface management document information is also saved in the system for the interface management document platform to parse the interface definition online. Then, the interface definition is parsed based on the interface management document information, and the compilation file version is associated with it to automatically update and generate a new version of the interface management document.

[0078] The interface management document has unique version information. When a new version of the interface management document is generated, the old version of the interface management document remains. On the interface management document platform, users can select the version they are interested in to view the specific interface definition content.

[0079] Among them, the second-party package management platform refers to the private warehouse that stores the APT plug-in itself and its dependencies; the interface management document platform refers to the target platform that stores the generated interface management documents.

[0080] This embodiment achieves efficient integration of APT with second-party package management platforms and interface management document platforms through project description file dependency injection and platform-specific submission of corresponding files. It solves the problems of traditional solutions relying on manual operations, complex environment adaptation, and loose version management, and improves the efficiency and security of interface management under the microservice architecture. At the same time, the interface management document is bound to the version of the compiled file, which facilitates problem tracing and version rollback.

[0081] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.

[0082] The embodiment of the present application also provides an interface management system, such as Figure 4 As shown, Figure 4 This is a schematic diagram of the structure of an interface management system provided in an embodiment of the present application. The interface management system may include an annotation processor 21, which is used to connect with a project management tool to implement the steps of any interface management method.

[0083] The annotation processor 21 is used to compile the project source code in response to the project management tool to obtain a compiled file. The annotation processor extracts the interface metadata of the compiled file; associates the interface metadata with its code comments in the project source code; and writes the code comments and their associated interface metadata into the interface management document.

[0084] A preset extension port of a Unicom code compiler; wherein the code compiler is scheduled by a project management tool and is used to compile project source code; during the compilation period of the project source code, code comments of the project source code are obtained through the preset extension port; and interface metadata are associated with the corresponding code comments.

[0085] In response to the comment type of the code comment being a method comment or a field comment, the code comment is obtained by utilizing the application programming interface reserved during compilation of the code language as a preset extension port; in response to the compilation-time detection, the status code object is compiled, and it is determined that the comment type of the code comment associated therewith is a status code comment, and the code information and code comment of the status code object are obtained by utilizing the reflection mechanism.

[0086] Obtain a compiled binary program file as a compiled file; utilize a reflection mechanism to obtain interface metadata from the compiled file; and / or, before associating the interface metadata with its code comments in the project source code, also include: identifying whether the project source code includes a preset identifier, and in response to including the preset identifier, determining that the target area field carrying the preset identifier is a code comment.

[0087] Obtain an interface query instruction; parse the index information carried by the interface query instruction; query the interface management document for an index identifier that matches the index information as a target identifier; retrieve the code comment and interface metadata carrying the target identifier.

[0088] In response to the project management tool compiling the project source code, the annotation processor is triggered to obtain the process data including interface information generated during the compilation of the compiled file; the process data is assembled into the description format of the interface management file and stored in the root directory of the compiled product; the project information of the project description file is extracted, and the project information is used as an index identifier for the code annotation and its interface metadata.

[0089] In this embodiment, the interface management system uses an interface management method that differs from invasive programming methods. There's no need to make significant changes to the existing codebase or directly modify existing data structures and class definitions. Existing Javadoc can directly utilize the generated interface management documentation, making it more efficient. Among popular microservice frameworks today, the HTTP interface provided by the Spring framework is a common interface interaction format. In this case, there are commonly used interface documentation solutions called swagger or openapi. In the swagger solution, developers are required to annotate the existing interface with descriptions of the interface and parameters. After the Java source code is compiled, the information in the annotations is retained until the program runs. Once the program is officially running, the swagger framework scans and extracts the annotations on the interface, assembling the annotations and interface information to generate a single-machine accessible interface document. The interface management system in this embodiment is applicable to interfaces written using standard Java interface definitions. Unlike the swagger solution, which can only be used with HTTP interfaces, it is more versatile. Furthermore, interface management documentation can be extracted during compilation, independent of project startup, resulting in greater timeliness. Therefore, this embodiment can quickly generate interface management documents to facilitate rapid development coordination. This interface management document can also be used to quickly build automated tests, which use specialized software tools to execute test cases to verify that the software's functionality and performance meet expectations. Compared to manual testing, automated testing improves efficiency, reduces human error, and allows for frequent test runs to ensure that code changes do not introduce new issues, thereby ensuring rapid iteration and reducing risk.

[0090] The embodiment of the present application further provides a computer device, which may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 5 As shown, Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, an interface management method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0091] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0092] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above-mentioned interface management method embodiments when running.

[0093] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0094] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0095] The above is a detailed introduction to the interface management method, system, device and storage medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims

1. An interface management method, characterized in that: The interface management method includes: In response to the project management tool compiling the project source code to obtain a compiled file, the annotation processor extracts interface metadata of the compiled file; Associating the interface metadata with code comments within the project source code; The code annotation and the associated interface metadata are written into an interface management document.

2. The interface management method according to claim 1, characterized in that: The associating the interface metadata with the code annotations in the project source code includes: A preset extension port of a Unicom code compiler; wherein the code compiler is scheduled by the project management tool and is used to compile the project source code; During the compilation period of the project source code, code comments of the project source code are obtained through the preset extension port; and the interface metadata is associated with the corresponding code comments.

3. The interface management method according to claim 2, characterized in that: The code annotation types include method annotations, field annotations, and status code annotations; the code annotations of the project source code obtained through the preset extension port include: In response to the comment type of the code comment being a method comment or a field comment, the code comment is acquired by using the application programming interface reserved during compilation of the code language as the preset extension port; In response to the compile-time detection, the status code object is compiled, the comment type of the code comment associated therewith is determined to be the status code comment, and the code information and the code comment of the status code object are acquired by using a reflection mechanism.

4. The interface management method according to claim 1, wherein: Extracting the interface metadata of the compiled file includes: Obtaining a compiled binary program file as the compiled file; obtaining the interface metadata from the compiled file using a reflection mechanism; And / or, before associating the interface metadata with the code annotation in the project source code, the method further includes: It is identified whether the project source code includes a preset identifier, and in response to including the preset identifier, it is determined that the target area field carrying the preset identifier is the code comment.

5. The interface management method according to claim 1, characterized in that: After the code annotation and the associated interface metadata are written into the interface management document, the method further comprises: Get interface query instructions; Parsing the index information carried by the interface query instruction; Searching the interface management document for an index identifier that matches the index information as a target identifier; Retrieve the code annotation and interface metadata that carry the target identifier.

6. The interface management method according to claim 5, characterized in that: Writing the code annotation and the associated interface metadata into the interface management document further includes: In response to the project management tool compiling the project source code, the annotation processor is triggered to obtain process data including interface information generated during the compilation process of the compiled file; Assembling the process data into the description format of the interface management file and storing it in the compilation product root directory; The project information of the project description file is extracted, and the project information is used as an index identifier of the code annotation and the interface metadata thereof.

7. The interface management method according to claim 1, characterized in that: The interface management method further includes: The dependency management modified by the dependent project description file is injected into the annotation processor; wherein the project description file is used to be parsed by the project management tool, and the project dependencies are loaded based on the dependency management therein to inject the annotation processor, so that a dependency relationship is established between the annotation processor and the second-party package management platform and the interface management document platform; Submit the compiled file to the second-party package management platform, and submit the interface management document to the interface management document platform.

8. An interface management system, characterized in that: The interface management system includes: The annotation processor is used to connect with the project management tool to implement the steps of the interface management method as described in any one of claims 1 to 7.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the interface management method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the interface management method according to any one of claims 1 to 7 are implemented.