CN113157792A - Interface document management system and working method thereof - Google Patents

Interface document management system and working method thereof Download PDF

Info

Publication number
CN113157792A
CN113157792A CN202110503931.3A CN202110503931A CN113157792A CN 113157792 A CN113157792 A CN 113157792A CN 202110503931 A CN202110503931 A CN 202110503931A CN 113157792 A CN113157792 A CN 113157792A
Authority
CN
China
Prior art keywords
interface
document
module
application program
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110503931.3A
Other languages
Chinese (zh)
Other versions
CN113157792B (en
Inventor
吴成龙
施生燊
徐克宝
隋臣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110503931.3A priority Critical patent/CN113157792B/en
Publication of CN113157792A publication Critical patent/CN113157792A/en
Application granted granted Critical
Publication of CN113157792B publication Critical patent/CN113157792B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Abstract

The invention provides an interface document management system and a working method thereof, relating to the information security technology, wherein the system comprises: an application and interface center; the application program is used for realizing the business logic and providing an interface to generate an interface document; the interface center is used for receiving an interface document of an application program and managing document resources; an application program comprising: the monitoring system comprises an integration module and a monitoring module; the integration module is used for integrating codes realized by business logic, defining custom annotation by reconstructing a bottom API, scanning interface codes of an application program, collecting interface data, generating an interface document to a cache and providing document interface calling; and the monitoring module is used for monitoring the change condition of the interface code of the application program, caching the content of the interface document, automatically updating the interface document when the interface code changes and updating the document resource stored in the interface center. And shielding bottom details by reconstructing a bottom API (application program interface), and supporting generation and real-time updating of various interface documents.

Description

Interface document management system and working method thereof
Technical Field
The invention relates to the technical field of computer data processing, in particular to an information security technology, and particularly relates to an interface document management system and a working method thereof.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
At present, with the continuous expansion of applications, business logic becomes heavy, resulting in splitting into many service interfaces and different types of interfaces such as Restful, RPC, etc. to implement calling different business functions, and if an interface document is indispensable for development and debugging, an extensive interface requires a place specially used for managing the interface document.
At present, document management for managing different interface types in the industry is realized based on Swagger and is independent from each other, a set of modes for uniformly managing the display and content update of various interface documents is not provided, and the application cannot perform customized parameters to collect more index contents.
Therefore, how to provide a new solution, which can solve the above technical problems, is a technical problem to be solved in the art.
Disclosure of Invention
The embodiment of the invention provides an interface document management system, which shields bottom details through a bottom API reconstruction mode, extracts a set of uniform annotation supporting various interfaces, and can support document generation and real-time update of various interfaces by introducing a set of dependence and using the same set of annotation, wherein the system comprises: an application and interface center;
the application program is used for realizing the business logic and providing an interface to generate an interface document; the interface center is used for receiving an interface document of an application program and managing document resources;
an application program comprising: the monitoring system comprises an integration module and a monitoring module;
the integration module is used for integrating codes realized by business logic, defining custom annotation by reconstructing a bottom API, scanning interface codes of an application program, collecting interface data, generating an interface document to a cache and providing document interface calling;
and the monitoring module is used for monitoring the change condition of the interface code of the application program, caching the content of the interface document, automatically updating the interface document when the interface code changes and updating the document resource stored in the interface center.
The embodiment of the invention also provides a working method of the interface document management system, which comprises the following steps:
the application program realizes the service logic and provides an interface to generate an interface document; the interface center receives an interface document of an application program and performs document resource management;
the integration module integrates codes realized by business logic, defines custom annotation by reconstructing a bottom API, scans interface codes of an application program, collects interface data, generates an interface document to a cache and provides document interface calling;
the monitoring module monitors the change condition of the interface code of the application program, caches the content of the interface document, and automatically updates the interface document and the document resource stored in the interface center when the interface code changes.
The embodiment of the invention also provides computer equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein when the processor executes the computer program, the working method of the interface document management system is realized.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program for executing the working method of the interface document management system is stored in the computer-readable storage medium.
The embodiment of the invention provides an interface document management system and a working method thereof, wherein the interface document management system comprises the following steps: an application and interface center; the application program is used for realizing the business logic and providing an interface to generate an interface document; the interface center is used for receiving an interface document of an application program and managing document resources; an application program comprising: the monitoring system comprises an integration module and a monitoring module; the integration module is used for integrating codes realized by business logic, defining custom annotation by reconstructing a bottom API, scanning interface codes of an application program, collecting interface data, generating an interface document to a cache and providing document interface calling; and the monitoring module is used for monitoring the change condition of the interface code of the application program, caching the content of the interface document, automatically updating the interface document when the interface code changes and updating the document resource stored in the interface center. The invention shields the bottom details by reconstructing the bottom API, extracts a set of unified annotation supporting various interfaces, and can support the document generation and real-time update of various interfaces by only introducing a set of dependency and using the same set of annotation. Meanwhile, the generation of API documents of various interface types is supported, the change capture of the interface code content can be dynamically and accurately monitored, the change of the non-interface code content is not captured, a real-time new interface document is generated and automatically updated, a document interface API is provided, and the external calling, the query and the interface document downloading are facilitated.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
FIG. 1 is a diagram of an interface document management system according to an embodiment of the present invention.
FIG. 2 is a diagram of the internal structure of a monitoring module of the interface document management system according to the embodiment of the present invention,
FIG. 3 is a flowchart illustrating an internal principle execution process of an integrated module of the interface document management system according to an embodiment of the present invention.
FIG. 4 is a diagram illustrating a method for operating an interface document management system according to an embodiment of the present invention.
FIG. 5 is a schematic diagram of a computer device running a method for operating an interface document management system implemented by the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
Fig. 1 is a schematic diagram of an interface document management system according to an embodiment of the present invention, and as shown in fig. 1, an embodiment of the present invention provides an interface document management system, which shields bottom details by reconstructing a bottom API, extracts a set of unified annotations supporting multiple interfaces, and may support document generation and real-time update of various types of interfaces by only introducing a set of dependencies and using the same set of annotations, where the system includes: an application and interface center;
the application program is used for realizing the business logic and providing an interface to generate an interface document; the interface center is used for receiving an interface document of an application program and managing document resources;
an application program comprising: the monitoring system comprises an integration module and a monitoring module;
the integration module is used for integrating codes realized by business logic, defining custom annotation by reconstructing a bottom API, scanning interface codes of an application program, collecting interface data, generating an interface document to a cache and providing document interface calling;
and the monitoring module is used for monitoring the change condition of the interface code of the application program, caching the content of the interface document, automatically updating the interface document when the interface code changes and updating the document resource stored in the interface center.
An interface document management system provided by an embodiment of the present invention includes: an application and interface center; the application program is used for realizing the business logic and providing an interface to generate an interface document; the interface center is used for receiving an interface document of an application program and managing document resources; an application program comprising: the monitoring system comprises an integration module and a monitoring module; the integration module is used for integrating codes realized by business logic, defining custom annotation by reconstructing a bottom API, scanning interface codes of an application program, collecting interface data, generating an interface document to a cache and providing document interface calling; and the monitoring module is used for monitoring the change condition of the interface code of the application program, caching the content of the interface document, automatically updating the interface document when the interface code changes and updating the document resource stored in the interface center. The invention shields the bottom details by reconstructing the bottom API, extracts a set of unified annotation supporting various interfaces, and can support the document generation and real-time update of various interfaces by only introducing a set of dependency and using the same set of annotation. Meanwhile, the generation of API documents of various interface types is supported, the change capture of the interface code content can be dynamically and accurately monitored, the change of the non-interface code content is not captured, a real-time new interface document is generated and automatically updated, a document interface API is provided, and the external calling, the query and the interface document downloading are facilitated.
The embodiment of the invention provides an interface document management system, relates to the field of program bottom layer code design, and particularly relates to an interface document management method based on Swagger. Referring to fig. 1, when an interface document management system provided by an embodiment of the present invention is implemented, in an embodiment, the system includes: an application and interface center;
the application program is used for realizing the business logic and providing an interface to generate an interface document; the interface center is used for receiving an interface document of an application program and managing document resources;
an application program comprising: the monitoring system comprises an integration module and a monitoring module;
the integration module is used for integrating codes realized by business logic, defining custom annotation by reconstructing a bottom API, scanning interface codes of an application program, collecting interface data, generating an interface document to a cache and providing document interface calling;
and the monitoring module is used for monitoring the change condition of the interface code of the application program, caching the content of the interface document, automatically updating the interface document when the interface code changes and updating the document resource stored in the interface center.
In an embodiment, an interface document management system integrally includes an application and an interface center, where the application is internally integrated with an integration module, the integration module is integrated inside the application, the integration module is connected to the interface center, the interface center is connected to the integration module, a monitoring module is integrated inside the application, and the application is internally integrated with the monitoring module.
The application program comprises the following steps: where the business logic is implemented, and provides interfaces such as Restful or RPC for the integrated architecture scan to use.
An interface center: the method mainly receives and manages the interface document of the application program.
An integration module: the system is responsible for integrating codes, defining custom notes, scanning application program interface codes, generating documents and providing document interface calls in a mode of reconstructing a bottom API.
A monitoring module: and monitoring the change condition of the interface codes, and automatically and dynamically updating the interface document and the document resources stored in the interface center aiming at the change.
Fig. 2 is an internal structure diagram of a monitoring module of an interface document management system according to an embodiment of the present invention, and as shown in fig. 2, when an interface document management system according to an embodiment of the present invention is implemented, in an embodiment, the monitoring module includes: the system comprises a monitor module, a data processing module and a communication function module;
the monitor module is used for monitoring the interface code change condition of the scanning application program and transmitting the interface code change condition to the data processing module;
the data processing module is used for calculating code content comparison of interface change according to interface code change condition trigger transmitted by the monitor module, scanning and calculating whether the change condition is the function change condition of interface and service call, confirming and updating the interface and service call content, feeding back the updated interface and service call content to the integration module, and enabling the integration module to regenerate a new interface document and cache the new interface document;
and the communication function module is used for packaging the interface document content, automatically updating the interface document and updating the document resource stored in the interface center.
In an embodiment, as shown in fig. 2, an internal structural schematic diagram of a monitoring module is shown, and the inside mainly includes three modules: the system comprises a monitor module, a data processing module and a communication function module. The monitor module mainly monitors scanning interface codes and transmits the scanning interface codes to the data processing module. The data processing module is triggered after the listener module, and aims to scan and calculate whether the changed content is the function change of the interface and service call or not by calculating the comparison of the changed code content, and to feed back the changed condition confirmation update interface and service call content to the integration module, so that a new interface document is regenerated and cached. The communication module is mainly used for packaging the cached document content acquired from the integration module, automatically updating the interface document and updating the document resource stored in the interface center.
In an embodiment of the present invention, when the interface document management system provided in the embodiment of the present invention is implemented specifically, the listener module is specifically configured to:
monitoring an interface code of a scanning application program to obtain the change condition of the interface code;
and comparing the cached interface and the service calling code according to the interface code change condition, determining comparison change data, and transmitting the comparison change data to the data processing module.
In the embodiment, the listener module mainly monitors scanning interface codes, compares cached interfaces and service calling codes, compares change conditions and transmits change data to the data processing module;
in an embodiment of the present invention, when the interface document management system provided in the embodiment of the present invention is implemented specifically, the communication function module is specifically configured to:
obtaining the cached interface document from the integration module to obtain the interface document content;
packaging the interface document content into update content, exposing an Http interface to call the outside to inquire or download the interface document, and automatically updating the interface document through the update content;
and transmitting the updated interface document to the interface center to replace the old version document, and updating the document resource of the interface center.
In the embodiment, the communication function module mainly encapsulates the cached document content acquired from the integration module, exposes the Http interface to call the external world to query or download the interface document, and automatically transmits the updated document to the interface center device to replace the old version document.
Fig. 3 is a flowchart of an internal principle execution process of an integrated module of an interface document management system according to an embodiment of the present invention, where the integrated module provided by the present invention is a core, and a specific internal design principle execution process is shown in fig. 3, and when an interface document management system according to an embodiment of the present invention is implemented, in an embodiment, the integrated module is specifically configured to:
starting an application program, loading the custom annotation added in the application program to start the Swagger, and loading a document configuration class introduced by using the introduced annotation;
introducing a WebMvc configuration class of a Restful interface type and a WebRpc configuration class of an RPC call type interface by introducing annotation in a document configuration class;
registering an API plug-in class, an operation type plug-in class and a parameter plug-in class through a WebMvc configuration class, and registering an RPC type plug-in class through a WebRpc configuration class;
performing package scanning on the package where the document starter class is located through the webMvc configuration class and the WebRpc configuration class;
the method comprises the steps that registration classes of four plug-in classes, namely an API plug-in class, an operation type plug-in class, a parameter plug-in class and an RPC type plug-in class, which are registered in are injected into a document plug-in manager class to manage the document plug-in manager class;
introducing and instantiating a document plug-in manager class through a document launcher class;
calling and executing four plugin document examples managed in the document plugin manager class example by using a document starter class through a scanning method;
scanning a function of a plug-in document instance, starting to execute traversal on four plug-ins and executing internal code content of the plug-ins;
respectively scanning the four packaged document objects, acquiring interface information of related annotations through the plug-in class objects, and transmitting the interface information to corresponding construction classes;
constructing class object assembly processing interface information, and transmitting the interface information to a corresponding entity class object to construct interface information data;
and transmitting the constructed structure information data to a document cache class object, uniformly assembling all contents, packaging a Restful interface to be exposed to outside for calling, and automatically sending interface document data to an interface center according to the configured address of the interface center.
Referring to fig. 3, the integrated module internal principle execution process flow includes:
step S1: the application program is started, a self-defined annotation 'start Swagger' (@ StartSwagger) added in the application program is loaded, a document configuration class (documentConfiguration) introduced by using an 'introduction' (@ Import) annotation is loaded, and then all managed classes mentioned in the following steps are loaded by the program as if the managed classes are buckled by a ring;
step S2: the document configuration class (DocumentConfiguration) annotates the WebMvc configuration class (WebMvcconfiguration) introducing the Restful interface type and the WebRpc configuration class (WebRpcconfiguration) calling the type interface internally with an 'Import' (@ Import);
step S3: the method comprises the following steps that API plug-in classes (ApiPlugin. class), operation type plug-in classes (Operationplug. class), parameter plug-in classes (Parameterglug. class) and RPC type plug-in classes (Rpcplug. class) are respectively registered by the WebMvc configuration class (WebMvcConfiguration) and the WebRpc configuration class (WebRpcConfiguration);
step S4: the webMvc configuration class (WebMvcConfiguration) and the WebRpc configuration class (WebRpcConfiguration) simultaneously scan the package where the document starter class (documentStarter) is located;
step S5: the document plug-in manager class (DocumentPluginManager) injects the registered classes of the four plug-in classes registered in step S3 to manage them;
step S6: the document launcher class (DocumentStarter) introduces and instantiates the document plug-in manager class (documentplugmanager);
step S7: the document launcher class (DocumentStarter) calls and executes four plug-in document instances managed in the document plug-in manager class (documentplugingmanager) by a scanning method;
step S8: scanning a function of a plug-in (plug-in) document instance to start executing traversing four plug-ins and executing the code content inside;
step S9: respectively scanning four encapsulated Document objects (documents), acquiring interface information of related annotations through plug-in class objects, and transmitting the interface information to corresponding construction class objects (Builder);
step S10: the interface information is assembled and processed by the construction class object (Builder) and transmitted to the corresponding entity object (Bean) for information data construction
Step S11: all interface information is transmitted to a document cache object, the object uniformly assembles all contents, encapsulates a Restful interface and exposes the Restful interface to the outside for calling, and automatically sends document data to an interface center according to a configured address of the interface center.
In a specific implementation of the interface document management system provided in the embodiment of the present invention, in an embodiment, four packaged document objects are scanned, interface information of a relevant annotation is obtained through a plug-in object, and is transferred to a corresponding configuration class, where the method includes:
the Api document class is used for scanning the @ Api annotation; wherein the @ Api annotation is used above the class;
the operation type document class is used for scanning the comments using the correlation in the Restful interface; wherein the associated annotations include: responding to the message annotation and the attribute provided in the annotation, the Http method and protocol used;
the parameter document class is used for scanning the annotations used in the Restful interface and the attributes contained in the annotations, and includes: inputting parameters and return value attributes;
the RPC document class is for a program interface that uses RPC calls;
the four packaged document objects are performed concurrently, and each document object consists of three parts: plug-in type, structure type and entity type;
wherein, the interface information includes: interface name, class name, parameters, response data, request type, and description information, etc.
In an embodiment, in the step S9, the specific process includes: the Api document Class (ApiDocument) is mainly used for scanning the @ Api annotation, which is mainly used on top of the Class (Class); the operation type document class (operation document) is mainly used for scanning the relevant annotations used in the Restful interface, such as response message annotations and attributes provided in the annotations, such as the used Http method, protocol and the like; the parameter document class (ParameterDocument) is mainly used for scanning the annotations that are used in the Restful interface and the attributes that the annotations contain, such as the input parameter and the return value attribute. The RPC document class (Rpcdocument) is primarily directed to program interfaces that use RPC calls. The four encapsulated Document (Document) objects are concurrent, and each Document is composed of three parts: plug-in class, architecture class, and entity class. The plug-in (plug-in) acquires the information of the interface of the relevant annotation, including the interface name, the class name, the parameters, the response data, the request type, the description information and the like, and transmits the information to the corresponding Builder object for processing.
The invention aims to solve the problem that the API interface document which can simultaneously support a plurality of interface types is difficult to generate, provides an application of a mixed interface type to generate the API interface document and supports real-time updating of document content and management of document content, such as testing, query and the like, through modifying a bottom code and extracting an adaptation layer. Its advantages are as follows: 1. and meanwhile, the API document generation of multiple interface types is supported. 2. The method can dynamically and accurately monitor the change capture of the interface code content, and the change of the non-interface code content is not captured, so that a real-time new interface document is generated and automatically updated. 3. And a document interface API is provided, so that the external calling inquiry and the downloading of interface documents are facilitated.
The embodiment of the invention also provides a method for realizing interface document management by using the interface document management system, which mainly comprises the following steps:
step 1: based on the Swagger bottom layer code, a set of self-defined annotations is extracted, and a layer of adaptive layer code is added, wherein the code is realized by adopting inheritance and reference. The adaptation layer functionality can be mapped to underlying different functional interface codes.
Step 2: by using the principle of Git to detect file change, content change is compared in a Sha-1 mode, changed files are recorded before and after being changed and are transmitted to a real-time monitoring program to scan the changed files, the method interface modification before and after the modification is compared (code modification in the method is not calculated and modified and cannot be recorded), and the code modification is fed back to the files to be updated in time, so that the problem of inconsistent versions is avoided.
The implementation of the invention also provides a specific example of an interface document management system, which is an interface document management system implemented based on Swagger, and the whole system comprises 4 parts: the system comprises an application program, an integration module, a monitoring module and an interface center. The monitoring system comprises an application program, an integrated module, an interface center, a monitoring module and an application program, wherein the integrated module is integrated in the application program, the integrated module is connected with the interface center, the interface center is connected with the integrated module, the monitoring module is integrated in the application program, and the monitoring module is integrated in the application program.
The application program comprises the following steps: where the business logic is implemented, and provides interfaces such as Restful or RPC for the integrated architecture scan to use.
An integration module: the system is responsible for integrating codes, defining custom notes, scanning application program interface codes, generating documents and providing document interface calls in a mode of reconstructing a bottom API.
An interface center: the method mainly receives and manages the interface document of the application program.
A monitoring module: and monitoring the change condition of the interface codes, and automatically and dynamically updating the interface document and the document resources stored in the interface center aiming at the change.
The monitoring module mainly comprises three modules: the system comprises a listener module, a data processing module and a communication function module, wherein the listener module mainly monitors and scans interface codes, compares cached interfaces and service calling codes, compares change conditions and transmits change data to the data processing module; the data processing module is triggered after the listener module, and aims to scan and calculate whether the changed content is the function change of the interface and service call or not by calculating the comparison of the changed code content, and to feed back the changed condition confirmation update interface and service call content to the integration module, so that a new interface document is regenerated and cached. The communication module mainly encapsulates the cached document content acquired from the integration module, exposes the Http interface to call the external inquiry or download the interface document, and automatically transmits the updated document to the interface center device to replace the old document.
The integrated module provided by the invention is a core, and the specific principle execution process of internal design comprises the following steps:
step S1: the application program is started, a self-defined annotation 'start Swagger' (@ StartSwagger) added in the application program is loaded, a document configuration class (documentConfiguration) introduced by using an 'introduction' (@ Import) annotation is loaded, and then all managed classes mentioned in the following steps are loaded by the program as if the managed classes are buckled by a ring;
step S2: the document configuration class (DocumentConfiguration) annotates the WebMvc configuration class (WebMvcconfiguration) introducing the Restful interface type and the WebRpc configuration class (WebRpcconfiguration) calling the type interface internally with an 'Import' (@ Import);
step S3: the method comprises the following steps that API plug-in classes (ApiPlugin. class), operation type plug-in classes (Operationplug. class), parameter plug-in classes (Parameterglug. class) and RPC type plug-in classes (Rpcplug. class) are respectively registered by the WebMvc configuration class (WebMvcConfiguration) and the WebRpc configuration class (WebRpcConfiguration);
step S4: the webMvc configuration class (WebMvcConfiguration) and the WebRpc configuration class (WebRpcConfiguration) simultaneously scan the package where the document starter class (documentStarter) is located;
step S5: the document plug-in manager class (DocumentPluginManager) injects the registered classes of the four plug-in classes registered in step S3 to manage them;
step S6: the document launcher class (DocumentStarter) introduces and instantiates the document plug-in manager class (documentplugmanager);
step S7: the document launcher class (DocumentStarter) calls and executes four plug-in document instances managed in the document plug-in manager class (documentplugingmanager) by a scanning method;
step S8: scanning a function of a plug-in (plug-in) document instance to start executing traversing four plug-ins and executing the code content inside;
step S9: wherein the Api document Class (ApiDocument) is primarily used for scanning the @ Api annotation, which is primarily used on top of the Class (Class); the operation type document class (operation document) is mainly used for scanning the relevant annotations used in the Restful interface, such as response message annotations and attributes provided in the annotations, such as the used Http method, protocol and the like; the parameter document class (ParameterDocument) is mainly used for scanning the annotations that are used in the Restful interface and the attributes that the annotations contain, such as the input parameter and the return value attribute. The RPC document class (Rpcdocument) is primarily directed to program interfaces that use RPC calls. The four encapsulated Document (Document) objects are concurrent, and each Document is composed of three parts: plug-in class, architecture class, and entity class. The plug-in (plug) acquires the information of the interface of the relevant annotation, including the interface name, the class name, the parameters, the response data, the request type, the description information and the like, and transmits the information to the corresponding construction class object (Builder) for processing;
step S10: the construction class object (Builder) assembles and processes the interface information and transmits the interface information to the corresponding entity object (Bean) for information data construction;
step S11: all interface information is transmitted to a document cache object, the object uniformly assembles all contents, encapsulates a Restful interface and exposes the Restful interface to the outside for calling, and automatically sends document data to an interface center according to a configured address of the interface center.
The invention provides a Swagger framework based document generation and real-time update method, which shields bottom details by reconstructing a bottom API (application programming interface), extracts a set of adaptation layers supporting unified annotations of interfaces such as Restful and RPC (remote procedure call), and can support document generation and real-time update of various interfaces by introducing only one set of dependence and using the same set of annotations.
In order to solve the problem that the API interface document which can simultaneously support multiple interface types such as Restful, RPC and the like is difficult to generate, the invention provides a Swagger standard framework, and provides an application of a mixed interface type to generate the API interface document and support real-time updating of document content and management of document content, such as testing, query and the like, through bottom code modification and extraction of an adaptation layer. Its advantages are as follows: and meanwhile, the API document generation of multiple interface types is supported. The method can dynamically and accurately monitor the change capture of the interface code content, and the change of the non-interface code content is not captured, so that a real-time new interface document is generated and automatically updated. And a document interface API is provided, so that the external calling inquiry and the downloading of interface documents are facilitated.
The embodiment of the invention also provides a working method of the interface document management system, which is described in the following embodiment. Because the principle of solving the problems of the working method is similar to that of an interface document management system, the implementation of the working method can be referred to that of the interface document management system, and repeated parts are not described again.
Fig. 4 is a schematic diagram of a working method of an interface document management system according to an embodiment of the present invention, and as shown in fig. 4, the embodiment of the present invention further provides a working method of an interface document management system, which may include:
step 401: the application program realizes the service logic and provides an interface to generate an interface document; the interface center receives an interface document of an application program and performs document resource management;
step 402: the integration module integrates codes realized by business logic, defines custom annotation by reconstructing a bottom API, scans interface codes of an application program, collects interface data, generates an interface document to a cache and provides document interface calling;
step 403: the monitoring module monitors the change condition of the interface code of the application program, caches the content of the interface document, and automatically updates the interface document and the document resource stored in the interface center when the interface code changes.
In one embodiment, the method for monitoring the change of the interface code of the application program by the monitoring module, caching the content of the interface document, automatically updating the interface document when the interface code changes, and updating the document resource stored in the interface center includes:
the monitor module monitors the change condition of the interface code of the scanning application program and transmits the change condition to the data processing module;
the data processing module is triggered according to the change condition of the interface code transmitted by the monitor module, calculates the code content comparison of the interface change, scans and calculates whether the change condition is the function change condition of the interface and service call, confirms the update of the interface and service call content, feeds back the update to the integration module, and enables the integration module to regenerate a new interface document and cache the new interface document;
the communication function module packages the interface document content, automatically updates the interface document and updates the document resource stored in the interface center.
In an embodiment of the present invention, a method for operating an interface document management system, in which a listener module monitors a change condition of an interface code of a scanning application program and transmits the change condition to a data processing module, includes:
monitoring an interface code of a scanning application program to obtain the change condition of the interface code;
and comparing the cached interface and the service calling code according to the interface code change condition, determining comparison change data, and transmitting the comparison change data to the data processing module.
In one embodiment, a communication function module encapsulates contents of an interface document, automatically updates the interface document, and updates document resources stored in an interface center, including:
obtaining the cached interface document from the integration module to obtain the interface document content;
packaging the interface document content into update content, exposing an Http interface to call the outside to inquire or download the interface document, and automatically updating the interface document through the update content;
and transmitting the updated interface document to the interface center to replace the old version document, and updating the document resource of the interface center.
Fig. 5 is a schematic diagram of a computer device for executing a working method of an interface document management system implemented by the present invention, and as shown in fig. 5, an embodiment of the present invention further provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the working method of the interface document management system when executing the computer program.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program for executing a working method of implementing the above-described interface document management system is stored in the computer-readable storage medium.
To sum up, an interface document management system and a working method thereof provided by the embodiments of the present invention include: an application and interface center; the application program is used for realizing the business logic and providing an interface to generate an interface document; the interface center is used for receiving an interface document of an application program and managing document resources; an application program comprising: the monitoring system comprises an integration module and a monitoring module; the integration module is used for integrating codes realized by business logic, defining custom annotation by reconstructing a bottom API, scanning interface codes of an application program, collecting interface data, generating an interface document to a cache and providing document interface calling; and the monitoring module is used for monitoring the change condition of the interface code of the application program, caching the content of the interface document, automatically updating the interface document when the interface code changes and updating the document resource stored in the interface center. The invention shields the bottom details by reconstructing the bottom API, extracts a set of unified annotation supporting various interfaces, and can support the document generation and real-time update of various interfaces by only introducing a set of dependency and using the same set of annotation. Meanwhile, the generation of API documents of various interface types is supported, the change capture of the interface code content can be dynamically and accurately monitored, the change of the non-interface code content is not captured, a real-time new interface document is generated and automatically updated, a document interface API is provided, and the external calling, the query and the interface document downloading are facilitated.
The invention aims to solve the problem that the API interface document which can simultaneously support a plurality of interface types is difficult to generate, provides an application of a mixed interface type to generate the API interface document and supports real-time updating of document content and management of document content, such as testing, query and the like, through modifying a bottom code and extracting an adaptation layer. Its advantages are as follows: 1. and meanwhile, the API document generation of multiple interface types is supported. 2. The method can dynamically and accurately monitor the change capture of the interface code content, and the change of the non-interface code content is not captured, so that a real-time new interface document is generated and automatically updated. 3. And a document interface API is provided, so that the external calling inquiry and the downloading of interface documents are facilitated.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. An interface document management system, comprising: an application and interface center;
the application program is used for realizing the business logic and providing an interface to generate an interface document; the interface center is used for receiving an interface document of an application program and managing document resources;
an application program comprising: the monitoring system comprises an integration module and a monitoring module;
the integration module is used for integrating codes realized by business logic, defining custom annotation by reconstructing a bottom API, scanning interface codes of an application program, collecting interface data, generating an interface document to a cache and providing document interface calling;
and the monitoring module is used for monitoring the change condition of the interface code of the application program, caching the content of the interface document, automatically updating the interface document when the interface code changes and updating the document resource stored in the interface center.
2. The system of claim 1, wherein the monitoring module comprises: the system comprises a monitor module, a data processing module and a communication function module;
the monitor module is used for monitoring the interface code change condition of the scanning application program and transmitting the interface code change condition to the data processing module;
the data processing module is used for calculating code content comparison of interface change according to interface code change condition trigger transmitted by the monitor module, scanning and calculating whether the change condition is the function change condition of interface and service call, confirming and updating the interface and service call content, feeding back the updated interface and service call content to the integration module, and enabling the integration module to regenerate a new interface document and cache the new interface document;
and the communication function module is used for packaging the interface document content, automatically updating the interface document and updating the document resource stored in the interface center.
3. The system of claim 2, wherein the listener module is specifically configured to:
monitoring an interface code of a scanning application program to obtain the change condition of the interface code;
and comparing the cached interface and the service calling code according to the interface code change condition, determining comparison change data, and transmitting the comparison change data to the data processing module.
4. The system of claim 2, wherein the communication function module is specifically configured to:
obtaining the cached interface document from the integration module to obtain the interface document content;
packaging the interface document content into update content, exposing an Http interface to call the outside to inquire or download the interface document, and automatically updating the interface document through the update content;
and transmitting the updated interface document to the interface center to replace the old version document, and updating the document resource of the interface center.
5. An operating method of an interface document management system, comprising:
the application program realizes the service logic and provides an interface to generate an interface document; the interface center receives an interface document of an application program and performs document resource management;
the integration module integrates codes realized by business logic, defines custom annotation by reconstructing a bottom API, scans interface codes of an application program, collects interface data, generates an interface document to a cache and provides document interface calling;
the monitoring module monitors the change condition of the interface code of the application program, caches the content of the interface document, and automatically updates the interface document and the document resource stored in the interface center when the interface code changes.
6. The method of claim 5, wherein the monitoring module monitors changes in application interface code, caches interface document content, automatically updates interface documents when interface code changes, and updates document resources stored in the interface center, comprising:
the monitor module monitors the change condition of the interface code of the scanning application program and transmits the change condition to the data processing module;
the data processing module is triggered according to the change condition of the interface code transmitted by the monitor module, calculates the code content comparison of the interface change, scans and calculates whether the change condition is the function change condition of the interface and service call, confirms the update of the interface and service call content, feeds back the update to the integration module, and enables the integration module to regenerate a new interface document and cache the new interface document;
the communication function module packages the interface document content, automatically updates the interface document and updates the document resource stored in the interface center.
7. The method of claim 6, wherein the listener module listens for changes in interface code of the scanning application for communication to the data processing module, comprising:
monitoring an interface code of a scanning application program to obtain the change condition of the interface code;
and comparing the cached interface and the service calling code according to the interface code change condition, determining comparison change data, and transmitting the comparison change data to the data processing module.
8. The method of claim 6, wherein the communication function module encapsulates interface document contents, automatically updates the interface document, and updates document resources stored in the interface center, comprising:
obtaining the cached interface document from the integration module to obtain the interface document content;
packaging the interface document content into update content, exposing an Http interface to call the outside to inquire or download the interface document, and automatically updating the interface document through the update content;
and transmitting the updated interface document to the interface center to replace the old version document, and updating the document resource of the interface center.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements a method of operation of the system of any one of claims 5 to 8 when executing the computer program.
10. A computer-readable storage medium, characterized in that it stores a computer program for executing a method of operation implementing the system of any one of claims 5 to 8.
CN202110503931.3A 2021-05-10 2021-05-10 Interface document management system and working method thereof Active CN113157792B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110503931.3A CN113157792B (en) 2021-05-10 2021-05-10 Interface document management system and working method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110503931.3A CN113157792B (en) 2021-05-10 2021-05-10 Interface document management system and working method thereof

Publications (2)

Publication Number Publication Date
CN113157792A true CN113157792A (en) 2021-07-23
CN113157792B CN113157792B (en) 2024-04-30

Family

ID=76874235

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110503931.3A Active CN113157792B (en) 2021-05-10 2021-05-10 Interface document management system and working method thereof

Country Status (1)

Country Link
CN (1) CN113157792B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117421071A (en) * 2023-12-18 2024-01-19 山东山大华天软件有限公司 Visual package method and integrated system for plug-in service

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107515771A (en) * 2017-09-07 2017-12-26 蓝海天网科技有限公司 API document structure tree method and system based on SpringMVC
CN107766040A (en) * 2017-09-19 2018-03-06 深圳市买买提乐购金融服务有限公司 A kind of method, apparatus and computer-readable recording medium for generating interface document
US20190325074A1 (en) * 2018-04-18 2019-10-24 International Business Machines Corporation Application programing interface document generator
CN110377336A (en) * 2019-06-17 2019-10-25 平安普惠企业管理有限公司 Interface document generation method, device, computer equipment and storage medium
CN110806863A (en) * 2019-11-05 2020-02-18 泰康保险集团股份有限公司 Interface document generation method and device, electronic equipment and storage medium
CN111258627A (en) * 2020-01-14 2020-06-09 中国建设银行股份有限公司 Interface document generation method and device
CN112540862A (en) * 2020-12-23 2021-03-23 东莞市盟大塑化科技有限公司 Interface document data generation method, device, equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107515771A (en) * 2017-09-07 2017-12-26 蓝海天网科技有限公司 API document structure tree method and system based on SpringMVC
CN107766040A (en) * 2017-09-19 2018-03-06 深圳市买买提乐购金融服务有限公司 A kind of method, apparatus and computer-readable recording medium for generating interface document
US20190325074A1 (en) * 2018-04-18 2019-10-24 International Business Machines Corporation Application programing interface document generator
CN110377336A (en) * 2019-06-17 2019-10-25 平安普惠企业管理有限公司 Interface document generation method, device, computer equipment and storage medium
CN110806863A (en) * 2019-11-05 2020-02-18 泰康保险集团股份有限公司 Interface document generation method and device, electronic equipment and storage medium
CN111258627A (en) * 2020-01-14 2020-06-09 中国建设银行股份有限公司 Interface document generation method and device
CN112540862A (en) * 2020-12-23 2021-03-23 东莞市盟大塑化科技有限公司 Interface document data generation method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117421071A (en) * 2023-12-18 2024-01-19 山东山大华天软件有限公司 Visual package method and integrated system for plug-in service
CN117421071B (en) * 2023-12-18 2024-03-29 山东山大华天软件有限公司 Visual package method and integrated system for plug-in service

Also Published As

Publication number Publication date
CN113157792B (en) 2024-04-30

Similar Documents

Publication Publication Date Title
CN105657191B (en) Application increment upgrading method and system based on Android system
CN106569880B (en) Method and system for dynamically sharing resources between Android applications
CN110750315B (en) Class loading method, device, equipment and storage medium in Android system
CN110673853A (en) Compiling method, device and system
CN112769706B (en) Componentized routing method and system
CN110659261A (en) Data mining model publishing method, model and model service management method
CN111176717A (en) Method and device for generating installation package and electronic equipment
CN113326030A (en) Service request processing method and device
CN113157792B (en) Interface document management system and working method thereof
CN115509515A (en) Component reuse method and device, electronic equipment and storage medium
CN114879976A (en) Version environment deployment method and device and electronic equipment
CN115729590A (en) Service deployment method, device, equipment and computer readable storage medium
CN115934199A (en) Service performance monitoring tool, method, device and medium
CN115859280A (en) Memory horse detection method, device, equipment and storage medium
CN116755788A (en) On-line rule modification method, device, equipment and storage medium
CN110825373A (en) Dynamic method and device for mobile terminal
CN106598663B (en) Web application updating method and web server
CN115129348A (en) Resource updating method, device and equipment of application program and readable storage medium
CN112134900B (en) Data message processing method and device
CN114253546A (en) Code generation method and device, storage medium and electronic device
CN112905306A (en) Multi-cluster container management method and device, electronic equipment and storage medium
US11966719B2 (en) Event consumption for high-level programing language platform
US20240036946A1 (en) Event provisioning for high-level programing language platform
CN113419743B (en) Comprehensive application script deployment method, device, equipment and storage medium
CN114253547A (en) Frame generation method and device, storage medium and electronic device

Legal Events

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