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

Interface document management system and working method thereof Download PDF

Info

Publication number
CN113157792B
CN113157792B CN202110503931.3A CN202110503931A CN113157792B CN 113157792 B CN113157792 B CN 113157792B CN 202110503931 A CN202110503931 A CN 202110503931A CN 113157792 B CN113157792 B CN 113157792B
Authority
CN
China
Prior art keywords
interface
document
class
plug
module
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.)
Active
Application number
CN202110503931.3A
Other languages
Chinese (zh)
Other versions
CN113157792A (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

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 the interface document of the application program and managing document resources; an application program comprising: an integration module and a monitoring module; the integration module is used for integrating codes realized by the business logic, defining custom notes by reconstructing a bottom API, scanning application program interface codes and collecting interface data, generating interface documents to a cache, and providing document interface call; and the monitoring module is used for monitoring the change condition of the interface codes of the application programs, caching the content of the interface documents, automatically updating the interface documents when the interface codes change, and updating the document resources stored in the interface center. The method is used for shielding the details of the bottom layer by reconstructing the bottom layer API, and supporting the generation and the real-time updating of various types of 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 especially 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, service logic becomes heavy, so that the service logic can be split into a plurality of service interfaces and interfaces of different types such as Restful, RPC and the like to realize the calling of different service functions, and if an interface document is indispensable for development and debugging, a special place for managing the interface document is needed for a large interface.
At present, document management of different interface types in the industry is realized based on Swagger and is independent, and a set of unified realization management of display and content update of various interface documents is not available, so that the application cannot perform custom parameters to collect more index contents.
Therefore, how to provide a new solution to the above technical problem 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 the details of a bottom layer by reconstructing the bottom layer API, extracts a set of unified notes supporting various interfaces, and can support document generation and real-time updating of various interfaces by only introducing a set of dependencies and using the same set of notes by an application, 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 the interface document of the application program and managing document resources;
An application program comprising: an integration module and a monitoring module;
The integration module is used for integrating codes realized by the business logic, defining custom notes by reconstructing a bottom API, scanning application program interface codes and collecting interface data, generating interface documents to a cache, and providing document interface call;
And the monitoring module is used for monitoring the change condition of the interface codes of the application programs, caching the content of the interface documents, automatically updating the interface documents when the interface codes change, and updating the document resources 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 business logic and provides an interface to generate an interface document; the interface center receives the interface document of the application program and manages document resources;
The integration module integrates codes realized by business logic, defines custom notes by reconstructing a bottom API, scans application program interface codes and collects interface data, generates interface documents to a cache, and provides document interface call;
the monitoring module monitors the interface code change condition of the application program, caches the content of the interface document, automatically updates the interface document when the interface code changes and updates the document resources stored in the interface center.
The embodiment of the invention also provides computer equipment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the working method of the interface document management system is realized when the processor executes the computer program.
The embodiment of the invention also provides a computer readable storage medium, which stores a computer program for executing the working method of the interface document management system.
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 the interface document of the application program and managing document resources; an application program comprising: an integration module and a monitoring module; the integration module is used for integrating codes realized by the business logic, defining custom notes by reconstructing a bottom API, scanning application program interface codes and collecting interface data, generating interface documents to a cache, and providing document interface call; and the monitoring module is used for monitoring the change condition of the interface codes of the application programs, caching the content of the interface documents, automatically updating the interface documents when the interface codes change, and updating the document resources stored in the interface center. The invention shields the details of the bottom layer by reconstructing the bottom layer API, extracts a set of unified notes supporting multiple interfaces, and can support document generation and real-time updating of various interfaces by only introducing a set of dependence and using the same set of notes. Meanwhile, the generation of multiple interface type API documents is supported, the change capture of interface code content can be dynamically and accurately monitored, the change of 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 of inquiry and downloading of the interface document are facilitated.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. In the drawings:
FIG. 1 is a schematic diagram of an interface document management system according to an embodiment of the present invention.
FIG. 2 is a diagram showing an internal structure of a monitoring module of an interface document management system according to an embodiment of the present invention,
FIG. 3 is a flow chart illustrating a process for executing the internal principle of the integrated module of the interface document management system according to the embodiment of the invention.
FIG. 4 is a schematic diagram of a working method of 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 of operation of an interface document management system embodying the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention will be described in further detail with reference to the accompanying drawings. The exemplary embodiments of the present invention and their descriptions herein are for the purpose of explaining the present invention, but are not to be construed as limiting the invention.
FIG. 1 is a schematic diagram of an interface document management system according to an embodiment of the present invention, as shown in FIG. 1, where the interface document management system according to the embodiment of the present invention shields details of a bottom layer by reconstructing the bottom layer API, and extracts a set of unified annotations supporting multiple interfaces, and an application only needs to introduce a set of dependencies and use the same set of annotations to support document generation and real-time update of various types of interfaces, 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 the interface document of the application program and managing document resources;
An application program comprising: an integration module and a monitoring module;
The integration module is used for integrating codes realized by the business logic, defining custom notes by reconstructing a bottom API, scanning application program interface codes and collecting interface data, generating interface documents to a cache, and providing document interface call;
And the monitoring module is used for monitoring the change condition of the interface codes of the application programs, caching the content of the interface documents, automatically updating the interface documents when the interface codes change, and updating the document resources stored in the interface center.
The embodiment of the invention provides an interface document management system, which 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 the interface document of the application program and managing document resources; an application program comprising: an integration module and a monitoring module; the integration module is used for integrating codes realized by the business logic, defining custom notes by reconstructing a bottom API, scanning application program interface codes and collecting interface data, generating interface documents to a cache, and providing document interface call; and the monitoring module is used for monitoring the change condition of the interface codes of the application programs, caching the content of the interface documents, automatically updating the interface documents when the interface codes change, and updating the document resources stored in the interface center. The invention shields the details of the bottom layer by reconstructing the bottom layer API, extracts a set of unified notes supporting multiple interfaces, and can support document generation and real-time updating of various interfaces by only introducing a set of dependence and using the same set of notes. Meanwhile, the generation of multiple interface type API documents is supported, the change capture of interface code content can be dynamically and accurately monitored, the change of 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 of inquiry and downloading of the interface document 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 implementation. Referring to fig. 1, in an embodiment of the present invention, when an interface document management system is implemented, 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 the interface document of the application program and managing document resources;
An application program comprising: an integration module and a monitoring module;
The integration module is used for integrating codes realized by the business logic, defining custom notes by reconstructing a bottom API, scanning application program interface codes and collecting interface data, generating interface documents to a cache, and providing document interface call;
And the monitoring module is used for monitoring the change condition of the interface codes of the application programs, caching the content of the interface documents, automatically updating the interface documents when the interface codes change, and updating the document resources stored in the interface center.
In an embodiment, an interface document management system integrally includes an application program and an interface center, where an integration module is integrated inside the application program, the integration module is connected with the interface center, the interface center is connected to the integration module, a monitoring module is integrated inside the application program, and the monitoring module is integrated inside the application program.
Application program: and the service logic is realized, and provides an interface such as Restful or RPC for the scanning of the integrated architecture.
Interface center: mainly receiving and managing interface documents of application programs.
And (3) an integration module: is responsible for integrating codes, defining custom notes by reconstructing modes of an API at the bottom layer, scanning application program interface codes, generating documents and providing document interface calls.
And a monitoring module: the interface code change condition is monitored, and the interface document and document resources stored in the interface center are automatically and dynamically updated for the change.
FIG. 2 is a diagram illustrating an internal structure 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 the interface document management system according to the embodiment of the present invention is implemented, in one 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 the code content comparison of interface variation according to the interface code variation triggering transmitted by the monitor module, scanning and calculating whether the variation is the function variation of interface and service call, confirming and updating the interface and service call content, feeding back to the integration module, and enabling the integration module to regenerate a new interface document and cache;
And the communication function module is used for packaging the content of the interface document, automatically updating the interface document and updating the document resource stored in the interface center.
In the embodiment, as shown in fig. 2, the internal structure of the monitoring module is schematically shown, and the internal structure mainly includes three modules: monitor module, data processing module, communication function module. The monitor module is used for monitoring the scanning interface code and transmitting the scanning interface code to the data processing module. The data processing module is triggered after the monitor module, and aims to scan and calculate whether the changed content is the function change of the interface and the service call through comparing the changed code content, and feed back the changed condition confirmation update interface and the service call content to the integration module, so that the integration module regenerates a new interface document and caches the new interface document. 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.
When the interface document management system provided by the embodiment of the invention is implemented, in one embodiment, the aforementioned monitor module is specifically configured to:
monitoring an interface code of a scanning application program, and obtaining the variation condition of the interface code;
and comparing the cached interface with the service call code according to the change condition of the interface code, determining comparison change data, and transmitting the comparison change data to the data processing module.
In the embodiment, the monitor module mainly monitors the scanning interface code, compares the cached interface and the service call code, compares the change condition, and transmits the change data to the data processing module;
When the interface document management system provided by the embodiment of the invention is implemented, in one embodiment, the communication function module is specifically configured to:
Obtaining a cached interface document from the integrated module to obtain interface document content;
Packaging the interface document content into updated content, exposing the Http interface to the outside for calling and inquiring or downloading the interface document, and automatically updating the interface document through the updated content;
and transmitting the updated interface document to an 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 the outside for calling and inquiring or downloading the interface document, and automatically transmits the updated document to the interface center device for replacing the old document.
Fig. 3 is a flow chart 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 the interface document management system according to the embodiment of the present invention is implemented, in an embodiment, the integrated module is specifically configured to:
Starting an application program, loading a custom annotation start Swagger added in the application program, and loading a document configuration class using introduction of an annotation;
Using an incoming annotation to introduce WebMvc configuration classes of the Restful interface type and WebRpc configuration classes of the RPC call type interface inside the document configuration classes;
Registering an API plugin class, an operation type plugin class and a parameter plugin class through WebMvc configuration classes, and registering an RPC type plugin class through WebRpc configuration classes;
Carrying out package scanning on packages where the document initiator class is located through webMvc configuration classes and WebRpc configuration classes at the same time;
the method comprises the steps that the registration classes of four plug-ins of 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 are injected through a document plug-in manager class to manage the four plug-ins;
Introducing and instantiating a document plug-in manager class through a document initiator class;
the method comprises the steps that a document starter class is utilized to call and execute four plug-in document instances managed in a document plug-in manager class instance through a scanning method;
scanning functions of the plug-in document examples to start to execute traversing on the four plug-ins and executing code contents inside the four plug-ins;
Scanning the four encapsulated document objects respectively, acquiring interface information of relevant notes through the plug-in class object, and transmitting the interface information to a corresponding construction class;
constructing class object assembly processing interface information, and transmitting the interface information to a corresponding entity class object for interface information data construction;
and transmitting the constructed structural information data to a document cache class object, uniformly assembling all the contents, packaging the Restful interface, exposing the Restful interface to external calling, and automatically transmitting interface document data to an interface center according to the address of the configured interface center.
Referring to fig. 3, the integrated module internal principle performs a process flow, including:
Step S1: the application program starts, the custom annotation "start Swagger" (@ STARTSWAGGER) added in the application program is loaded, the document configuration class (DocumentConfiguration) using the "introduce" (@ Import) annotation introduction is loaded, and then all the managed classes mentioned in the following steps are loaded into the program like a loop-to-loop;
step S2: the document configuration class (DocumentConfiguration) internally annotates the WebMvc configuration class (WebMvcConfiguration) of the import Restful interface type and the WebRpc configuration class (WebRpcConfiguration) of the RPC call type interface with "import" (@ Import);
Step S3: webMvc configuration classes (WebMvcConfiguration) and WebRpc configuration classes (WebRpcConfiguration) register API plugin classes (apiplus. Class), operation type plugin classes (operationplug in. Class), parameter plugin classes (parameterplug in. Class), and RPC type plugin classes (rpcpplug in. Class), respectively;
Step S4: webMvc configuration classes (WebMvcConfiguration) and WebRpc configuration class (WebRpcConfiguration) are used for simultaneously carrying out packet scanning on packets where the document initiator class (DocumentStarter) is located;
step S5: the document plug-in manager class (DocumentPluginManager) injects the registration classes of the four plug-in classes registered in the step S3 into the document plug-in manager class to manage the document plug-in classes;
Step S6: the document launcher class (DocumentStarter) imports and instantiates a document plug-in manager class (DocumentPluginManager);
step S7: the document initiator class (DocumentStarter) executes the four plug-in (Plugin) document instance calls managed in the document plug-in manager class (DocumentPluginManager) instance through a scanning method;
Step S8: the function of the scanning plug-in (plug in) document instance starts to execute traversing the four plug-ins and executing the code content inside the four plug-ins;
step S9: scanning the four encapsulated Document objects (documents) respectively, acquiring interface information of relevant notes through the plug-in class objects, and transmitting the interface information to corresponding construction class objects (building);
step S10: the construction class object (Builder) assembles and processes the interface information, and transmits the interface information to the corresponding entity object (Bean) to construct information data
Step S11: all interface information is transferred to a document cache class (DocumentCache) object, the object performs final assembly on all contents uniformly, and encapsulates the Restful interface to be exposed to external call, and automatically sends document data to an interface center according to the address of the configured interface center.
When the interface document management system provided by the embodiment of the invention is implemented, in one embodiment, four encapsulated document objects are scanned respectively, interface information of relevant notes is acquired through plug-in class objects and is transmitted to corresponding construction classes, and the interface document management system comprises:
The Api document class is a scan for @ Api annotations; wherein the @ Api annotation is for the class above;
The operation type document class is used for scanning relevant notes used in the Restful interface; wherein the associated annotation comprises: responding to the message annotation and the attribute provided in the annotation, and using the Http method and protocol;
The parameter document class is used for scanning relevant notes used in the Restful interface and the attributes contained in the notes, and comprises the following steps: inputting parameters and return value attributes;
the RPC document class is a program interface for calling for using RPC;
wherein, four encapsulated document objects are concurrent, each document object is composed of three parts: plug-in class, construction class and entity class;
wherein, interface information includes: interface name, class name, parameters, response data, request type, description information, etc.
In the embodiment, the specific process in step S9 includes: the Api document Class (ApiDocument) is used primarily for scanning @ Api annotations, which are primarily for classes (classes) above; the operation type document class (OperationDocument) is mainly used for scanning relevant notes used in the Restful interface, such as response message notes and attributes provided in the notes, such as the Http method, protocol and the like used; the parameter document class (ParameterDocument) is used primarily to scan for relevant annotations used in the Restful interface and the attributes contained in the annotations, such as input parameters and return value attributes. The RPC document class (RpcDocument) is primarily directed to a program interface that uses RPC calls. The four encapsulated Document (Document) objects described above are concurrent, each Document being composed of three parts: plug-in class, construction class, entity class. The plug-in class (Plugin) obtains the information of the interface of the relevant annotation, including the interface name, class name, parameters, response data, request type, 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 generation of API interface documents capable of supporting multiple interface types is difficult, and provides the application of mixed interface types to generate the API interface documents and support the updating of document contents and the management of document contents in real time, such as testing, inquiring and the like, through the modification of a bottom layer code and the extraction of an adaptation layer. The advantages are as follows: 1. while supporting multiple interface type API document generation. 2. The method can dynamically and accurately monitor the change capture of the interface code content, the non-interface code content change is not captured, and a real-time new interface document is generated and automatically updated. 3. And providing a document interface API, and facilitating the external call to inquire and download the interface document.
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 Swagger bottom code, a set of custom notes is extracted, and a layer of adaptation layer code is added, wherein the code adopts an inheritance and reference implementation mode. The adaptation layer function can map to different functional interface code of the bottom layer.
Step 2: by referring to the Git detection file change principle, content change is compared firstly by a Sha-1 mode, the changed file is recorded before and after the change and is transmitted to a real-time monitoring program to scan the content of the changed file, the method interfaces before and after the change are compared with each other (the code in the method is not modified and cannot be recorded), and the method interfaces are fed back to the document to update in time, so that the problem of inconsistent versions is avoided.
The embodiment of the invention also provides a specific example of an interface document management system, which is an interface document management system based on Swagger realization, and the whole system comprises 4 parts: application program, integration module, monitoring module, interface center. The application program is internally integrated with the integrated module, 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.
Application program: and the service logic is realized, and provides an interface such as Restful or RPC for the scanning of the integrated architecture.
And (3) an integration module: is responsible for integrating codes, defining custom notes by reconstructing modes of an API at the bottom layer, scanning application program interface codes, generating documents and providing document interface calls.
Interface center: mainly receiving and managing interface documents of application programs.
And a monitoring module: the interface code change condition is monitored, and the interface document and document resources stored in the interface center are automatically and dynamically updated for the change.
The inside of the monitoring module mainly comprises three modules: the system comprises a monitor module, a data processing module and a communication function module, wherein the monitor module is mainly used for monitoring a scanning interface code, comparing a cached interface with a service calling code, comparing a change condition and transmitting change data to the data processing module; the data processing module is triggered after the monitor module, and aims to scan and calculate whether the changed content is the function change of the interface and the service call through comparing the changed code content, and feed back the changed condition confirmation update interface and the service call content to the integration module, so that the integration module regenerates a new interface document and caches the new interface document. The communication module is mainly used for packaging the cached document content acquired from the integration module, exposing the Http interface to the outside for calling and inquiring or downloading the interface document, and automatically transmitting the updated document to the interface center device for replacing the old document.
The integrated module provided by the invention is a core, and a specific internal design principle execution process comprises the following steps:
Step S1: the application program starts, the custom annotation "start Swagger" (@ STARTSWAGGER) added in the application program is loaded, the document configuration class (DocumentConfiguration) using the "introduce" (@ Import) annotation introduction is loaded, and then all the managed classes mentioned in the following steps are loaded into the program like a loop-to-loop;
step S2: the document configuration class (DocumentConfiguration) internally annotates the WebMvc configuration class (WebMvcConfiguration) of the import Restful interface type and the WebRpc configuration class (WebRpcConfiguration) of the RPC call type interface with "import" (@ Import);
Step S3: webMvc configuration classes (WebMvcConfiguration) and WebRpc configuration classes (WebRpcConfiguration) register API plugin classes (apiplus. Class), operation type plugin classes (operationplug in. Class), parameter plugin classes (parameterplug in. Class), and RPC type plugin classes (rpcpplug in. Class), respectively;
Step S4: webMvc configuration classes (WebMvcConfiguration) and WebRpc configuration class (WebRpcConfiguration) are used for simultaneously carrying out packet scanning on packets where the document initiator class (DocumentStarter) is located;
step S5: the document plug-in manager class (DocumentPluginManager) injects the registration classes of the four plug-in classes registered in the step S3 into the document plug-in manager class to manage the document plug-in classes;
Step S6: the document launcher class (DocumentStarter) imports and instantiates a document plug-in manager class (DocumentPluginManager);
step S7: the document initiator class (DocumentStarter) executes the four plug-in (Plugin) document instance calls managed in the document plug-in manager class (DocumentPluginManager) instance through a scanning method;
Step S8: the function of the scanning plug-in (plug in) document instance starts to execute traversing the four plug-ins and executing the code content inside the four plug-ins;
Step S9: wherein the Api document Class (ApiDocument) is used primarily for scanning @ Api annotations, primarily for classes (classes) above; the operation type document class (OperationDocument) is mainly used for scanning relevant notes used in the Restful interface, such as response message notes and attributes provided in the notes, such as the Http method, protocol and the like used; the parameter document class (ParameterDocument) is used primarily to scan for relevant annotations used in the Restful interface and the attributes contained in the annotations, such as input parameters and return value attributes. The RPC document class (RpcDocument) is primarily directed to a program interface that uses RPC calls. The four encapsulated Document (Document) objects described above are concurrent, each Document being composed of three parts: plug-in class, construction class, entity class. The plug-in class (Plugin) acquires information of an interface of the relevant annotation, including interface name, class name, parameters, response data, request type, description information and the like, and transmits the information to a corresponding construction class object (Builder) for processing;
Step S10: constructing class objects (building) to assemble and process the interface information, and transmitting the interface information to corresponding entity objects (beans) to construct information data;
Step S11: all interface information is transferred to a document cache class (DocumentCache) object, the object performs final assembly on all contents uniformly, and encapsulates the Restful interface to be exposed to external call, and automatically sends document data to an interface center according to the address of the configured interface center.
The invention provides a Swagger framework, which is used for extracting a set of adaptation layers supporting uniform annotations of interfaces such as Restful, RPC and the like by shielding bottom details in a bottom API reconstruction mode, wherein the application can support document generation and real-time updating of various interfaces by only introducing a set of dependencies and using the same set of annotations.
In order to solve the problem that the generation of API interface documents capable of supporting multiple interface types such as Restful, RPC and the like is difficult, the invention provides a Swagger standard framework, which is used for providing an application of a mixed interface type to generate the API interface document and supporting the updating of the document content and the management of the document content in real time, such as testing, inquiring and the like through the modification of a bottom layer code and the extraction of an adaptation layer. The advantages are as follows: while supporting multiple interface type API document generation. The method can dynamically and accurately monitor the change capture of the interface code content, the non-interface code content change is not captured, and a real-time new interface document is generated and automatically updated. And providing a document interface API, and facilitating the external call to inquire and download the interface document.
The embodiment of the invention also provides a working method of the interface document management system, as described in the following embodiment. Because the principle of the working method for solving the problem is similar to that of an interface document management system, the implementation of the working method can refer to the implementation of the interface document management system, and the repetition is omitted.
FIG. 4 is a schematic diagram of a working method of an interface document management system according to an embodiment of the present invention, as shown in FIG. 4, where the working method of the interface document management system according to the embodiment of the present invention may include:
Step 401: the application program realizes the business logic and provides an interface to generate an interface document; the interface center receives the interface document of the application program and manages document resources;
Step 402: the integration module integrates codes realized by business logic, defines custom notes by reconstructing a bottom API, scans application program interface codes and collects interface data, generates interface documents to a cache, and provides document interface call;
Step 403: the monitoring module monitors the interface code change condition of the application program, caches the content of the interface document, automatically updates the interface document when the interface code changes and updates the document resources stored in the interface center.
In one embodiment, a monitoring module monitors the change condition of an application program interface code, caches the content of the interface document, automatically updates the interface document and updates document resources stored in an interface center when the interface code is changed, and comprises:
The monitor module monitors the interface code change condition of the scanning application program and transmits the interface code change condition to the data processing module;
The data processing module is triggered according to the interface code change condition transmitted by the monitor module, calculates the code content comparison of interface change, scans and calculates whether the change condition is the function change condition of interface and service call, confirms and updates the interface and service call content, and feeds back the interface and service call content to the integration module, so that the integration module regenerates a new interface document and caches the new interface document;
The communication function module encapsulates the content of the interface document, automatically updates the interface document and updates the document resources stored in the interface center.
In an embodiment, a monitor module monitors the interface code variation condition of a scanning application program and transmits the interface code variation condition to a data processing module, and the method comprises the following steps:
monitoring an interface code of a scanning application program, and obtaining the variation condition of the interface code;
and comparing the cached interface with the service call code according to the change condition of the interface code, determining comparison change data, and transmitting the comparison change data to the data processing module.
In an embodiment, the communication function module encapsulates the content of the interface document, automatically updates the interface document and updates the document resource stored in the interface center, and the working method comprises the following steps:
Obtaining a cached interface document from the integrated module to obtain interface document content;
Packaging the interface document content into updated content, exposing the Http interface to the outside for calling and inquiring or downloading the interface document, and automatically updating the interface document through the updated content;
and transmitting the updated interface document to an 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 running a working method of an interface document management system according to an embodiment of 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 on the memory and capable of running on the processor, where the processor implements the working method of an interface document management system when executing the computer program.
Embodiments of the present invention also provide a computer-readable storage medium storing a computer program for executing an operation method for implementing the above-described one interface document management system.
In summary, the interface document management system and the working method thereof provided by the embodiment of the invention comprise 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 the interface document of the application program and managing document resources; an application program comprising: an integration module and a monitoring module; the integration module is used for integrating codes realized by the business logic, defining custom notes by reconstructing a bottom API, scanning application program interface codes and collecting interface data, generating interface documents to a cache, and providing document interface call; and the monitoring module is used for monitoring the change condition of the interface codes of the application programs, caching the content of the interface documents, automatically updating the interface documents when the interface codes change, and updating the document resources stored in the interface center. The invention shields the details of the bottom layer by reconstructing the bottom layer API, extracts a set of unified notes supporting multiple interfaces, and can support document generation and real-time updating of various interfaces by only introducing a set of dependence and using the same set of notes. Meanwhile, the generation of multiple interface type API documents is supported, the change capture of interface code content can be dynamically and accurately monitored, the change of 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 of inquiry and downloading of the interface document are facilitated.
The invention aims to solve the problem that the generation of API interface documents capable of supporting multiple interface types is difficult, and provides the application of mixed interface types to generate the API interface documents and support the updating of document contents and the management of document contents in real time, such as testing, inquiring and the like, through the modification of a bottom layer code and the extraction of an adaptation layer. The advantages are as follows: 1. while supporting multiple interface type API document generation. 2. The method can dynamically and accurately monitor the change capture of the interface code content, the non-interface code content change is not captured, and a real-time new interface document is generated and automatically updated. 3. And providing a document interface API, and facilitating the external call to inquire and download the interface document.
It will be appreciated by those skilled in the art that 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 flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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 foregoing description of the embodiments has been provided for the purpose of illustrating the general principles of the invention, and is not meant to limit the scope of the invention, but to limit the invention to the particular embodiments, and any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the invention are intended to be included within the scope of the 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 the interface document of the application program and managing document resources;
An application program comprising: an integration module and a monitoring module;
The integration module is used for integrating codes realized by the business logic, defining custom notes by reconstructing a bottom API, scanning application program interface codes and collecting interface data, generating interface documents to a cache, and providing document interface call;
the monitoring module is used for monitoring the change condition of the interface codes of the application programs, caching the content of the interface documents, automatically updating the interface documents when the interface codes change, and updating document resources stored in the interface center;
the integrated module is specifically used for:
Starting an application program, loading a custom annotation start Swagger added in the application program, and loading a document configuration class using introduction of an annotation; wherein, the document configuration class uses the WebMvc configuration class of introducing annotation introducing Restful interface type and WebRpc configuration class of RPC calling type interface;
Registering an API plugin class, an operation type plugin class and a parameter plugin class by utilizing WebMvc configuration classes, and registering an RPC type plugin class by utilizing WebRpc configuration classes;
carrying out package scanning on packages where the document starter class is located by utilizing WebMvc configuration classes and WebRpc configuration classes;
the method comprises the steps that a document plug-in manager class is utilized to inject registered API plug-in classes, operation type plug-in classes, parameter plug-in classes and RPC type plug-in classes into the registered classes for management;
introducing and instantiating a document plug-in manager class by using a document initiator class;
the method comprises the steps that a document starter class is utilized to call and execute four plug-in document instances managed in a document plug-in manager class instance through a scanning method;
Scanning functions of the plug-in document examples, starting to execute traversing on the four plug-ins and executing code contents inside the four plug-ins;
Scanning the four encapsulated document objects respectively, acquiring interface information of relevant notes through the plug-in class objects, and transmitting the interface information to the corresponding construction class objects;
the interface information is assembled and processed by utilizing the construction class object, and is transmitted to the corresponding entity object to carry out information data construction;
And transmitting all interface information to a document cache class object, uniformly and finally assembling all contents by the document cache class object, encapsulating the Restful interface, exposing the Restful interface to external calling, and automatically transmitting document data to an interface center according to the address of the configured 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 the code content comparison of interface variation according to the interface code variation triggering transmitted by the monitor module, scanning and calculating whether the variation is the function variation of interface and service call, confirming and updating the interface and service call content, feeding back to the integration module, and enabling the integration module to regenerate a new interface document and cache;
And the communication function module is used for packaging the content of the interface document, 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 configured to:
monitoring an interface code of a scanning application program, and obtaining the variation condition of the interface code;
and comparing the cached interface with the service call code according to the change condition of the interface code, determining comparison change data, and transmitting the comparison change data to the data processing module.
4. The system according to claim 2, wherein the communication function module is specifically configured to:
Obtaining a cached interface document from the integrated module to obtain interface document content;
Packaging the interface document content into updated content, exposing the Http interface to the outside for calling and inquiring or downloading the interface document, and automatically updating the interface document through the updated content;
and transmitting the updated interface document to an interface center to replace the old version document, and updating the document resource of the interface center.
5. A method of operating an interface document management system, comprising:
the application program realizes the business logic and provides an interface to generate an interface document; the interface center receives the interface document of the application program and manages document resources;
The integration module is used for integrating codes realized by business logic, defining custom notes by reconstructing a bottom API, scanning application program interface codes and collecting interface data, generating interface documents to a cache, and providing document interface call, and the method comprises the following steps:
Starting an application program, loading a custom annotation start Swagger added in the application program, and loading a document configuration class using introduction of an annotation; wherein, the document configuration class uses the WebMvc configuration class of introducing annotation introducing Restful interface type and WebRpc configuration class of RPC calling type interface;
Registering an API plugin class, an operation type plugin class and a parameter plugin class by utilizing WebMvc configuration classes, and registering an RPC type plugin class by utilizing WebRpc configuration classes;
carrying out package scanning on packages where the document starter class is located by utilizing WebMvc configuration classes and WebRpc configuration classes;
the method comprises the steps that a document plug-in manager class is utilized to inject registered API plug-in classes, operation type plug-in classes, parameter plug-in classes and RPC type plug-in classes into the registered classes for management;
introducing and instantiating a document plug-in manager class by using a document initiator class;
the method comprises the steps that a document starter class is utilized to call and execute four plug-in document instances managed in a document plug-in manager class instance through a scanning method;
Scanning functions of the plug-in document examples, starting to execute traversing on the four plug-ins and executing code contents inside the four plug-ins;
Scanning the four encapsulated document objects respectively, acquiring interface information of relevant notes through the plug-in class objects, and transmitting the interface information to the corresponding construction class objects;
the interface information is assembled and processed by utilizing the construction class object, and is transmitted to the corresponding entity object to carry out information data construction;
transmitting all interface information to a document cache class object, uniformly assembling all contents by the document cache class object, encapsulating a Restful interface, exposing the Restful interface to external calling, and automatically transmitting document data to an interface center according to the address of the configured interface center;
the monitoring module monitors the interface code change condition of the application program, caches the content of the interface document, automatically updates the interface document when the interface code changes and updates the document resources stored in the interface center.
6. The method of claim 5, wherein the monitoring module monitors application program interface code changes, caches interface document content, automatically updates interface documents when the interface code changes, and updates document resources stored in the interface center, comprising:
The monitor module monitors the interface code change condition of the scanning application program and transmits the interface code change condition to the data processing module;
The data processing module is triggered according to the interface code change condition transmitted by the monitor module, calculates the code content comparison of interface change, scans and calculates whether the change condition is the function change condition of interface and service call, confirms and updates the interface and service call content, and feeds back the interface and service call content to the integration module, so that the integration module regenerates a new interface document and caches the new interface document;
The communication function module encapsulates the content of the interface document, automatically updates the interface document and updates the document resources stored in the interface center.
7. The method of claim 6, wherein the monitor module monitors changes in the interface code of the scanning application and communicates the changes to the data processing module, comprising:
monitoring an interface code of a scanning application program, and obtaining the variation condition of the interface code;
and comparing the cached interface with the service call code according to the change condition of the interface code, 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 interface documents, and updates document resources stored in the interface center, comprising:
Obtaining a cached interface document from the integrated module to obtain interface document content;
Packaging the interface document content into updated content, exposing the Http interface to the outside for calling and inquiring or downloading the interface document, and automatically updating the interface document through the updated content;
and transmitting the updated interface document to an 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, characterized in that the processor implements the method of operating the system according to any of claims 5 to 8 when executing the computer program.
10. A computer-readable storage medium, characterized in that it stores a computer program which, when executed by a processor, implements a method of operating the system according to 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 CN113157792A (en) 2021-07-23
CN113157792B true 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)

Families Citing this family (1)

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

Citations (6)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10839011B2 (en) * 2018-04-18 2020-11-17 International Business Machines Corporation Application programing interface document generator

Patent Citations (6)

* 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
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

Also Published As

Publication number Publication date
CN113157792A (en) 2021-07-23

Similar Documents

Publication Publication Date Title
US9158510B2 (en) System and computer program product for creating a telecommunications application
CN105657191A (en) Application increment upgrading method and system based on Android system
CN110569250B (en) Management method and device for analysis library of Internet of things network element
CN110750315B (en) Class loading method, device, equipment and storage medium in Android system
CN110308999B (en) Method for dynamically sharing dependency package between applications, storage medium and mobile terminal
CN113157792B (en) Interface document management system and working method thereof
CN103488696A (en) Business query method, device and system of CPE (customer premises equipment), ACS (auto-configuration server) and CPE
CN113326030A (en) Service request processing method and device
CN109725887B (en) Data interaction method and device based on message research and development framework and terminal equipment
CN116204239A (en) Service processing method, device and computer readable storage medium
CN116974948B (en) Service system testing method, system, equipment and medium
CN110825373B (en) Mobile terminal dynamic method and device
CN115729590A (en) Service deployment method, device, equipment and computer readable storage medium
CN112134900B (en) Data message processing method and device
CN115934199A (en) Service performance monitoring tool, method, device and medium
CN116755788A (en) On-line rule modification method, device, equipment and storage medium
CN106598663B (en) Web application updating method and web server
CN114253546A (en) Code generation method and device, storage medium and electronic device
CN115016836A (en) Component version management method and device, electronic equipment and system
CN108305161A (en) A kind of paying taxes service interface carding method and device
CN111309319A (en) Inheritable office data dynamic page configuration method and device
US11966719B2 (en) Event consumption for high-level programing language platform
CN111198721A (en) Application program running method and device
US20240036946A1 (en) Event provisioning for high-level programing language platform
CN117573395B (en) Remote scheduling method and system between micro services

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