CN114443905A - Interface document updating method and device, electronic equipment and readable storage medium - Google Patents

Interface document updating method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN114443905A
CN114443905A CN202210125566.1A CN202210125566A CN114443905A CN 114443905 A CN114443905 A CN 114443905A CN 202210125566 A CN202210125566 A CN 202210125566A CN 114443905 A CN114443905 A CN 114443905A
Authority
CN
China
Prior art keywords
file
document
interface
update
markup language
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.)
Pending
Application number
CN202210125566.1A
Other languages
Chinese (zh)
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.)
Xiamen Yaji Software Co Ltd
Original Assignee
Xiamen Yaji Software Co Ltd
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 Xiamen Yaji Software Co Ltd filed Critical Xiamen Yaji Software Co Ltd
Publication of CN114443905A publication Critical patent/CN114443905A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion
    • G06F16/86Mapping to a database
    • 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/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • 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
    • G06F16/258Data format conversion from or to a database
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/283Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides an interface document updating method and device, electronic equipment and a readable storage medium, and relates to the technical field of computers. The method comprises the following steps: monitoring the code remote warehouse, and acquiring an update file from the code remote warehouse when the code remote warehouse receives the update file, wherein the update file comprises update contents of interface configuration parameters aiming at least one interface; and then generating a markup language file corresponding to the update file based on the update file, and sending the markup language file to the document remote warehouse, so that the document remote warehouse can update the interface document corresponding to the markup language file based on the markup language file. According to the interface document updating method, the code remote warehouse is monitored, the updating process is automatically triggered when the updating file is received, the updating file is converted into the markup language file, and the markup language file is sent to the document remote warehouse to update the corresponding interface document, so that the interface document updating efficiency is improved.

Description

Interface document updating method and device, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to an interface document updating method and apparatus, an electronic device, and a readable storage medium.
Background
Along with the gradual development of computer technology, the computing power and resource management capability provided by a computer for people are gradually improved, people can create and manage more complex and various projects based on the computer technology, before a project with rich contents is brought on line, the heart and blood of multiple departments are necessarily combined in the process of developing the project, and the communication and coordination among the departments and research and development personnel are particularly important. Among them, the API (Application Programming Interface) document is an effective "communication medium" that can call the interfaces of different modules in a project and clearly explain the parameters involved therein.
For example, for a software system containing many functions, different functional modules may be developed by developers in different departments. After the modular development is completed, the research and development staff of any department can inform other research and development staff how to use the functional module developed by the department by providing the API document for the research and development staff of other departments, and similarly, the research and development staff of the department can know how to perform the collaborative development by reading the API document provided by other departments.
At present, most API documents are manually maintained, updated and deployed by people, the maintenance cost is high, and the updating efficiency of the API documents is low.
Disclosure of Invention
The embodiment of the application aims to solve the problem of low updating efficiency of the interface document.
In a first aspect, an interface document updating method is provided, and the method includes:
monitoring the code remote warehouse, and acquiring an update file from the code remote warehouse when the code remote warehouse receives the update file; the update file comprises update content of interface configuration parameters for at least one interface;
generating a markup language file corresponding to the update file based on the update file;
and sending the markup language file to the document remote warehouse so that the document remote warehouse updates the interface document corresponding to the markup language file based on the markup language file.
In an optional embodiment of the first aspect, obtaining the update file from the code remote repository when the update file is received by the code remote repository comprises:
receiving update triggering information sent by the code remote warehouse through a preset event processing interface, wherein the update triggering information is sent by the code remote warehouse when an update file is received;
in response to receiving the update trigger information, an update file acquisition request is sent to the code remote repository to acquire the update file from the code remote repository.
In an optional embodiment of the first aspect, generating a markup language file corresponding to the update file based on the update file includes:
analyzing the updated file to obtain an analysis result, and generating a JSON file corresponding to the updated file based on the analysis result;
and calling a preset code processing platform to analyze the JSON file, and generating a markup language file corresponding to the updated file based on the analyzed JSON file.
In an optional embodiment of the first aspect, generating, based on the parsed JSON file, a markup language file corresponding to the update file includes:
determining a target template corresponding to the analyzed JSON file;
and generating a markup language file corresponding to the updated file based on the analyzed JSON file and the target template.
In an optional embodiment of the first aspect, the parsing the JSON file includes a template identifier and update content corresponding to the update file, and determining a target template corresponding to the parsed JSON file includes:
detecting a preset semantic template library;
if the template corresponding to the template identifier exists in the semantic template library, taking the template corresponding to the template identifier as a target template corresponding to the updated file;
if the template corresponding to the template identification does not exist in the semantic template library, sending prompt information to a target client corresponding to the updated file; receiving template configuration information returned by the target client, and generating a target template corresponding to the update file based on the template configuration information; the target client is a client submitting the update file to the code remote warehouse, and the prompt information is used for prompting that the template corresponding to the update file does not exist in the semantic template library.
In an optional embodiment of the first aspect, the method further comprises:
monitoring the document remote warehouse, and if the document remote warehouse updates the interface document based on the markup language file, acquiring the updated interface document from the document remote warehouse;
configuring at least one interface based on the updated interface document;
responding to the received interface document viewing request, and sending the updated interface document to a client corresponding to the interface document viewing request, so that the client can render and update a document display interface of the client based on the updated interface document; the document display interface is used for displaying interface configuration parameters of at least one interface.
In a second aspect, an interface document updating apparatus is provided, the apparatus including:
the first monitoring module is used for monitoring the code remote warehouse and acquiring the update file from the code remote warehouse when the code remote warehouse receives the update file; the update file comprises update content of interface configuration parameters for at least one interface;
the file generation module is used for generating a markup language file corresponding to the update file based on the update file;
and the document updating module is used for sending the markup language file to the document remote warehouse so that the document remote warehouse updates the interface document corresponding to the markup language file based on the markup language file.
In an optional embodiment of the second aspect, when the code remote repository receives the update file, the first monitoring module is specifically configured to:
receiving update triggering information sent by the code remote warehouse through a preset event processing interface, wherein the update triggering information is sent by the code remote warehouse when an update file is received;
in response to receiving the update trigger information, an update file acquisition request is sent to the code remote repository to acquire the update file from the code remote repository.
In an optional embodiment of the second aspect, when the file generation module generates the markup language file corresponding to the update file based on the update file, the file generation module is specifically configured to:
analyzing the updated file to obtain an analysis result, and generating a JSON file corresponding to the updated file based on the analysis result;
and calling a preset code processing platform to analyze the JSON file, and generating a markup language file corresponding to the updated file based on the analyzed JSON file.
In an optional embodiment of the second aspect, when the file generation module generates the markup language file corresponding to the updated file based on the parsed JSON file, the file generation module is specifically configured to:
determining a target template corresponding to the analyzed JSON file;
and generating a markup language file corresponding to the updated file based on the analyzed JSON file and the target template.
In an optional embodiment of the second aspect, when the parsed JSON file includes a template identifier and an update content corresponding to the update file, and the target template corresponding to the parsed JSON file is determined, the file generation module is specifically configured to:
detecting a preset semantic template library;
if the template corresponding to the template identifier exists in the semantic template library, taking the template corresponding to the template identifier as a target template corresponding to the updated file;
if the template corresponding to the template identification does not exist in the semantic template library, sending prompt information to a target client corresponding to the updated file; receiving template configuration information returned by the target client, and generating a target template corresponding to the update file based on the template configuration information; the target client is a client submitting the update file to the code remote warehouse, and the prompt information is used for prompting that the template corresponding to the update file does not exist in the semantic template library.
In an optional embodiment of the second aspect, the apparatus further comprises:
the second monitoring module is used for monitoring the document remote warehouse, and acquiring an updated interface document from the document remote warehouse if the document remote warehouse updates the interface document based on the markup language document;
the interface configuration module is used for configuring values for at least one interface based on the interface document;
the document sending module is used for responding to the received interface document viewing request, sending the interface document to the client corresponding to the interface document viewing request, so that the client can render and update the document display interface of each client based on the interface document; the document display interface is used for displaying interface configuration parameters of at least one interface.
In a third aspect, an electronic device is provided, which includes:
the interface document updating method comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor realizes the interface document updating method of any embodiment when executing the program.
In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, which when executed by a processor implements the interface document updating method of any of the above embodiments.
In a fifth aspect, a computer program product or computer program is provided, the computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device implements the method provided in the embodiment of the first aspect when executed.
According to the interface document updating method, the code remote warehouse is monitored, when the code remote warehouse receives the update file, the update file is obtained from the code remote warehouse, and the update file comprises the update content of the interface configuration parameters aiming at least one interface. And then generating a markup language file corresponding to the update file based on the update file, and sending the markup language file to the document remote warehouse, so that the document remote warehouse can update the interface document corresponding to the markup language file based on the markup language file. According to the interface document updating method, the code remote warehouse is monitored, the updating process is automatically triggered when the updating file is received, the updating file is converted into the markup language file, and the markup language file is sent to the document remote warehouse to update the corresponding interface document, so that the interface document updating efficiency is improved.
Drawings
Fig. 1 is a schematic flowchart of an interface document updating method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of an interface document updating method according to an embodiment of the present application;
FIG. 3 is a schematic structural diagram of an interface document updating apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device for interface document update according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the embodiments set forth below in connection with the drawings are exemplary descriptions for explaining technical solutions of the embodiments of the present application, and do not limit the technical solutions of the embodiments of the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should be further understood that the terms "comprises" and/or "comprising," when used in this specification in connection with embodiments of the present application, specify the presence of stated features, information, data, steps, operations, elements, and/or components, but do not preclude the presence or addition of other features, information, data, steps, operations, elements, components, and/or groups thereof, as embodied in the art. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein indicates at least one of the items defined by the term, e.g., "a and/or B" may be implemented as "a", or as "B", or as "a and B".
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The terms referred to in this application will first be introduced and explained:
API (Application Programming Interface): some predefined interfaces, or conventions that refer to the joining of different components of a software system, are used to provide a set of routines that an application program and developer can access based on certain software or hardware without accessing source code or understanding the details of the internal working mechanisms.
API document (interface document): a clear explanation of all, interface calls and interface configuration parameters involved therein.
Webhook (hook): an API concept is one of the usage paradigms of the micro service API, and is also called a reverse API, i.e. the front end does not actively send a request, and is completely pushed or processed by the back end. The more widely used method can be understood as monitoring a, and after a certain specified event is monitored, executing a preset task by B.
The technical solutions of the embodiments of the present application and the technical effects produced by the technical solutions of the present application will be described below through descriptions of several exemplary embodiments. It should be noted that the following embodiments may be referred to, referred to or combined with each other, and the description of the same terms, similar features, similar implementation steps and the like in different embodiments is not repeated.
An embodiment of the present application provides an interface document updating method, as shown in fig. 1, where the method may be applied to a server, and may include the following steps:
step S101, monitoring a code remote warehouse, and acquiring an update file from the code remote warehouse when the code remote warehouse receives the update file; the update file includes updated content of interface configuration parameters for at least one interface.
Where a remote repository may refer to a version library of items hosted in the internet or other network. And the code remote repository may be the same as storing different versions of the code file. The code repository in this application may be a remote repository dedicated to storing code associated with the interface configuration.
The essence of the update file may be a code file comprising updated content of interface configuration parameters for at least one interface. When the developer writes the update file, the update file may be submitted to a code remote repository through Git (distributed version control system).
The code remote repository may be snooped, and when it is snooped that the code remote repository receives the update file, the update file may be obtained from the code remote repository. Specifically, in an actual application scenario, a WebHook technology may be used to monitor the code remote repository.
In this embodiment of the present application, when the code remote repository receives an update file, acquiring the update file from the code remote repository may include the following steps:
(1) and receiving update triggering information sent by the code remote warehouse through a preset event processing interface, wherein the update triggering information is sent by the code remote warehouse when an update file is received.
The update trigger information may be a preset simple character, and may also include more information such as sending time, and the application is not limited. The update trigger information may be used to indicate that the monitored code remote repository triggered a specified event, which in this application may be that the code remote repository received an update file.
In an actual application scenario, a WebHook technology may be used to monitor a code remote repository, and the specific implementation method may be as follows: leaving a URL (Uniform Resource Locator) in the code remote repository, that is, presetting an event processing interface, and taking a specified event as a trigger event, where the trigger event in this embodiment may be that the code remote repository receives an update file; monitoring the code remote warehouse, sending update trigger information to the server through the URL when the code remote warehouse receives the update file, and acquiring the update file from the code remote warehouse after the server receives the update trigger information.
(2) In response to receiving the update trigger information, sending an update file acquisition request to a code remote repository to acquire the update file from the code remote repository.
In other embodiments, when it is monitored that the code remote repository receives the update file, after the code remote repository sends the update trigger information to the server, the code remote repository may directly send the update file to the server, or directly put the update file into the update trigger information, which is not limited in this application.
And step S102, generating a markup language file corresponding to the update file based on the update file. The markup language file can record the corresponding update content of the update file through a preset markup language.
Specifically, the markup language may be Markdown. Markdown is a lightweight markup language for writing, can replace typesetting with concise grammar, and has the advantages of easy writing and reading.
The markup language file can be a Markdown file, and the markup language file corresponding to the update file records the update content corresponding to the update file through a preset markup language.
In the embodiment of the present application, the language of the update file is not limited.
In one example, the update file may be a TypeScript source code file, which is an object oriented programming language developed and maintained by microsoft and may use concepts such as types and interfaces to describe the data being used, which enables developers to quickly detect errors and debug applications.
The process of generating the markup language file corresponding to the update file based on the update file may be: firstly, the TypeScript source code file is converted into a JSON file, then the JSON file is converted into a Markdown file, and the conversion method is explained in detail later.
In this embodiment of the present application, generating a markup language file corresponding to an update file based on the update file may include the following steps:
(1) and analyzing the updated file to obtain an analysis result, and generating a JSON file corresponding to the updated file based on the analysis result.
The updated file can be analyzed through a plug-in or a tool which is suitable for the language of the updated file, and the JSON file corresponding to the updated file is generated based on the analysis result.
Specifically, when the update file is a TypeScript source code file, the update file may be scanned through Typedoc (a document generation tool supporting TypeScript), and the comment and the source code in the update file (TypeScript source code file) are analyzed to generate a JSON file corresponding to the update file. And the JSON file corresponding to the update file expresses the update content corresponding to the update file in a simpler and clearer format.
(2) And calling a preset code processing platform to analyze the JSON file, and generating a markup language file corresponding to the updated file based on the analyzed JSON file.
In the embodiment of the present application, the code processing platform may include any platform, plug-in, and tool application program that can parse the JSON file, and the present application does not limit the code processing platform.
In an example, the preset code processing platform may be node.
And generating a markup language file corresponding to the updated file based on the parsed JSON file. In this example, a Markdown file corresponding to the update file may be generated based on the parsed JSON file.
In this embodiment of the present application, generating a markup language file corresponding to the updated file based on the parsed JSON file may include the following steps: determining a target template corresponding to the analyzed JSON file; and generating a markup language file corresponding to the updated file based on the analyzed JSON file and the target template.
Specifically, a Markdown file corresponding to the update file may be generated based on the parsed JSON file by HandleBar (a semantic template library of JavaScript). The target template corresponding to the analyzed JSON file can be determined, and then the Markdown file corresponding to the updated file can be generated based on the analyzed JSON file and the target template.
In this embodiment of the present application, the parsed JSON file may include a template identifier and an update content corresponding to the update file, and then determining a target template corresponding to the parsed JSON file may include the following steps:
detecting a preset semantic template library;
if the template corresponding to the template identifier exists in the semantic template library, taking the template corresponding to the template identifier as a target template corresponding to the updated file;
if the template corresponding to the template identification does not exist in the semantic template library, sending prompt information to a target client corresponding to the updated file; receiving template configuration information returned by the target client, and generating a target template corresponding to the update file based on the template configuration information; the target client is a client submitting the update file to the code remote warehouse, and the prompt information is used for prompting that the template corresponding to the update file does not exist in the semantic template library.
In an actual application scene, the semantic template library may refer to Handlebars, when templates corresponding to the update files do not exist in the Handlebars, prompt information may be sent to a target client of a research and development worker who submits the update files, template configuration information returned by the target client is received, a target template corresponding to the update files is generated based on the template configuration information, a template identifier of the generated target template is set as a template identifier in the analyzed JSON file, and the generated template is stored in the semantic template library, so that the next recall is facilitated.
Step S103, the markup language file is sent to the document remote warehouse, so that the document remote warehouse updates the interface configuration parameters of at least one interface in the interface document corresponding to the markup language file based on the markup language file.
In this embodiment of the present application, when the document remote repository receives a markup language file submitted by the server, if the document remote repository has a project administrator, the project administrator may audit the submitted markup language file, and if the audit is passed, the project administrator may give an update instruction, so that the document remote repository updates an interface document corresponding to the markup language file according to the markup language file, specifically, updates an interface configuration parameter of at least one interface corresponding to an update content included in the markup language file in the interface document.
If the document remote repository does not have a project manager, when the document remote repository receives the markup language file, the document remote repository may automatically update the interface configuration parameter of at least one interface in the interface document corresponding to the markup language file based on the markup language file.
In this embodiment of the present application, the interface document may be a Markdown file.
According to the interface document updating method, the code remote warehouse is monitored, when the code remote warehouse receives the update file, the update file is obtained from the code remote warehouse, and the update file comprises the update content of the interface configuration parameters aiming at least one interface. And then generating a markup language file corresponding to the update file based on the update file, and sending the markup language file to the document remote warehouse, so that the document remote warehouse can update the interface document corresponding to the markup language file based on the markup language file. According to the interface document updating method, the code remote warehouse is monitored, the updating process is automatically triggered when the updating file is received, the updating file is converted into the markup language file, and the markup language file is sent to the document remote warehouse to update the corresponding interface document, so that the interface document updating efficiency is improved.
The embodiment of the present application provides a possible implementation manner, and the interface document updating method provided by the present application further includes the following steps:
(1) monitoring the document remote warehouse, and if the document remote warehouse updates the interface document based on the markup language file, acquiring the updated interface document from the document remote warehouse;
compared with the markup language file corresponding to the update file, the updated interface document not only contains the update content, but also contains the content which is associated with the update content and needs to be synchronously redeployed.
(2) At least one interface is configured based on the interface document.
The interface document may be deployed in a mirror image manner, specifically, at least one interface may be configured based on the interface document, where the at least one interface may be an interface associated with the update content, or may be all interfaces, and the present application is not limited thereto.
(3) Responding to the received interface document viewing request, sending the updated interface document to the client corresponding to the interface document viewing request, so that the client can render and update the document display interface of each client based on the updated interface document; the document display interface is used for displaying interface configuration parameters of at least one interface.
When an interface document viewing request sent by any client connected with the server is received, the updated interface document can be sent to the client corresponding to the request, so that the client can render and update the document display interface of the client based on the updated interface document through the rendering engine, and a user can see the updated interface configuration parameters of each interface on the document display interface.
In the embodiment of the application, the updated interface document can be analyzed by a docswift (document website generating tool), and the document display interface of the client is dynamically rendered.
In one example, as shown in fig. 2, the interface document updating method provided by the present application may include the following steps:
step S201, monitoring the code remote warehouse, and receiving update trigger information sent by the code remote warehouse through a preset event processing interface when the code remote warehouse receives an update file, wherein the update trigger information is sent by the code remote warehouse when the code remote warehouse receives the update file;
step S202, responding to the received updating trigger information, sending an updating file acquisition request to a code remote warehouse so as to acquire an updating file from the code remote warehouse, wherein the updating file comprises updating contents of interface configuration parameters aiming at least one interface;
step S203, analyzing the updated file to obtain an analysis result, and generating a JSON file corresponding to the updated file based on the analysis result;
step S204, calling a preset code processing platform to analyze the JSON file to obtain an analyzed JSON file;
step S205, detecting a preset semantic template library;
if the template corresponding to the template identifier exists in the semantic template library, taking the template corresponding to the template identifier as a target template corresponding to the updated file;
if the template corresponding to the template identification does not exist in the semantic template library, sending prompt information to a target client corresponding to the updated file; receiving template configuration information returned by the target client, and generating a target template corresponding to the update file based on the template configuration information; the target client is a client for submitting the update file to the code remote warehouse, and the prompt information is used for prompting that the template corresponding to the update file does not exist in the semantic template library;
step S206, generating a markup language file corresponding to the updated file based on the analyzed JSON file and the target template;
step S207, the markup language file is sent to the document remote warehouse so that the document remote warehouse updates the interface document corresponding to the markup language file based on the markup language file;
step S208, monitoring the document remote warehouse, and if the document remote warehouse updates the interface document based on the markup language file, acquiring the updated interface document from the document remote warehouse;
step S209, configuring at least one interface based on the updated interface document;
step S210, responding to the received interface document viewing request, sending the updated interface document to the client corresponding to the interface document viewing request, so that the client can render and update the document display interface of the client based on the updated interface document; the document display interface is used for displaying interface configuration parameters of at least one interface.
In order to explain the interface document updating method of the present application more clearly, the following will further explain the interface document updating method with reference to a specific example.
The application provides an interface document updating method which can be realized as an API document automatic updating system, and the system can comprise a client part and a server part, wherein the client part is used for interacting with research personnel, the server part is used for receiving an updating code sent by a client, generating a corresponding markup language file based on the updating code, and sending the markup language file to a document remote warehouse, so that the document remote warehouse updates the interface document corresponding to the markup language file based on the markup language file. The client part and the server part can respectively deploy corresponding platform or tool plug-ins according to project requirements, and the API document automatic updating system can automatically call the platform or the tool plug-ins to complete corresponding steps.
In one example, the interface document updating method provided by the present application may include the following steps:
step S01, monitoring the API code remote warehouse; when a developer submits an update file to the API code remote repository through Git (distributed version control system), the server may obtain update trigger information sent by the server or the terminal device of the API code remote repository through a preset event processing interface. The update file may include a part of code after being newly added, deleted or changed, or all code after being changed for a certain application or a certain file. The remote repository may refer to a version library of the various projects to which the developer belongs hosted in the internet or other network, and may enable collaboration with others involving managing the remote repository and pushing or pulling data as needed. In an actual application scenario, WebHook may be used to listen to the API code remote repository.
Step S02, in response to the received update trigger information, acquiring the update file from the API code remote repository, scanning and parsing the update file, and generating a JSON (JavaScript Object notification) file containing the update content based on the parsed update file. In an actual application scenario, when the update file is written in different languages, different document tools can be called to convert the update file into a JSON file. For example, when the update file is a TypeScript source code (TypeScript is an object-oriented programming language and can easily annotate key information), the update file may be scanned by Typedoc (TypeScript-supported document generation tool), parsed, and a JSON file containing the update content may be generated based on the parsed update file and the annotation content in the update file.
And step S03, analyzing the JSON file containing the updated content, and generating a markup language file according to the analyzed JSON file. The JSON file may be parsed by a node.js platform (a server-side javascript processing platform), and a markup language file may be generated based on the parsed JSON file by HandleBar (a javascript semantic template library), where the markup language file may be a Markdown file, and the markup language file may include updated content, that is, updated interface configuration parameters, and may be used to perform mirror image deployment on at least one server corresponding to the updated file, and may be used to render and display, in application interfaces of respective clients, invocation methods of respective interfaces corresponding to the updated interface configuration parameters and interpretations of parameters related to the respective interfaces. Markdown is a lightweight markup language for authoring that replaces typesetting with concise syntax. In an actual application scenario, the language of the markup language file may be determined according to a language that can be recognized by the rendering engine, and the present application is not limited thereto.
Generating the markup language file based on the analyzed JSON file through the HandleBar can comprise the following steps: determining or generating a target template corresponding to the analyzed JSON file; and taking the analyzed JSON file as an input object of the target template to generate a markup language file, wherein the text format of the markup language file can be a Markdown format.
Step S04, the markup language file is sent to the API document remote repository. Specifically, the markup language file can be submitted to the API document remote repository through the node.
And step S05, continuously monitoring the API document remote warehouse, when the API document remote warehouse stores the markup language file and updates the interface document corresponding to the markup language file based on the markup language file, acquiring the updated interface document from the server or the terminal equipment of the API document remote warehouse, executing a deployment script, and performing mirror deployment on the updated interface document, so that at least one server corresponding to the updated file is configured according to the interface configuration parameters of the updated interface document. Specifically, the remote repository of API documents may be listened to through WebHook.
Step S06, responding to the received interface document viewing request, sending the updated interface document to the client corresponding to the interface document viewing request, so that the client can render and update the document display interface of the client based on the updated interface document; the document display interface is used for displaying interface configuration parameters, calling methods and explanation of parameters related to each interface of at least one interface.
An embodiment of the present application provides an interface document updating apparatus, as shown in fig. 3, the interface document updating apparatus 30 may include: a first listening module 301, a file generating module 302, and a document updating module 303, wherein,
the first monitoring module 301 is configured to monitor the code remote repository, and when the code remote repository receives an update file, obtain the update file from the code remote repository; the update file comprises update content of interface configuration parameters for at least one interface;
a file generating module 302, configured to generate a markup language file corresponding to the update file based on the update file;
and the document updating module 303 is configured to send the markup language file to the document remote repository, so that the document remote repository updates the interface document corresponding to the markup language file based on the markup language file.
The interface document updating device monitors the code remote warehouse, and when the code remote warehouse receives the update file, the update file is obtained from the code remote warehouse, and the update file comprises the update content of the interface configuration parameters of at least one interface. And then generating a markup language file corresponding to the update file based on the update file, and sending the markup language file to the document remote warehouse, so that the document remote warehouse can update the interface document corresponding to the markup language file based on the markup language file. According to the interface document updating method, the code remote warehouse is monitored, the updating process is automatically triggered when the updating file is received, the updating file is converted into the markup language file, and the markup language file is sent to the document remote warehouse to update the corresponding interface document, so that the interface document updating efficiency is improved.
In this embodiment of the application, when the code remote repository receives the update file, and acquires the update file from the code remote repository, the first monitoring module 301 is specifically configured to:
receiving update triggering information sent by the code remote warehouse through a preset event processing interface, wherein the update triggering information is sent by the code remote warehouse when an update file is received;
in response to receiving the update trigger information, an update file acquisition request is sent to the code remote repository to acquire the update file from the code remote repository.
In this embodiment of the present application, when the file generating module 302 generates a markup language file corresponding to an update file based on the update file, it is specifically configured to:
analyzing the updated file to obtain an analysis result, and generating a JSON file corresponding to the updated file based on the analysis result;
and calling a preset code processing platform to analyze the JSON file, and generating a markup language file corresponding to the updated file based on the analyzed JSON file.
In this embodiment of the present application, when the file generation module 302 generates a markup language file corresponding to the updated file based on the parsed JSON file, specifically configured to:
determining a target template corresponding to the analyzed JSON file;
and generating a markup language file corresponding to the updated file based on the analyzed JSON file and the target template.
In this embodiment of the present application, when the parsed JSON file includes the template identifier and the update content corresponding to the update file, and the target template corresponding to the parsed JSON file is determined, the file generating module 302 is specifically configured to:
detecting a preset semantic template library;
if the template corresponding to the template identifier exists in the semantic template library, taking the template corresponding to the template identifier as a target template corresponding to the updated file;
if the template corresponding to the template identification does not exist in the semantic template library, sending prompt information to a target client corresponding to the updated file; receiving template configuration information returned by the target client, and generating a target template corresponding to the update file based on the template configuration information; the target client is a client submitting the update file to the code remote warehouse, and the prompt information is used for prompting that the template corresponding to the update file does not exist in the semantic template library.
In an embodiment of the present application, the apparatus further includes:
the second monitoring module is used for monitoring the document remote warehouse, and acquiring an updated interface document from the document remote warehouse if the document remote warehouse updates the interface document based on the markup language document;
the interface configuration module is used for configuring values for at least one interface based on the interface document;
the document sending module is used for responding to the received interface document viewing request, sending the interface document to the client corresponding to the interface document viewing request, so that the client can render and update the document display interface of each client based on the interface document; the document display interface is used for displaying interface configuration parameters of at least one interface.
The apparatus of the embodiment of the present application may execute the method provided by the embodiment of the present application, and the implementation principle is similar, the actions executed by the modules in the apparatus of the embodiments of the present application correspond to the steps in the method of the embodiments of the present application, and for the detailed functional description of the modules of the apparatus, reference may be specifically made to the description in the corresponding method shown in the foregoing, and details are not repeated here.
The embodiment of the present application provides an electronic device (computer apparatus/device/system), which includes a memory, a processor, and a computer program stored on the memory, where the processor executes the computer program to implement the steps of the service processing method, and compared with the related art, the method can implement: by monitoring the code remote warehouse, the updating process is automatically triggered when the updating file is received, the updating file is converted into a markup language file and is sent to the document remote warehouse to update the corresponding interface document, and the updating efficiency of the interface document is improved.
In an alternative embodiment, an electronic device is provided, as shown in fig. 4, the electronic device 4000 shown in fig. 4 comprising: a processor 4001 and a memory 4003. Processor 4001 is coupled to memory 4003, such as via bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, and the transceiver 4004 may be used for data interaction between the electronic device and other electronic devices, such as transmission of data and/or reception of data. In addition, the transceiver 4004 is not limited to one in practical applications, and the structure of the electronic device 4000 is not limited to the embodiment of the present application.
The Processor 4001 may be a CPU (Central Processing Unit), a general-purpose Processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 4001 may also be a combination that performs a computational function, including, for example, a combination of one or more microprocessors, a combination of a DSP and a microprocessor, or the like.
Bus 4002 may include a path that carries information between the aforementioned components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 4002 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 4, but this does not indicate only one bus or one type of bus.
The Memory 4003 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical Disc storage, optical Disc storage (including Compact Disc, laser Disc, optical Disc, digital versatile Disc, blu-ray Disc, etc.), a magnetic disk storage medium, other magnetic storage devices, or any other medium that can be used to carry or store a computer program and that can be Read by a computer, and is not limited herein.
The memory 4003 is used for storing computer programs for executing the embodiments of the present application, and is controlled by the processor 4001 to execute. The processor 4001 is used to execute computer programs stored in the memory 4003 to implement the steps shown in the foregoing method embodiments.
Among them, electronic devices include but are not limited to: mobile terminals such as mobile phones, notebook computers, PADs, etc., and fixed terminals such as digital TVs, desktop computers, etc.
Embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, and when being executed by a processor, the computer program may implement the steps and corresponding contents of the foregoing method embodiments.
Embodiments of the present application further provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps and corresponding contents of the foregoing method embodiments can be implemented.
The terms "first," "second," "third," "fourth," "1," "2," and the like in the description and in the claims of the present application and in the above-described drawings (if any) are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used are interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in other sequences than illustrated or otherwise described herein.
It should be understood that, although each operation step is indicated by an arrow in the flowchart of the embodiment of the present application, the implementation order of the steps is not limited to the order indicated by the arrow. In some implementation scenarios of the embodiments of the present application, the implementation steps in the flowcharts may be performed in other sequences as desired, unless explicitly stated otherwise herein. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on an actual implementation scenario. Some or all of these sub-steps or stages may be performed at the same time, or each of these sub-steps or stages may be performed at different times. In a scenario where execution times are different, an execution sequence of the sub-steps or the phases may be flexibly configured according to requirements, which is not limited in the embodiment of the present application.
The foregoing is only an optional implementation manner of a part of implementation scenarios in this application, and it should be noted that, for those skilled in the art, other similar implementation means based on the technical idea of this application are also within the protection scope of the embodiments of this application without departing from the technical idea of this application.

Claims (10)

1. An interface document update method, comprising:
monitoring a code remote warehouse, and acquiring an update file from the code remote warehouse when the code remote warehouse receives the update file; the update file comprises update content of interface configuration parameters for at least one interface;
generating a markup language file corresponding to the update file based on the update file;
and sending the markup language file to a document remote warehouse so that the document remote warehouse updates the interface document corresponding to the markup language file based on the markup language file.
2. The interface document update method of claim 1, wherein the obtaining the update file from the code remote repository when the code remote repository receives the update file comprises:
receiving update triggering information sent by the code remote warehouse through a preset event processing interface, wherein the update triggering information is sent by the code remote warehouse when the update file is received;
in response to receiving the update trigger information, sending an update file acquisition request to the code remote repository to acquire the update file from the code remote repository.
3. The interface document updating method according to claim 1, wherein the generating a markup language file corresponding to the update file based on the update file comprises:
analyzing the updated file to obtain an analysis result, and generating a JSON file corresponding to the updated file based on the analysis result;
and calling a preset code processing platform to analyze the JSON file, and generating a markup language file corresponding to the updated file based on the analyzed JSON file.
4. The interface document updating method according to claim 3, wherein the generating a markup language file corresponding to the updated file based on the parsed JSON file comprises:
determining a target template corresponding to the analyzed JSON file;
and generating the markup language file corresponding to the updated file based on the analyzed JSON file and the target template.
5. The interface document updating method according to claim 4, wherein the parsed JSON file includes a template identifier and an update content corresponding to the update file, and the determining the target template corresponding to the parsed JSON file includes:
detecting a preset semantic template library;
if the template corresponding to the template identifier exists in the semantic template library, taking the template corresponding to the template identifier as a target template corresponding to the update file;
if the template corresponding to the template identification does not exist in the semantic template library, sending prompt information to a target client corresponding to the updated file; receiving template configuration information returned by the target client, and generating a target template corresponding to the update file based on the template configuration information; the target client is a client submitting the update file to the code remote warehouse, and the prompt information is used for prompting that no template corresponding to the update file exists in the semantic template library.
6. The interface document update method according to any one of claims 1 to 5, wherein the method further comprises:
monitoring the document remote warehouse, and if the document remote warehouse updates the interface document based on the markup language file, acquiring the updated interface document from the document remote warehouse;
configuring the at least one interface based on the updated interface document;
responding to a received interface document viewing request, and sending the updated interface document to a client corresponding to the interface document viewing request, so that the client can render and update a document display interface of the client based on the updated interface document; the document display interface is used for displaying the interface configuration parameters of the at least one interface.
7. An interface document updating apparatus, comprising:
the first monitoring module is used for monitoring the code remote warehouse and acquiring an update file from the code remote warehouse when the code remote warehouse receives the update file; the update file comprises update content of interface configuration parameters for at least one interface;
the file generation module is used for generating a markup language file corresponding to the update file based on the update file;
and the document updating module is used for sending the markup language file to a document remote warehouse so that the document remote warehouse updates the interface document corresponding to the markup language file based on the markup language file.
8. The interface document updating apparatus according to claim 7, wherein the apparatus further comprises:
the second monitoring module is used for monitoring the document remote warehouse, and if the document remote warehouse updates the interface document based on the markup language file, the updated interface document is obtained from the document remote warehouse;
an interface configuration module for configuring the at least one interface with a configuration value based on the interface document;
the document sending module is used for responding to the received interface document viewing request, sending the interface document to the client corresponding to the interface document viewing request, so that the client can render and update the document display interface of each client based on the interface document; the document display interface is used for displaying the interface configuration parameters of the at least one interface.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory, characterized in that the processor executes the computer program to implement the steps of the method of any of claims 1-6.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the interface document updating method according to any one of claims 1 to 6.
CN202210125566.1A 2022-01-27 2022-02-10 Interface document updating method and device, electronic equipment and readable storage medium Pending CN114443905A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210102522 2022-01-27
CN2022101025227 2022-01-27

Publications (1)

Publication Number Publication Date
CN114443905A true CN114443905A (en) 2022-05-06

Family

ID=81371177

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210125566.1A Pending CN114443905A (en) 2022-01-27 2022-02-10 Interface document updating method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN114443905A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115081421A (en) * 2022-06-23 2022-09-20 平安科技(深圳)有限公司 Template generation method of data warehouse, computer equipment and storage medium
CN117370242A (en) * 2023-10-09 2024-01-09 汇付天下有限公司 Adapter and method for generating multilingual SDK client by parsing interface document

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115081421A (en) * 2022-06-23 2022-09-20 平安科技(深圳)有限公司 Template generation method of data warehouse, computer equipment and storage medium
CN117370242A (en) * 2023-10-09 2024-01-09 汇付天下有限公司 Adapter and method for generating multilingual SDK client by parsing interface document

Similar Documents

Publication Publication Date Title
CN111274760B (en) Rich text data processing method and device, electronic equipment and computer storage medium
CN107832045B (en) Method and apparatus for cross programming language interface conversion
CN110543297B (en) Method and apparatus for generating source code
CN114443905A (en) Interface document updating method and device, electronic equipment and readable storage medium
CN112507005B (en) Method and device for processing message
CN110704102A (en) Page jump protocol interface document generation method, system, medium and electronic device
CN111090423A (en) Webhook framework system and method for realizing active calling and event triggering
CN109343975B (en) Method and apparatus for inter-page asynchronous communication
CN110780874A (en) Method and apparatus for generating information
CN108694120B (en) Method and device for testing service component
CN107368407B (en) Information processing method and device
CN111767229A (en) Performance test method, device and equipment
CN114840379A (en) Log generation method, device, server and storage medium
CN113419740A (en) Program data stream analysis method and device, electronic device and readable storage medium
CN109901934B (en) Method and device for generating interface help document
CN110825622A (en) Software testing method, device, equipment and computer readable medium
JP2021163475A (en) Log-based mashup code generation
CN113779018A (en) Data processing method and device
CN112306324B (en) Information processing method, apparatus, device and medium
CN111026466A (en) File processing method and device, computer readable storage medium and electronic equipment
CN111767486A (en) Method, device, electronic equipment and computer readable medium for displaying page
CN112579553B (en) Method and apparatus for recording information
CN112445790B (en) Report data storage method, device, equipment and medium
CN113778886B (en) Processing method and device for test cases
CN113031960B (en) Code compiling method, device, server and storage medium

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