Interface document parsing method, device and storage medium

By identifying the interface document type, analyzing and converting the intermediate layer data format, the problem of low conversion efficiency of interface document is solved, seamless conversion between multiple tools is achieved, and the efficiency of interface document processing is improved.

CN118643007BActive Publication Date: 2024-11-01SHENZHEN SMARTCITY TECH DEV GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411096404.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-11-01
Estimated Expiration
2044-08-12

AI Technical Summary

Technical Problem

Due to the inconsistent import and export formats of existing interface document conversion tools, the interface document conversion efficiency is low, and one-to-many or many-to-many conversion cannot be achieved, and mutual conversion processing between multiple tools is required.

Method used

By determining the interface document and its export format, identifying the document type, analyzing the interface document based on the data model, generating intermediate layer data, and converting the intermediate layer data format through a preset algorithm to generate target interface documents matching the export format.

Benefits of technology

It improves the conversion efficiency of interface documents, realizes seamless conversion between multiple tools, and simplifies the processing flow of interface documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118643007B_ABST
    Figure CN118643007B_ABST
Patent Text Reader

Abstract

The present application discloses an interface document parsing method, device and storage medium, belonging to the field of data processing technology. The method includes: determining an interface document and a corresponding export format; identifying the document type of the interface document, and determining a data model according to the document type; parsing the interface document through the data model to determine the middle layer data; converting the data format of the middle layer data based on a preset algorithm, and generating a target interface document that matches the export format. The problem of low conversion efficiency of interface documents is solved, and the corresponding data model can be matched according to the document type to parse the interface document, thereby improving the conversion efficiency of the interface document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a parsing method, device and storage medium for an interface document. Background Art

[0002] An interface document is a document that describes the internal interface of a system. It provides detailed information about the interface and is usually used to describe the behavior and functions of an API (Application Programming Interface).

[0003] At present, the tools for converting interface document formats have limited the import format of interface documents. Users need to make the imported interface documents meet the format requirements of the tools and need to select the corresponding export format to complete the conversion of the interface documents. However, this method is difficult to implement because the import and export formats of each tool are different, and each tool has not formed a unified standard specification. Therefore, in the actual conversion process, one-to-many or many-to-many conversion cannot be achieved. When there is an interface document migration, it is necessary to convert between several tools to process it, resulting in low conversion efficiency of the interface document.

[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The present application provides an interface document parsing method, device and storage medium, aiming to solve the problem of low conversion efficiency of interface documents.

[0006] To achieve the above object, the present application provides a method for parsing an interface document, the method comprising the following steps:

[0007] Determine the interface documentation and the corresponding export format;

[0008] Identifying a document type of the interface document, and determining a data model according to the document type;

[0009] Parsing the interface document through the data model to determine the middle layer data;

[0010] The data format of the intermediate layer data is converted based on a preset algorithm, and a target interface document matching the export format is generated.

[0011] Optionally, before the step of converting the data format of the intermediate layer data based on a preset algorithm and generating a target interface document matching the export format, the step further includes:

[0012] After detecting that a user inputs specific data content, determining the specific data content and the intermediate layer data;

[0013] Determining first data matching the specific data content in the intermediate layer data, and replacing the first data with the specific data content to generate target intermediate layer data;

[0014] The action of converting the data format of the target intermediate layer data based on a preset algorithm and generating a target interface document matching the export format is executed.

[0015] Optionally, after the step of determining in the intermediate layer data the first data matching the specific data content and replacing the first data with the specific data content to generate the target intermediate layer data, the step further includes:

[0016] After detecting the input expected data structure, determining the expected data structure;

[0017] Determine a corresponding keyword according to the expected data structure, and query a matching target index in the target intermediate layer data according to the keyword;

[0018] Determining corresponding second data according to the target index, converting the second data according to the expected data structure and updating the target intermediate layer data;

[0019] The target intermediate layer data is written into the target interface document and saved.

[0020] Optionally, after the step of writing the target intermediate layer data into the target interface document and saving it, the method further includes:

[0021] Determine test data and preset return values;

[0022] Fill the test data into the target interface document and obtain the target return value;

[0023] When the target return value does not match the preset return value, it is determined that there is a defect in the target interface document, and a corresponding prompt message is returned.

[0024] Optionally, the step of parsing the interface document through the data model to determine the intermediate layer data includes:

[0025] When the document type is a swagger file, the step of parsing the interface document through the data model includes:

[0026] Create a heap space and read the target data of the interface document;

[0027] Determine a heap index of the heap space according to the target data, and traverse the target data to generate an array and write it into the heap space;

[0028] The heap space is traversed according to the heap index and reassembled into a heap array, and the heap array is used as the intermediate layer data.

[0029] Optionally, the step of converting the data format of the intermediate layer data based on a preset algorithm and generating a target interface document matching the export format includes:

[0030] Acquire the intermediate layer data, identify the intermediate layer data and determine the corresponding data format;

[0031] Determining a corresponding data relationship according to the export format and the data format;

[0032] Determine a key-value pair according to the data relationship, and convert the intermediate layer data into export data through the key-value pair;

[0033] The target interface document is generated according to the exported data and outputted.

[0034] Optionally, before the step of identifying the document type of the interface document, the step further includes:

[0035] Determine a first interface document input by a user;

[0036] When detecting input of a second interface document, acquiring the second interface document;

[0037] Determining second parameter information of the second interface document, and determining first parameter information of the first interface document;

[0038] When the second parameter information matches the first parameter information, the second interface document is determined to be duplicate data and the input of the second interface document is blocked.

[0039] Optionally, before the step of determining the interface document and the corresponding export format, the step further includes:

[0040] Output interface document parsing interface, the interface document parsing interface includes an interface document import area and an export format input area;

[0041] In response to an operation in the interface document import area, acquiring the input interface document;

[0042] In response to an operation action in the export format input area, the export format selected by the user is acquired.

[0043] In addition, to achieve the above-mentioned purpose, the present application also provides an interface document parsing device, which includes: a memory, a processor, and an interface document parsing program stored in the memory and executable on the processor, wherein the interface document parsing program is configured to implement the steps of the interface document parsing method as described above.

[0044] In addition, to achieve the above-mentioned purpose, the present application also provides a storage medium, on which a parsing program for an interface document is stored, and when the parsing program for the interface document is executed by a processor, the steps of the parsing method for the interface document as described above are implemented.

[0045] The present application provides an interface document parsing method, device and storage medium, which determines an interface document and a corresponding export format, then identifies the document type of the interface document, determines a data model based on the document type, and then parses the interface document through the data model to determine the intermediate layer data. Finally, the data format of the intermediate layer data is converted based on a preset algorithm, and a target interface document matching the export format is generated to improve the conversion efficiency of the interface document. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 This is a flowchart of the first embodiment of the method for parsing an interface document of the present application;

[0047] Figure 2 This is a flow chart of a second embodiment of the method for parsing an interface document of the present application;

[0048] Figure 3 This is a flow chart of the third embodiment of the method for parsing an interface document of the present application;

[0049] Figure 4 This is a schematic diagram of the architecture of the hardware operating environment of the interface document parsing device involved in the embodiment of the present application.

[0050] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0051] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0052] The present application determines the interface document and the corresponding export format, identifies the document type of the interface document, and matches the corresponding data model according to the document type, thereby parsing the interface document through the data model to obtain the middle-layer data, and finally converts the middle-layer data into the data format required by the user and exports it. The present application improves the conversion efficiency of the interface document by identifying the type of the interface document and matching the data model for parsing.

[0053] In order to better understand the above technical solution, exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0054] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0055] Embodiment 1

[0056] Please refer to Figure 1 In a first embodiment, the method for parsing the interface document includes the following steps:

[0057] Step S10: Determine the interface document and the corresponding export format.

[0058] In this embodiment, the interface document is an interface document imported by the user based on an input device, and can be imported in the form of a file. The export format is a preset format selected by the user based on the input device, or a format input by the user, and the format is semantically identified, the corresponding preset format is matched, and the matched preset format is determined as the export format.

[0059] Optionally, in this embodiment, before step S10, the following steps are further included:

[0060] Determine a first interface document input by a user; when a second interface document input is detected, obtain the second interface document; determine second parameter information of the second interface document, and determine first parameter information of the first interface document; when the second parameter information matches the first parameter information, determine that the second interface document is duplicate data and prevent the second interface document from being input.

[0061] Exemplarily, by comparing the API items in the imported interface document with those in the newly imported interface document, the main comparison content is the API URL, API Method, API status code, Query parameter, Body parameter, Path parameter, and Header parameter. If the above parameters are exactly the same, the background server will feedback the repeatedly input rendering information to the interface document parsing interface and prevent the newly imported interface document from being input.

[0062] Furthermore, in this embodiment, before step S10, the following steps are further included:

[0063] An output interface document parsing interface includes an interface document import area and an export format input area; in response to an operation in the interface document import area, the input interface document is obtained; in response to an operation in the export format input area, the export format selected by the user is obtained.

[0064] In this embodiment, the processing action is performed by the background server, wherein the background server can be set in a remote service or a local server, and of course can also be set in a terminal device. In a scenario where the processing is not based on the terminal itself, the background server can send the interface document parsing interface to the terminal device, and the terminal device can render and display the interface document parsing interface based on the rendering information. After the terminal displays the interface document parsing interface, the user can operate on the interface document parsing interface based on the input device of the terminal device.

[0065] As an optional implementation method, when designing the interface document parsing interface, the B / S (Browser / Server) structure can be used to separate the front-end and back-end of the interface document parsing interface, so that the front-end is only responsible for displaying the interface, and the back-end is responsible for receiving and processing data, so as to simplify the development, maintenance and use of the system.

[0066] Among them, this model unifies the client and concentrates the core part of the system function implementation on the server. The client only needs to install a browser, such as Chrome, Safari, Microsoft Edge, Netscape Navigator or Internet Explorer, and the server installs databases such as SQL Server, Oracle, MYSQL, etc. The browser can interact with the database through the WebServer.

[0067] Exemplarily, when the user imports an interface document in the interface document import area on the interface document parsing interface, the front end of the interface will feed the imported interface document to the backend server. Similarly, when the user enters the export format in the export format input area in the interface document parsing interface, or when the user selects a preset format in the export format input area based on a selection device, the front end of the interface will feed back the input or user-selected export format to the backend server.

[0068] Step S20: Identify the document type of the interface document, and determine the data model according to the document type.

[0069] In this embodiment, the document type of the interface document includes but is not limited to file format, data format and specific keywords. The document type of the above interface document is obtained by identification, and the data model matching the document type is determined through the document type.

[0070] It should be understood that when the background server fails to identify the document type of the interface document, or there is an erroneous character segment in the interface document, the background server returns the rendering information of the error prompt to the interface document parsing interface, so that the interface document parsing interface displays the error prompt information.

[0071] As an optional implementation method, the method of identifying the document type of the interface document first needs to determine its file extension. Common file extensions of interface documents are .doc, .docx, .pdf, etc., and then determine the description, parameters, return value and other information of the content in the interface document based on the title or content of the document, and determine the format of the interface document based on the document content. The format has specific tags, syntax and structure. The above-mentioned identified data is determined as the document type of the interface document to improve the accuracy of document recognition.

[0072] In addition, the data model includes but is not limited to JSON Schema, swagger (an API framework), RESTful API (Representational State Transfer, API design concept for Internet applications), RAML (RESTful API Modeling Language, API modeling language), and OpenAPI (open application programming interface).

[0073] Exemplarily, JSON Schema is a specification for describing and validating JSON data, which can define the structure of a JSON document and ensure that the data in the document conforms to the structure. The JSON schema defines the keys and values ​​in the interface document, as well as the constraints that these values ​​should meet, such as type, format, etc., which can ensure that the interface document entered by the user matches the data format expected by the user. Swagger is a specification and complete framework for building, designing, describing and documenting RESTful Web services. The main component is the swagger specification, which can define how to use the YAML format to describe the RESTful API. Through swagger, all the details of the API document can be confirmed, including endpoints, request methods, parameters, responses, etc. RESTful API is a Web service design style based on the HTTP protocol, which can use different HTTP methods to perform different operations and use URLs to identify resources. RAML is a simple language for describing RESTful APIs, which can use concise syntax to define all the details of the API, including endpoints, request / response formats, error codes, etc. OpenAPI is a specification for describing RESTful Web services. Provides a standardized method to describe RESTful APIs and ensures that various tools and frameworks can interoperate.

[0074] Step S30: Parse the interface document through the data model to determine the intermediate layer data.

[0075] In this embodiment, after determining the data model that matches the document type, the interface document is parsed through the data model and based on a preset processing and conversion algorithm to obtain the intermediate layer data. The intermediate layer data can be stored in the cache in the form of an array, so that the background server can obtain it at any time.

[0076] Optionally, in this embodiment, step S30 includes:

[0077] When the document type is a swagger file, the step of parsing the interface document through the data model includes: creating a heap space and reading the target data of the interface document; determining the heap index of the heap space according to the target data, and traversing the target data to generate an array and writing it into the heap space; traversing the heap space according to the heap index, and reassembling into a heap array, and using the heap array as the intermediate layer data.

[0078] Exemplarily, taking the matching data model as swagger as an example, the corresponding algorithm processing steps are as follows: first create a reference heap space tagRef heap, then read the imported interface document, obtain the paths, definitions, and tags data of swagger, and set the index key of the heap space to the name of the tags, so as to facilitate quick indexing of data; create new middle-layer API data, the API data includes the API URL, API Method, API status code, etc., wherein the API data is directly read and filled from the path data obtained from the interface document, and written into the tagRef heap; read the tags data, traverse the tags through the breadth traversal algorithm, and fill the traversed data into the tagRef heap in the form of a one-dimensional array; extract the Query parameters, Body parameters, Path parameters, and Header parameters from the parameters data set in the path in turn, and write them into the tagRef heap; traverse all the data in the tagRef heap, reassemble them into a one-dimensional array, and determine the reassembled array as the middle-layer data.

[0079] Step S40: converting the data format of the intermediate layer data based on a preset algorithm, and generating a target interface document matching the export format.

[0080] In this embodiment, the processing action is performed by the background server, and the background server converts the format of the intermediate layer data based on a preset algorithm according to the export format fed back by the front end of the interface document parsing interface, so as to convert the data format of the intermediate layer data into the export format, and writes the intermediate layer data with the converted data format into the interface document, thereby generating a target interface document.

[0081] Optionally, in this embodiment, step S40 includes:

[0082] Acquire the intermediate layer data, identify the intermediate layer data and determine the corresponding data format; determine the corresponding data relationship according to the export format and the data format; determine the key-value pair according to the data relationship, and convert the intermediate layer data into export data through the key-value pair; generate the target interface document according to the export data and output it.

[0083] Specifically, the generated intermediate layer data is first determined, and the intermediate layer data is identified to determine the corresponding data format, and then the data format is converted through a mapping algorithm, wherein the specific steps of the mapping algorithm are: first determine the mapping key-value pair, map the data key to another data value, that is, determine the corresponding relationship between the data format of the intermediate layer data and the data format of the target data. Then, according to specific needs, define the corresponding mapping rules or algorithms to achieve the mapping from the data format of the intermediate layer data to the export format, and finally, according to the mapping rules, implement the corresponding mapping function, which can take the intermediate layer data as input, and calculate the value of the export format according to the mapping rules to complete the data format conversion, thereby improving the efficiency of data format conversion.

[0084] In addition, in the process of converting the data format using the mapping algorithm, there may be some abnormal situations or boundary conditions that require additional processing. When there are null values ​​or illegal values ​​in the intermediate layer data, the null values ​​and illegal values ​​need to be processed during the mapping process.

[0085] As an optional implementation method, the method for converting the data format of the intermediate layer data based on a preset algorithm can divide the data into various components or elements according to the determined data format, and can divide the data into parts of similar types through string segmentation and regular expression matching, and then convert the segmented data to meet the requirements of the export format.

[0086] It should be understood that the above-mentioned regular expression matching method needs to first select the appropriate regular expression pattern according to the export format, and then use the regular expression library or function to write the matching code, and use specific functions or methods according to the corresponding regular expression library or module to perform the matching operation, that is, compare the target string in the intermediate layer data with the regular expression pattern, and determine whether the match is successful. If the match is successful, the target string will be replaced by the successfully matched regular expression.

[0087] As another optional implementation, the method for converting the data format of the intermediate layer data based on a preset algorithm can also select a suitable conversion method according to the properties of the data format and export format of the intermediate layer data, so as to determine a specific conversion function and algorithm, wherein the conversion function includes but is not limited to FloatToStr function, IntToStr function, IntToHex function, StrToInt function and StrToFloat function, and the data format of the intermediate layer data is converted into the export format according to the conversion function selected above.

[0088] For example, taking the FloatToStr function as an example, this function can convert "floating point type" into "character type". According to the floating point number in the middle layer data, if the export format requires character type, the floating point number can be converted into a string form.

[0089] In the technical solution provided in this embodiment, by determining an interface document and a corresponding export format, then identifying the document type of the interface document, and determining a data model based on the document type, the interface document is parsed through the data model to determine the intermediate layer data, and finally the data format of the intermediate layer data is converted based on a preset algorithm, and a target interface document matching the export format is generated, thereby improving the conversion efficiency of the interface document.

[0090] Embodiment 2

[0091] Please refer to Figure 2 In the second embodiment, before step S40, the following steps are also included:

[0092] Step S50: after detecting that the user inputs specific data content, determining the specific data content and the intermediate layer data.

[0093] In this embodiment, the user can input the specific data content in the interface document parsing interface through the input device, and the front end of the interface document parsing interface will feed back the specific data content to the background server, so that the background server can obtain the specific data content. The intermediate layer data is stored in the cache, and the background server can directly obtain the intermediate layer data in the cache.

[0094] It is understandable that when the user does not input the specific data content in the interface document parsing interface, the operation of converting the data format of the intermediate layer data is directly performed according to the export format input by the user.

[0095] Step S60: determining the first data matching the specific data content in the intermediate layer data, and replacing the first data with the specific data content to generate target intermediate layer data.

[0096] Step S70: Execute the action of converting the data format of the target intermediate layer data based on a preset algorithm and generating a target interface document matching the export format.

[0097] In this embodiment, the semantic analysis of the specific data content is performed through a semantic recognition algorithm to obtain the semantic field corresponding to the specific data content, and the first data matching the specific data content is searched in the intermediate layer data according to the semantic field, and the specific data content replaces the first data to obtain the target intermediate layer data. Then, step S40 in the first embodiment is executed, that is, the target intermediate layer data is replaced with the intermediate layer data, and the data format of the target intermediate layer data is converted based on a preset algorithm, thereby generating a target interface document, which will not be described in detail here.

[0098] Furthermore, in this embodiment, after step S60, the following steps are further included:

[0099] After detecting the input expected data structure, determine the expected data structure; determine the corresponding keyword based on the expected data structure, and query the matching target index in the target intermediate layer data based on the keyword; determine the corresponding second data based on the target index, and convert the second data according to the expected data structure and update the target intermediate layer data; write the target intermediate layer data into the target interface document and save it.

[0100] Specifically, a monitoring mechanism can be set in the interface document parsing interface. When the monitoring mechanism monitors the user inputting the expected data structure in the interface document parsing interface based on the input device, the expected data structure is obtained, and the expected data structure is parsed to determine the keywords that can be used for query, and then the target index is determined in the target intermediate layer data. It can be understood that the target index is associated with the second data, and the second data can be quickly found and determined through the target index. After the second data is found, the data structure of the second data is converted according to the expected data structure, that is, the data structure of part of the data is converted. Then the converted second data is filled into the position corresponding to the target index, and the update of the target intermediate layer data is completed.

[0101] Exemplarily, the expected data structure input by the user may be a description of the organization form and relationship of the data, including the type, field, size, constraint conditions, etc. of the data, usually presented in the form of a table, class diagram, structure diagram, etc. By converting the data structure of part of the data in the target intermediate layer data into the expected data structure, the user's needs can be met and the user's experience can be improved.

[0102] Furthermore, in this embodiment, after the step of writing the target intermediate layer data into the target interface document and saving it, the method further includes:

[0103] Determine test data and a preset return value; fill the test data into the target interface document and obtain a target return value; when the target return value does not match the preset return value, determine that the target interface document has a defect and return a corresponding prompt message.

[0104] Specifically, prepare a set of test data, including but not limited to input data, boundary values, abnormal values, etc. under normal circumstances, fill the test data into the converted target interface document one by one, and verify whether its return value or behavior is consistent with the preset result. If not, feedback prompt information of the defects in the interface document will be displayed on the interface document parsing interface.

[0105] In addition to the test data under normal circumstances, you also need to test abnormal situations. You can enter invalid data types or out-of-range values ​​to check whether the converted document can handle these abnormal situations correctly. Test the boundary values ​​of the data range to ensure that the converted document can work properly when processing minimum values, maximum values, or specific thresholds.

[0106] In the technical solution provided in this embodiment, by obtaining specific data content input by the user, the first data matching the specific data content is queried and replaced in the intermediate layer data, and according to the expected data structure input by the user, part of the data structure of the target intermediate layer data is converted to meet the user's various needs and improve the user experience.

[0107] Embodiment 3

[0108] Please refer to Figure 3 , in the third embodiment, Figure 3 This is a flowchart of the third embodiment of the method for parsing an interface document of the present application.

[0109] like Figure 3As shown, the user enters the interface document and the corresponding export format in the interface document parsing interface. The front end of the interface document parsing interface feeds back the interface document and the export format to the backend server. In addition, the interface document parsing interface determines whether the user enters specific data content and expected data structure. The backend server first identifies the document type of the interface document, matches the pre-stored data model according to the document type, parses the interface document according to the matched data model, and outputs the intermediate layer data. Then, according to the above result of judging whether the user enters specific data content and expected data structure, if the user enters specific data content, the specific data content is processed, the specific data content is replaced with the matching data in the intermediate layer data, and the target intermediate layer data is output. Then, according to the export format entered by the user, the data format of the intermediate layer data is converted based on the preset algorithm to obtain the target data. Then, it is determined whether the user enters the expected data structure. If the user enters the expected data structure, the data structure of part of the target data is converted according to the expected data structure entered by the user, and the target data is updated to obtain the expected data. Finally, the expected data is written into the target interface document and output. It should be understood that when the user does not input specific data content and expected data structure, the steps of processing the specific data content and processing the expected data structure do not need to be performed.

[0110] Since the system introduced in the embodiment of the present application is a system used to implement the method of the embodiment of the present application, based on the method introduced in the embodiment of the present application, the person skilled in the art can understand the specific structure and deformation of the system, so it is not repeated here. All systems used in the method of the embodiment of the present application belong to the scope of protection of this application.

[0111] As an implementation scheme, Figure 4 This is a schematic diagram of the architecture of the hardware operating environment of the interface document parsing device involved in the embodiment of the present application.

[0112] like Figure 4As shown, the parsing device of the interface document may include: a processor 1001, such as a core processor (Central Processing Unit, CPU), a communication bus 1002, a network interface 1003, and a memory 1004. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The network interface 1003 may optionally include a standard wired interface, a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1004 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1004 may also be a storage device independent of the aforementioned processor 1001.

[0113] Those skilled in the art will understand that Figure 4 The structure shown in does not constitute a limitation on the parsing device of the interface document, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0114] like Figure 4 As shown, the memory 1004 as a storage medium may include an operating system, a network communication module, and an interface document parsing program. The operating system is a program that manages and controls the hardware and software resources of the interface document parsing device, the interface document parsing program, and the operation of other software or programs.

[0115] exist Figure 4 In the interface document parsing device shown, the network interface 1003 is mainly used to connect to a terminal and perform data communication with the terminal; the processor 1001 can be used to call the interface document parsing program stored in the memory 1004.

[0116] In this embodiment, the interface document parsing device includes: a memory 1004, a processor 1001, and an interface document parsing program stored in the memory and executable on the processor, wherein:

[0117] When the processor 1001 calls the parsing program of the interface document stored in the memory 1004, the following operations are performed:

[0118] Determine the interface documentation and the corresponding export format;

[0119] Identifying a document type of the interface document, and determining a data model according to the document type;

[0120] Parsing the interface document through the data model to determine the middle layer data;

[0121] The data format of the intermediate layer data is converted based on a preset algorithm, and a target interface document matching the export format is generated.

[0122] In one embodiment, when the processor 1001 calls the parsing program of the interface document stored in the memory 1004, the following operations are performed:

[0123] After detecting that a user inputs specific data content, determining the specific data content and the intermediate layer data;

[0124] Determining first data matching the specific data content in the intermediate layer data, and replacing the first data with the specific data content to generate target intermediate layer data;

[0125] The action of converting the data format of the target intermediate layer data based on a preset algorithm and generating a target interface document matching the export format is executed.

[0126] In one embodiment, when the processor 1001 calls the parsing program of the interface document stored in the memory 1004, the following operations are performed:

[0127] After detecting the input expected data structure, determining the expected data structure;

[0128] Determine a corresponding keyword according to the expected data structure, and query a matching target index in the target intermediate layer data according to the keyword;

[0129] Determining corresponding second data according to the target index, converting the second data according to the expected data structure and updating the target intermediate layer data;

[0130] The target intermediate layer data is written into the target interface document and saved.

[0131] In one embodiment, when the processor 1001 calls the parsing program of the interface document stored in the memory 1004, the following operations are performed:

[0132] Determine test data and preset return values;

[0133] Fill the test data into the target interface document and obtain the target return value;

[0134] When the target return value does not match the preset return value, it is determined that there is a defect in the target interface document, and a corresponding prompt message is returned.

[0135] In one embodiment, when the processor 1001 calls the parsing program of the interface document stored in the memory 1004, the following operations are performed:

[0136] When the document type is a swagger file, the step of parsing the interface document through the data model includes:

[0137] Create a heap space and read the target data of the interface document;

[0138] Determine a heap index of the heap space according to the target data, and traverse the target data to generate an array and write it into the heap space;

[0139] The heap space is traversed according to the heap index and reassembled into a heap array, and the heap array is used as the intermediate layer data.

[0140] In one embodiment, when the processor 1001 calls the parsing program of the interface document stored in the memory 1004, the following operations are performed:

[0141] Acquire the intermediate layer data, identify the intermediate layer data and determine the corresponding data format;

[0142] Determining a corresponding data relationship according to the export format and the data format;

[0143] Determine a key-value pair according to the data relationship, and convert the intermediate layer data into export data through the key-value pair;

[0144] The target interface document is generated according to the exported data and outputted.

[0145] In one embodiment, when the processor 1001 calls the parsing program of the interface document stored in the memory 1004, the following operations are performed:

[0146] Determine a first interface document input by a user;

[0147] When detecting input of a second interface document, acquiring the second interface document;

[0148] Determining second parameter information of the second interface document, and determining first parameter information of the first interface document;

[0149] When the second parameter information matches the first parameter information, the second interface document is determined to be duplicate data and the input of the second interface document is blocked.

[0150] In one embodiment, when the processor 1001 calls the parsing program of the interface document stored in the memory 1004, the following operations are performed:

[0151] Output interface document parsing interface, the interface document parsing interface includes an interface document import area and an export format input area;

[0152] In response to an operation in the interface document import area, acquiring the input interface document;

[0153] In response to an operation action in the export format input area, the export format selected by the user is acquired.

[0154] In addition, it can be understood by a person skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the parsing device of the interface document to implement the process steps of the embodiment of the above method.

[0155] Therefore, the present application also provides a storage medium, which stores a parsing program for an interface document. When the parsing program for the interface document is executed by a processor, the various steps of the interface document parsing method described in the above embodiment are implemented.

[0156] The storage medium may be a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which can store program codes.

[0157] It should be noted that since the storage medium provided in the embodiment of the present application is the storage medium used to implement the method of the embodiment of the present application, based on the method introduced in the embodiment of the present application, the person skilled in the art can understand the specific structure and deformation of the storage medium, so it is not repeated here. All storage media used in the method of the embodiment of the present application belong to the scope of protection of this application.

[0158] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0159] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0160] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0161] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0162] It should be noted that in the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The present application may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.

[0163] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0164] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for parsing an interface document, characterized in that: The method for parsing the interface document comprises the following steps: Determine the interface documentation and the corresponding export format; Identify the document type of the interface document, and determine a data model according to the document type, wherein the data model includes JSON Schema, swagger, RESTful API, RAML, and OpenAPI; When the document type is a swagger file, the step of parsing the interface document through the data model includes: Create a heap space and read the target data of the interface document; Determine a heap index of the heap space according to the target data, and traverse the target data to generate an array and write it into the heap space; Traversing the heap space according to the heap index and reassembling into a heap array, and using the heap array as intermediate layer data; After detecting that a user inputs specific data content, determining the specific data content and the intermediate layer data; Determining first data matching the specific data content in the intermediate layer data, and replacing the first data with the specific data content to generate target intermediate layer data; Convert the data format of the target intermediate layer data based on a preset algorithm, and generate a target interface document matching the export format; After detecting the input expected data structure, determining the expected data structure; Determine a corresponding keyword according to the expected data structure, and query a matching target index in the target intermediate layer data according to the keyword; Determine the corresponding second data according to the target index, convert the data structure of the second data according to the expected data structure, and fill the converted second data into the position corresponding to the target index to update the target intermediate layer data; The target intermediate layer data is written into the target interface document and saved.

2. The method for parsing an interface document according to claim 1, characterized in that: After the step of writing the target intermediate layer data into the target interface document and saving it, the method further includes: Determine test data and preset return values; Fill the test data into the target interface document and obtain the target return value; When the target return value does not match the preset return value, it is determined that there is a defect in the target interface document, and a corresponding prompt message is returned.

3. The method for parsing an interface document according to claim 1, characterized in that: The step of converting the data format of the intermediate layer data based on a preset algorithm and generating a target interface document matching the export format includes: Acquire the intermediate layer data, identify the intermediate layer data and determine the corresponding data format; Determining a corresponding data relationship according to the export format and the data format; Determine a key-value pair according to the data relationship, and convert the intermediate layer data into export data through the key-value pair; The target interface document is generated according to the exported data and outputted.

4. The method for parsing an interface document according to claim 1, characterized in that: Before the step of identifying the document type of the interface document, the method further comprises: Determine a first interface document input by a user; When detecting input of a second interface document, acquiring the second interface document; Determining second parameter information of the second interface document, and determining first parameter information of the first interface document; When the second parameter information matches the first parameter information, the second interface document is determined to be duplicate data and the input of the second interface document is blocked.

5. The method for parsing an interface document according to claim 1, characterized in that: Before the step of determining the interface document and the corresponding export format, the method further includes: Output interface document parsing interface, the interface document parsing interface includes an interface document import area and an export format input area; In response to an operation in the interface document import area, acquiring the input interface document; In response to an operation action in the export format input area, the export format selected by the user is acquired.

6. An interface document parsing device, characterized in that: The interface document parsing device includes: a memory, a processor, and an interface document parsing program stored in the memory and executable on the processor, wherein the interface document parsing program is configured to implement the steps of the interface document parsing method as described in any one of claims 1 to 5.

7. A storage medium, characterized in that: The storage medium stores an interface document parsing program, and when the interface document parsing program is executed by a processor, the steps of the interface document parsing method according to any one of claims 1 to 5 are implemented.