CN112540862A - Interface document data generation method, device, equipment and storage medium - Google Patents

Interface document data generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN112540862A
CN112540862A CN202011536101.2A CN202011536101A CN112540862A CN 112540862 A CN112540862 A CN 112540862A CN 202011536101 A CN202011536101 A CN 202011536101A CN 112540862 A CN112540862 A CN 112540862A
Authority
CN
China
Prior art keywords
document data
interface document
target
data
api
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
CN202011536101.2A
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.)
Dongguan Mengda Plasticizing Science & Technology Co ltd
Original Assignee
Dongguan Mengda Plasticizing Science & Technology 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 Dongguan Mengda Plasticizing Science & Technology Co ltd filed Critical Dongguan Mengda Plasticizing Science & Technology Co ltd
Priority to CN202011536101.2A priority Critical patent/CN112540862A/en
Publication of CN112540862A publication Critical patent/CN112540862A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a method, a device, equipment and a storage medium for generating interface document data. Wherein, the method comprises the following steps: scanning all source code files of the project, and storing text data in the source code files in a memory; analyzing the text data in the memory by a preset source code analysis tool, determining externally defined basic information of an Application Programming Interface (API) contained in the project according to the analysis result, and generating initial interface document data according to the basic information; loading text data from a memory, matching the text data according to a regular matching rule, determining parameter information of internal definition of an API (application program interface) according to a matching result, and adding the parameter information into initial interface document data to obtain interface document data. The technical scheme provided by the embodiment of the invention can identify the parameters defined by the internal codes of the API interface, and the generated interface document data is more comprehensive.

Description

Interface document data generation method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a method, a device, equipment and a storage medium for generating interface document data.
Background
API (Application Programming Interface) documents are a necessary requirement for current system development. Particularly, under the drive of the currently common micro-service architecture or the front-end and back-end separation architecture, the function of the standard and standardized API document in the system development process is particularly important due to the reduction of the dependency between the service modules and between the front-end and back-end service logics.
Currently, it is popular in the Java development architecture to generate interface document data through Swagger framework. Swagger is an interface description language of RESTful API expressed by JSON, which is used together with a set of open source software tools to achieve the purpose of designing, constructing, recording and using RESTful Web services.
However, the above method needs to maintain additional Swagger-defined annotations and cannot identify the parameters of the code definition inside the interface.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for generating interface document data, which can identify parameters defined by codes in an API interface and generate more comprehensive interface document data.
In a first aspect, an embodiment of the present invention provides an interface document data generating method, where the method includes:
scanning all source code files of a project, and storing text data in the source code files in a memory;
analyzing the text data in the memory by a preset source code analysis tool, determining externally defined basic information of an Application Programming Interface (API) contained in the project according to an analysis result, and generating initial interface document data according to the basic information;
and loading the text data from the memory, matching the text data according to a regular matching rule, determining parameter information defined in the API according to a matching result, and adding the parameter information to the initial interface document data to obtain interface document data.
In a second aspect, an embodiment of the present invention provides an interface document data generation apparatus, including:
the data storage module is used for scanning all source code files of the project and storing the text data in the source code files in a memory;
the data generation module is used for analyzing the text data in the memory through a preset source code analysis tool, determining externally defined basic information of an Application Programming Interface (API) contained in the project according to an analysis result, and generating initial interface document data according to the basic information;
and the data determining module is used for loading the text data from the memory, matching the text data according to a regular matching rule, determining the internally defined parameter information of the API according to a matching result, and adding the parameter information to the initial interface document data to obtain interface document data.
In a third aspect, an embodiment of the present invention provides a computer device, where the computer device includes:
one or more processors;
storage means for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement the interface document data generation method according to any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored, the program, when executed by a processor, implementing the interface document data generation method according to any embodiment of the present invention.
The embodiment of the invention provides an interface document data generation method, device, equipment and storage medium.
Drawings
Fig. 1 is a flowchart of an interface document data generating method according to an embodiment of the present invention;
fig. 2 is a flowchart of an interface document data generating method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an interface document data generating apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer device according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of an interface document data generation method according to an embodiment of the present invention, which is applicable to a case where interface document data is generated according to a project requirement. The interface document data generation method provided by this embodiment may be executed by an interface document data generation apparatus provided by an embodiment of the present invention, which may be implemented by software and/or hardware and integrated in a computer device executing the method.
Referring to fig. 1, the method of the present embodiment includes, but is not limited to, the following steps:
s110, scanning all source code files of the project, and storing text data in the source code files in a memory.
In the process of project development, standard and standard API documents are very important, and in order to accurately generate API interface document data, all source code files included in a project need to be acquired first, and then all source code files included in the project are scanned, so that text data in the source code files can be stored in a memory, and the subsequent direct loading of the text data from the memory and the analysis of the text data are facilitated.
Optionally, the method according to the embodiment of the present invention is implemented based on a plugin written by a preset plugin mechanism, where the plugin is started in the source code directory of the item; the scanning all source code files of the project, storing the text data in the source code files in a memory, may specifically include: and when a starting instruction for the plug-in is received, scanning all source code files of the items in the source code directory in the plug-in, and storing text data in the source code files in a memory. The preset plug-in mechanism may be a pre-designed tool for writing plug-ins, such as jQuery or Maven. The start instruction may be manually triggered.
In order to facilitate subsequent processing of the source code file, when a starting instruction for the plug-in is received, the plug-in is already started, and at the moment, all the source code files of the items in the source code directory are scanned by running in the plug-in, so that the text data in the source code files can be stored in the memory. In the embodiment of the invention, the text data in the source code file is stored in the memory, so that the text data can be prevented from being lost, and the text data can be conveniently analyzed and processed subsequently. In addition, the method in the embodiment of the invention is realized on the basis of plug-in, so that extra codes, notes and the like do not need to be introduced into the project, zero intrusion of the codes can be realized, and the support of other development tools is not needed.
And S120, analyzing the text data in the memory through a preset source code analysis tool, determining external defined basic information of the API contained in the project according to the analysis result, and generating initial interface document data according to the basic information.
The preset source code analysis tool may correspond to a programming language adopted by the source code file, specifically, the preset source code analysis tool may be selected based on the programming language, and the source code analysis tools used by different programming languages may be different. For example, the source code file is written in Java language, the code annotation is written according to Java doc standard, and the source code can be parsed by using QDox tool or Understand tool. QDox is a simple and efficient Java source code parser, and can extract Java classes, interfaces, methods, parameter names, types and the like. The externally defined basic information of the API may be understood as information of some standard, parameter, or attribute, etc. that is specified by the code writing process for the function of the API or information required when interfacing with the outside. Optionally, the basic information may specifically include: an interface name, an interface comment, an externally defined parameter of the API, and a comment corresponding to the externally defined parameter of the API.
After the text data in the memory is analyzed through the preset source code analysis tool, an analysis result can be obtained, the analysis result comprises basic information of the API external definition, the basic information of the API external definition contained in the project can be determined according to the obtained analysis result, after the basic information of the API external definition is obtained, initial interface document data can be generated through assembling the obtained basic information, and accordingly the initial document data can be stored in the memory, and subsequent query and call are facilitated.
S130, loading text data from the memory, matching the text data according to a regular matching rule, determining parameter information of internal definition of the API according to a matching result, and adding the parameter information to initial interface document data to obtain interface document data.
The parameter information defined inside the API may be understood as information such as some standards, parameters, or attributes that are specified for methods or functions inside the API during the code writing process, and optionally, may include parameter names or parameter comments of the methods inside the API. For API internal interface information, a developer may use a programming language, such as Java, consistent with a source code file and write code annotations according to the Java doc standard, and in addition, the developer may also use other non-Java doc modes for writing. In the embodiment of the invention, some regular expressions can be designed according to the coding habits of developers, the regular matching rules covering each writing method for defining the parameter names and parameter annotations in the interface method by the developers are formed, and then the relevant codes of the internal definition part related to the API in the source code file can be matched by using the regular matching rules. The regular expression is a logical formula for operating on character strings, and specific characters defined in advance and combinations of the specific characters are used for forming a 'regular character string', and the 'regular character string' is used for expressing a filtering logic for the character strings, so that texts conforming to a certain pattern (rule) can be retrieved and replaced through the regular expression. Regular expressions can be used, for example, to retrieve a substring from a string that meets a certain condition.
After the text data are loaded from the memory, the text data are matched according to the designed regular matching rule, and the matching result of the text data can be obtained. Based on the obtained matching result, it is possible to specify parameter information of the internal definition of the API, for example, a parameter name of the internal definition of the API, a comment corresponding to the parameter name, and the like. After the internally defined parameter information of the API is obtained, the parameter information is added into the initial interface document data to obtain interface document data, so that the interface document data is more comprehensive.
Therefore, the method in the embodiment of the invention does not need to change the encoding habit of developers, even if the API interface information written in a Java Doc mode is not used, the API interface information can be obtained by matching through the regular matching rule, the time is saved, and the developers do not have extra learning cost.
Optionally, the loading the text data from the memory, matching the text data according to a regular matching rule, and determining the parameter information defined in the API according to a matching result may specifically include: loading the text data from the memory, and matching each line of text in the text data according to a regular matching rule to obtain a successfully matched text; and determining the internally defined parameter information of the API according to the successfully matched text.
Specifically, after the text data is loaded from the memory, each line of text in the text data is matched according to the regular matching rule, so that the successfully matched text in the text data can be obtained. And then extracting corresponding parameter information from the successfully matched text, thereby determining the internally defined parameter information of the API.
In the embodiment of the invention, each line of text in the text data is matched through the regular matching rule, the parameter information of the internal definition of the API can be determined according to the successfully matched text, and compared with the condition that the parameter of the internal definition of the API cannot be identified in the prior art, the parameter information identified by the method in the embodiment of the invention is more comprehensive, so that the generated interface document data is more accurate.
The technical solution provided by this embodiment is to scan all source code files of a project, store the text data in the source code files in the memory, then analyzing the text data in the memory by a preset source code analysis tool, determining the externally defined basic information of the API contained in the project according to the analysis result, and generating initial interface document data according to the basic information, finally loading the document data from the memory, matching the text data according to a regular matching rule, determining parameter information defined inside the API according to a matching result, and the parameter information is added into the initial interface document data to obtain the interface document data, the parameters defined by the internal codes of the API interface can be identified, the generated interface document data is more comprehensive, and moreover, additional code files and annotations are not required to be introduced, and other development tools are not required to be relied on.
Example two
Fig. 2 is a flowchart of an interface document data generating method according to a second embodiment of the present invention. The embodiment of the invention is optimized on the basis of the embodiment. Optionally, the present embodiment explains in detail the process after obtaining the interface document data.
Referring to fig. 2, the method of the present embodiment includes, but is not limited to, the following steps:
s210, scanning all source code files of the project, and storing text data in the source code files in a memory.
S220, analyzing the text data in the memory through a preset source code analysis tool, determining external defined basic information of the API contained in the project according to the analysis result, and generating initial interface document data according to the basic information.
S230, loading the text data from the memory, matching the text data according to the regular matching rule, determining the internally defined parameter information of the API according to the matching result, and adding the parameter information to the initial interface document data to obtain the interface document data.
S240, determining a target API management system corresponding to the project.
After the interface document data is obtained, the interface document data also needs to be uploaded to the corresponding target API management system, and since the target API management systems corresponding to different items may be different, the target API management system corresponding to the item needs to be determined.
And S250, converting the data format of the interface document data into a required data format corresponding to the target API management system to obtain target interface document data.
The requirement data format can be understood as a data format supported by the target API management system.
After the target API management system corresponding to the project is determined, in order to avoid the problem that the interface document data cannot be uploaded to the target API management system due to the data format problem of the interface document data, the required data format corresponding to the target API management system needs to be obtained, then the data format of the interface document data is converted into the required data format corresponding to the target API management system, and the target interface document data is obtained, so that the success rate of uploading the target interface document data is improved.
In the embodiment of the invention, the data format of the interface document data can be converted, so that the data format requirements of a plurality of API management systems (such as Swagger or YApi) can be supported, and the dependence of project management on a specific system is reduced.
Optionally, the determining of the target API management system corresponding to the project may specifically include: reading a target identity of a target API management system from a preset configuration file corresponding to the project; correspondingly, the converting the data format of the interface document data into the required data format corresponding to the target API management system may specifically include: and inquiring a preset mapping relation according to the target identity to obtain a target conversion engine corresponding to the target identity, and loading the interface document data into the target conversion engine so as to convert the data format of the interface document data into a required data format corresponding to the target API management system through the target conversion engine.
And the preset mapping relation comprises the corresponding relation between the identity of the API management system and the conversion engine. The preset configuration file is preset and comprises a target identity mark, target address information and the like of the target API management system. The preset mapping relationship may be understood as a predetermined relationship table containing the target id and the corresponding target transformation engine. The conversion engine may be understood as a tool for converting the data format of the interface document data into the required data format corresponding to the target API management system. The plug-in provided by the embodiment of the invention can pre-write the corresponding implementation codes of different conversion engines.
Specifically, a target identity, such as a name or a number, of the target API management system is read from a preset configuration file corresponding to the project, so as to obtain which system the specific target API management system is; correspondingly, a preset mapping relation is queried according to the target identity, and a target conversion engine corresponding to the target identity can be obtained, for example, if the target identity is a, the corresponding target conversion engine is engine 1. And then loading the interface document data into the determined target conversion engine, so that data conversion can be carried out through the target conversion engine, and the data format of the interface document data is converted into the required data format corresponding to the target API management system.
In the embodiment of the invention, the data format of the interface document data can be converted into the required data format corresponding to the target API management system through the target conversion engine, the operation is simple, other tools are not needed, the workload of later maintenance is reduced, the maintenance cost is reduced, the data requirements of a plurality of API management platforms can be supported, and the plug-in the embodiment of the invention can support the uploading of the interface document data to all API interface data management systems (such as Swagger or YApi) through the way of adding a new data conversion engine, so that the dependence of project management on a specific platform is reduced.
It should be noted that: swagger is a document generation tool for REST APIs, and is a standard and complete framework for generating, describing, invoking and visualizing RESTful style Web services. YApi is an API management platform with high efficiency, easy use and powerful functions, aims to provide more elegant interface management service for development, products and testers, and can help developers to easily create, release and maintain APIs.
And S260, uploading the target interface document data to a target API management system.
After the target API management system corresponding to the project is determined and the target interface document data is obtained, the target interface document data can be uploaded to the target API management system through the target conversion engine.
The method in the embodiment of the invention is realized by the plug-in, and when the source code is newly added or modified, the newly added or modified interface document data can be updated to the target API management system only by operating the plug-in, so that the maintenance cost is reduced, a large amount of manpower and material resources are saved, and the working efficiency is improved.
Optionally, the uploading the target interface document data to the target API management system may specifically include: reading target address information corresponding to the target API management system from the preset configuration file; and uploading the target interface document data to the target API management system according to the target address information.
Specifically, when the target interface document data is uploaded to the target API management system, the target address information corresponding to the target API management system needs to be read from the preset configuration file, and after the target address information is acquired according to the corresponding relationship between the target address information and the target API management system, the target interface document data is uploaded to the target API management system according to the target address information, so that the probability of transmitting the wrong target interface document data can be reduced, and unnecessary loss can be reduced.
According to the technical scheme, after the interface document data is obtained, the target API management system corresponding to the project is determined, the data format of the interface document data is converted into the required data format corresponding to the target API management system, the target interface document data is obtained, the target interface document data is uploaded to the target API management system, the data format of the interface document data is converted into the required data format corresponding to the target API management system through target conversion, the operation is simple, other tools are not needed, the workload of later maintenance is reduced, and the maintenance cost is reduced.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an interface document data generating apparatus according to a third embodiment of the present invention. As shown in fig. 3, the apparatus may include:
the data storage module 310 is configured to scan all source code files of a project, and store text data in the source code files in a memory;
the data generating module 320 is configured to analyze the text data in the memory through a preset source code analysis tool, determine, according to an analysis result, externally defined basic information of an application programming interface API included in the project, and generate initial interface document data according to the basic information;
a data determining module 330, configured to load the text data from the memory, match the text data according to a regular matching rule, determine parameter information defined in the API according to a matching result, and add the parameter information to the initial interface document data to obtain interface document data.
According to the technical scheme provided by the embodiment, all source code files of a project are scanned, text data in the source code files are stored in a memory, the text data in the memory are analyzed through a preset source code analysis tool, basic information of external definition of an API contained in the project is determined according to an analysis result, initial interface document data are generated according to the basic information, the text data are loaded from the memory, the text data are matched according to a regular matching rule, parameter information of internal definition of the API is determined according to the matching result, the parameter information is added into the initial interface document data, the interface document data are obtained, parameters defined by the internal codes of the API can be identified, and the generated interface document data are more comprehensive.
Further, the method is realized based on a plug-in written by a preset plug-in mechanism, and the plug-in is started in the source code directory of the project; the data saving module 310 may be specifically configured to: and when a starting instruction for the plug-in is received, scanning all source code files of the items in the source code directory in the plug-in, and storing text data in the source code files in a memory.
Further, the data determining module 330 may be specifically configured to: loading the text data from the memory, and matching each line of text in the text data according to a regular matching rule to obtain a successfully matched text; and determining the internally defined parameter information of the API according to the successfully matched text.
Further, the interface document data generating apparatus may further include:
the system determination module is used for determining a target API management system corresponding to the project;
the target data determining module is used for converting the data format of the interface document data into a required data format corresponding to the target API management system to obtain target interface document data;
and the data uploading module is used for uploading the target interface document data to the target API management system.
Further, the system determination module may be specifically configured to: reading a target identity of a target API management system from a preset configuration file corresponding to the project; correspondingly, the target data determination module may be specifically configured to: and inquiring a preset mapping relation according to the target identity to obtain a target conversion engine corresponding to the target identity, and loading the interface document data into the target conversion engine so as to convert the data format of the interface document data into a required data format corresponding to the target API management system through the target conversion engine, wherein the preset mapping relation comprises the corresponding relation between the identity of the API management system and the conversion engine.
Further, the data uploading module may be specifically configured to: reading target address information corresponding to the target API management system from the preset configuration file; and uploading the target interface document data to the target API management system according to the target address information.
Further, the basic information includes: an interface name, an interface comment, an externally defined parameter of an API, and a comment corresponding to the externally defined parameter of the API.
The interface document data generation device provided by this embodiment is applicable to the interface document data generation method provided by any of the above embodiments, and has corresponding functions and advantageous effects.
Example four
Fig. 4 is a schematic structural diagram of a computer device according to a fourth embodiment of the present invention, as shown in fig. 4, the computer device includes a processor 410, a storage device 420, and a communication device 430; the number of the processors 410 in the computer device may be one or more, and one processor 410 is taken as an example in fig. 4; the processor 410, the storage 420 and the communication means 430 in the computer device may be connected by a bus or other means, and fig. 4 illustrates the connection by a bus as an example.
The storage device 420, which is a computer-readable storage medium, may be used to store software programs, computer-executable programs, and modules, such as modules corresponding to the interface document data generation method in the embodiment of the present invention (e.g., the data saving module 310, the data generation module 320, and the data determination module 330 used in the interface document data generation device). The processor 410 executes various functional applications and data processing of the computer device by executing software programs, instructions, and modules stored in the storage 420, that is, implements the above-described interface document data generation method.
The storage device 420 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the storage 420 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the storage 420 may further include memory located remotely from the processor 410, which may be connected to a computer device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
And a communication device 430 for implementing a network connection or a mobile data connection between the servers.
The computer device provided by the embodiment can be used for executing the interface document data generation method provided by any of the above embodiments, and has corresponding functions and beneficial effects.
EXAMPLE five
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements an interface document data generating method in any embodiment of the present invention, where the method specifically includes:
scanning all source code files of a project, and storing text data in the source code files in a memory;
analyzing the text data in the memory through a preset source code analysis tool, determining externally defined basic information of an API (application program interface) contained in the project according to an analysis result, and generating initial interface document data according to the basic information;
and loading the text data from the memory, matching the text data according to a regular matching rule, determining parameter information defined in the API according to a matching result, and adding the parameter information to the initial interface document data to obtain interface document data.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the operations of the method described above, and may also perform related operations in the interface document data generation method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the interface document data generation apparatus, the units and modules included in the embodiment are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be realized; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. An interface document data generation method, characterized by comprising:
scanning all source code files of a project, and storing text data in the source code files in a memory;
analyzing the text data in the memory by a preset source code analysis tool, determining externally defined basic information of an Application Programming Interface (API) contained in the project according to an analysis result, and generating initial interface document data according to the basic information;
and loading the text data from the memory, matching the text data according to a regular matching rule, determining parameter information defined in the API according to a matching result, and adding the parameter information to the initial interface document data to obtain interface document data.
2. The method according to claim 1, wherein the method is implemented based on a plug-in written by a preset plug-in mechanism, and the plug-in is started in a source code directory of the item; all source code files of the scanning project store the text data in the source code files in a memory, and the method comprises the following steps:
and when a starting instruction for the plug-in is received, scanning all source code files of the items in the source code directory in the plug-in, and storing text data in the source code files in a memory.
3. The method according to claim 1, wherein the loading the text data from the memory, matching the text data according to a regular matching rule, and determining the parameter information of the API defined internally according to the matching result comprises:
loading the text data from the memory, and matching each line of text in the text data according to a regular matching rule to obtain a successfully matched text;
and determining the internally defined parameter information of the API according to the successfully matched text.
4. The method according to claim 1, wherein after adding the parameter information to the initial interface document data to obtain interface document data, further comprising:
determining a target API management system corresponding to the project;
converting the data format of the interface document data into a required data format corresponding to the target API management system to obtain target interface document data;
and uploading the target interface document data to the target API management system.
5. The method of claim 4, wherein the determining the target API management system to which the project corresponds comprises:
reading a target identity of a target API management system from a preset configuration file corresponding to the project;
correspondingly, the converting the data format of the interface document data into the required data format corresponding to the target API management system includes:
and inquiring a preset mapping relation according to the target identity to obtain a target conversion engine corresponding to the target identity, and loading the interface document data into the target conversion engine so as to convert the data format of the interface document data into a required data format corresponding to the target API management system through the target conversion engine, wherein the preset mapping relation comprises the corresponding relation between the identity of the API management system and the conversion engine.
6. The method of claim 5, wherein uploading the target interface document data to the target API management system comprises:
reading target address information corresponding to the target API management system from the preset configuration file;
and uploading the target interface document data to the target API management system according to the target address information.
7. The method of claim 1, wherein the basic information comprises: an interface name, an interface comment, an externally defined parameter of an API, and a comment corresponding to the externally defined parameter of the API.
8. An interface document data generation apparatus, characterized by comprising:
the data storage module is used for scanning all source code files of the project and storing the text data in the source code files in a memory;
the data generation module is used for analyzing the text data in the memory through a preset source code analysis tool, determining externally defined basic information of an Application Programming Interface (API) contained in the project according to an analysis result, and generating initial interface document data according to the basic information;
and the data determining module is used for loading the text data from the memory, matching the text data according to a regular matching rule, determining the internally defined parameter information of the API according to a matching result, and adding the parameter information to the initial interface document data to obtain interface document data.
9. A computer device, characterized in that the computer device comprises:
one or more processors;
storage means for storing one or more programs;
when the one or more programs are executed by the one or more processors, cause the one or more processors to implement the interface document data generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium on which a computer program is stored, the program, when executed by a processor, implementing the interface document data generation method according to any one of claims 1 to 7.
CN202011536101.2A 2020-12-23 2020-12-23 Interface document data generation method, device, equipment and storage medium Pending CN112540862A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011536101.2A CN112540862A (en) 2020-12-23 2020-12-23 Interface document data generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011536101.2A CN112540862A (en) 2020-12-23 2020-12-23 Interface document data generation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112540862A true CN112540862A (en) 2021-03-23

Family

ID=75017641

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011536101.2A Pending CN112540862A (en) 2020-12-23 2020-12-23 Interface document data generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112540862A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113157792A (en) * 2021-05-10 2021-07-23 中国工商银行股份有限公司 Interface document management system and working method thereof
CN113407233A (en) * 2021-06-24 2021-09-17 上海中通吉网络技术有限公司 YAPI-based automatic generation method and device for front-end API (application program interface)
CN113485746A (en) * 2021-07-28 2021-10-08 山石网科通信技术股份有限公司 Method and device for generating application program interface document
CN113568677A (en) * 2021-07-14 2021-10-29 上海淇玥信息技术有限公司 Data object analysis method and device and electronic equipment
CN113626074A (en) * 2021-06-30 2021-11-09 北京三快在线科技有限公司 Interface document generation method and device, electronic equipment and readable storage medium
CN115098570A (en) * 2022-05-18 2022-09-23 中国航空工业集团公司沈阳飞机设计研究所 Method and device for automatically writing route data into flight management system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107463376A (en) * 2017-07-21 2017-12-12 珠海牛角科技有限公司 The method and device for automatically generating back end interface document based on Javadoc
CN110162296A (en) * 2019-04-15 2019-08-23 平安科技(深圳)有限公司 Generation method, device and the terminal device of application programming interface document
US20190325074A1 (en) * 2018-04-18 2019-10-24 International Business Machines Corporation Application programing interface document generator
CN110377336A (en) * 2019-06-17 2019-10-25 平安普惠企业管理有限公司 Interface document generation method, device, computer equipment and storage medium
CN110806863A (en) * 2019-11-05 2020-02-18 泰康保险集团股份有限公司 Interface document generation method and device, electronic equipment and storage medium
CN111581920A (en) * 2020-05-12 2020-08-25 深圳前海微众银行股份有限公司 Document conversion method, device, equipment and computer storage medium
US20200301702A1 (en) * 2019-03-20 2020-09-24 Richa Singh System and method for merging specification files for an application programming interface

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107463376A (en) * 2017-07-21 2017-12-12 珠海牛角科技有限公司 The method and device for automatically generating back end interface document based on Javadoc
US20190325074A1 (en) * 2018-04-18 2019-10-24 International Business Machines Corporation Application programing interface document generator
US20200301702A1 (en) * 2019-03-20 2020-09-24 Richa Singh System and method for merging specification files for an application programming interface
CN110162296A (en) * 2019-04-15 2019-08-23 平安科技(深圳)有限公司 Generation method, device and the terminal device of application programming 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
CN111581920A (en) * 2020-05-12 2020-08-25 深圳前海微众银行股份有限公司 Document conversion method, device, equipment and computer storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
JUAN ZHAI 等: "Automatic model generation from documentation for Java API functions", PROCEEDINGS OF THE 38TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING *
杨军 等: "基于源码分析的自动化外部函数接口生成方法", 江西冶金, vol. 34, no. 4 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113157792A (en) * 2021-05-10 2021-07-23 中国工商银行股份有限公司 Interface document management system and working method thereof
CN113157792B (en) * 2021-05-10 2024-04-30 中国工商银行股份有限公司 Interface document management system and working method thereof
CN113407233A (en) * 2021-06-24 2021-09-17 上海中通吉网络技术有限公司 YAPI-based automatic generation method and device for front-end API (application program interface)
CN113626074A (en) * 2021-06-30 2021-11-09 北京三快在线科技有限公司 Interface document generation method and device, electronic equipment and readable storage medium
CN113568677A (en) * 2021-07-14 2021-10-29 上海淇玥信息技术有限公司 Data object analysis method and device and electronic equipment
CN113485746A (en) * 2021-07-28 2021-10-08 山石网科通信技术股份有限公司 Method and device for generating application program interface document
CN113485746B (en) * 2021-07-28 2024-02-06 山石网科通信技术股份有限公司 Method and device for generating application program interface document
CN115098570A (en) * 2022-05-18 2022-09-23 中国航空工业集团公司沈阳飞机设计研究所 Method and device for automatically writing route data into flight management system

Similar Documents

Publication Publication Date Title
CN112540862A (en) Interface document data generation method, device, equipment and storage medium
US11520800B2 (en) Extensible data transformations
CN108491199B (en) Method and terminal for automatically generating interface
US20240028607A1 (en) Facilitating data transformations
US11809223B2 (en) Collecting and annotating transformation tools for use in generating transformation programs
CN111190594B (en) Document generation method and device of Vue component
US20180113923A1 (en) Efficient transformation program generation
CN114153459A (en) Interface document generation method and device
CN113419721B (en) Web-based expression editing method, device, equipment and storage medium
CN112650529B (en) System and method for configurable generation of mobile terminal APP codes
CN111596970B (en) Method, device, equipment and storage medium for dynamic library delay loading
CN111026604A (en) Log file analysis method and device
CN115809442A (en) Method, device and equipment for obfuscating reverse code and readable storage medium
CN115599388A (en) API (application programming interface) document generation method, storage medium and electronic equipment
CN115904482A (en) Interface document generation method, device, equipment and storage medium
CN111831288B (en) Method and system for automatically generating Thrift IDL data structure and automatic transfer function
CN114281688A (en) Codeless or low-code automatic case management method and device
CN113971044A (en) Component document generation method, device, equipment and readable storage medium
CN114063943A (en) Data transmission system, method, device, medium, and apparatus
CN112445468A (en) Typescript type file generation method, device, equipment and computer readable storage medium
CN112836477B (en) Method and device for generating code annotation document, electronic equipment and storage medium
CN111310414B (en) RDF format file analysis method and generation method
CN117369824A (en) Code generation method, device, equipment and storage medium based on interface document
CN117473957A (en) Device and method capable of supporting multi-language text analysis
CN114003211A (en) Sun code generation and analysis method and device, electronic equipment and 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