A data processing method and related apparatus

By extending Swagger's functionality through the target plugin, it provides the ability to generate mock data, solving the problem of insufficient mock data in Swagger's front-end and back-end separation development, and improving the efficiency and convenience of front-end development.

CN116304465BActive Publication Date: 2026-04-14BEIJING SHANGYIN MICRO CORE TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING SHANGYIN MICRO CORE TECH CO LTD
Filing Date
2023-03-24
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

The existing Swagger tool does not provide the function of generating mock data in front-end and back-end separation development, which makes front-end and back-end separation development inconvenient.

Method used

The target plugin provides the ability to generate simulated data, extending Swagger's functionality to include retrieving page links, matching APIs, generating data objects, and displaying them through the plugin panel, supporting simulated operations and data generation.

Benefits of technology

It facilitates front-end developers to quickly generate simulated data, improving the efficiency of front-end and back-end separation development, especially through the interactive method of the plugin panel to generate and display simulated data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116304465B_ABST
    Figure CN116304465B_ABST
Patent Text Reader

Abstract

The application discloses a data processing method and related device, first, in response to a data simulation request, a target tab page corresponding page link can be obtained through a target plug-in, the target tab page can be a tab page used in current development, and a link parameter of the page link is matched to determine a matching interface. Further, a data object corresponding to the path object of the matching interface is generated, the data object can be data used to generate simulation data, and the data object is displayed through a plug-in panel of the target plug-in. Finally, in response to a simulation operation performed through the plug-in panel, simulation data is generated according to the data object, and based on this, the generation of the simulation data is completed. In this way, when a front-end personnel needs to generate simulation data, the front-end personnel can directly use the target plug-in to trigger a data simulation request, use the target plug-in to generate and display the data object, and trigger a simulation operation through the plug-in panel, so that the simulation data is quickly generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a data processing method and related apparatus. Background Technology

[0002] Current web system development mainly adopts a front-end and back-end separation development approach. As business expands, the system becomes more and more complex, and there are many front-end and back-end interface conventions.

[0003] Typically, to enable development based on a unified interface specification, backend developers use Swagger for backend development and to generate interface documentation. Frontend developers then use the mock data corresponding to the interface documentation generated by the backend developers for frontend development or debugging. Swagger is an open-source tool built on the OpenAPI (Open Application Programming Interface) specification, which helps solve problems such as the need to manually maintain interface documentation when developing with a frontend-backend separation architecture.

[0004] However, Swagger does not provide functionality for generating mock data, making front-end and back-end separation development inconvenient. Summary of the Invention

[0005] To address the aforementioned technical issues, this application provides a data processing method and related apparatus that provides a simulated data generation function through a target plugin, thereby extending the functionality of Swagger, facilitating front-end and back-end separation development, and especially making it easier for front-end developers to generate simulated data.

[0006] The embodiments of this application disclose the following technical solutions:

[0007] On one hand, embodiments of this application provide a data processing method, the method comprising:

[0008] In response to a data simulation request, the page link corresponding to the target tab is obtained through the target plugin;

[0009] Match the link parameters in the page links to determine the matching interface;

[0010] Generate a data object based on the path object corresponding to the matching interface;

[0011] The data object is displayed through the plugin panel of the target plugin;

[0012] In response to a simulation operation performed through the plug-in panel, simulation data is generated based on the data object.

[0013] On the other hand, embodiments of this application provide a data processing apparatus, which includes an acquisition unit, a matching unit, a generation unit, and a display unit:

[0014] The acquisition unit is used to obtain the page link corresponding to the target tab page through the target plugin in response to the data simulation request;

[0015] The matching unit is used to match the link parameters in the page links and determine the matching interface;

[0016] The generation unit is used to generate a data object based on the path object corresponding to the matching interface;

[0017] The display unit is used to display the data object through the plugin panel of the target plugin;

[0018] The generation unit is also configured to generate simulated data based on the data object in response to a simulation operation performed through the plug-in panel.

[0019] In another aspect, embodiments of this application provide a computer device, the computer device including a processor and a memory:

[0020] The memory is used to store program code and transmit the program code to the processor;

[0021] The processor is used to execute the data processing method described above according to the instructions in the program code.

[0022] In another aspect, embodiments of this application provide a computer-readable storage medium for storing a computer program for performing the data processing method described above.

[0023] As can be seen from the above technical solution, firstly, in response to a data simulation request, the target plugin can obtain the page link corresponding to the target tab. This target tab can refer to the tab currently being developed, and the link parameters of the page link are matched to determine the matching interface. Then, a data object is generated based on the path object corresponding to the matching interface. This data object can refer to the data used to generate simulation data, and the data object is displayed through the plugin panel of the target plugin. Finally, in response to the simulation operation performed through the plugin panel, simulation data is generated based on the data object, thus completing the generation of simulation data. In this way, when front-end personnel need to generate simulation data, they can directly use the target plugin to trigger a data simulation request, thereby utilizing the target plugin to generate and display the data object. This allows front-end personnel to quickly generate simulation data by triggering simulation operations through the plugin panel. In other words, by providing the simulation data generation function through the target plugin, the functionality of Swagger is extended, facilitating front-end and back-end separation development, and especially convenient for front-end personnel to generate simulation data. Attached Figure Description

[0024] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0025] Figure 1 A flowchart illustrating a data processing method provided in an embodiment of this application;

[0026] Figure 2 This is a structural diagram of a data processing apparatus provided in an embodiment of this application. Detailed Implementation

[0027] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0028] The data processing method provided in this application can be implemented using a computer device, which can be a terminal device or a server. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Terminal devices include, but are not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, and in-vehicle terminals. Terminal devices and servers can be directly or indirectly connected via wired or wireless communication, and this application does not impose any limitations in this regard.

[0029] The following examples illustrate this in detail:

[0030] Figure 1 A flowchart of a data processing method provided in this application embodiment, using a server as an example of the aforementioned computer device, is used for illustration. The method includes S101-S105:

[0031] S101: In response to a data simulation request, obtain the page link corresponding to the target tab through the target plugin.

[0032] S102: Match the link parameters in the page links to determine the matching interface.

[0033] Current web system development primarily employs a front-end / back-end separation approach. Typically, back-end developers use Swagger for back-end development and generate API documentation, while front-end developers use mock data corresponding to the back-end API documentation for their own development and debugging. This way, even if the back-end API logic is not yet implemented, development progress is not blocked, and the richer the mock data, the more scenarios it covers. However, Swagger does not provide functionality for generating mock data, making front-end / back-end separation development inconvenient.

[0034] To facilitate the generation of mock data by front-end developers, this application provides a target plugin that extends Swagger functionality, enabling quick and easy mock data generation. In practical applications, when front-end developers need to generate mock data, they can trigger a data mock request. The server can then respond to this request by retrieving the page link corresponding to the target tab through the target plugin and matching the link parameters to determine the matching interface. The target tab can refer to the tab currently being developed, such as an interface documentation generation tab opened in a browser, specifically a Swagger tab opened in a browser, such as Chrome. In this case, the target plugin can also be called a Chrome plugin. The page link corresponding to the target tab uniquely identifies the current target tab, and the link parameters reflect the interface documentation data to be displayed in the target tab. If a matching interface is determined, it indicates that the interface documentation data corresponding to that matching interface needs to be displayed and can be considered as requiring development or debugging.

[0035] To ensure the usability of the target plugin during implementation, it's advisable to follow the Chrome extension development documentation and build it using web technologies. In the development project, configure `manifest.js` with `manifest_version` set to 2, `permissions` enabling storage permissions, and `default_popup` configuring the entry page for the `browser_action` object. This ensures the target plugin can implement its functionality after development, guaranteeing its usability. The target plugin can be a sandboxed extension; during runtime, it can modify browser behavior and enhance browser functionality, thereby enabling more features.

[0036] In practical applications, users (such as front-end developers) can open a browser and access a target tab (e.g., the Swagger tab), triggering a launch action for the target plugin. This launch action, in turn, invokes the target plugin and loads its plugin panel. After launch, the target plugin can asynchronously call the `chrome.tabs.query` method to retrieve the page link of the current tab, i.e., obtain the page link of the target tab.

[0037] S103: Generate a data object based on the path object corresponding to the matching interface.

[0038] S104: Display data objects through the plugin panel of the target plugin.

[0039] S105: In response to simulation operations performed via the plug-in panel, generate simulation data based on the data object.

[0040] After determining the matching interface, a data object can be generated based on the path object corresponding to the matching interface. The path object reflects the interface documentation data, while the data object refers to data that can be used to generate mock data. Once the data object is determined, it can be displayed through the plugin panel of the target plugin for users (e.g., front-end developers) to view. When mock data needs to be generated, a simulation operation can be triggered through the plugin panel. In practice, users can trigger a simulation operation through the plugin panel, and the server can respond by generating mock data based on the data object, facilitating development or debugging based on the mock data.

[0041] In practical applications, users (such as front-end developers) can open a browser and access a target tab (e.g., the Swagger tab), triggering a launch action for the target plugin. This launch action, in turn, invokes the target plugin and loads its plugin panel. After launch, the target plugin can asynchronously call the `chrome.tabs.query` method to retrieve the page link of the current tab, i.e., obtain the page link of the target tab.

[0042] In practical implementation, before S103, in response to the startup operation of the target plugin, the page link can be copied. Specifically, after the target plugin starts, it can obtain the page link of the target tab, copy the page link, and replace the copied page link with the target link. The target link can refer to a link that retrieves the display interface documentation data corresponding to the target tab; for example, in Swagger, the target link could be v2 / api-docs. Then, based on the target link, the target plugin can retrieve the display interface documentation data corresponding to the target tab. In practical applications, after a successful request to the Swagger interface, the target plugin can retrieve all the interface documentation data corresponding to the primaryName displayed on the Swagger tab, which is the display interface documentation data. Correspondingly, in practical implementation, S103 can determine the path object corresponding to the matching interface from the path object corresponding to the display interface documentation data, and then generate a data object based on the path object corresponding to the matching interface and the description object corresponding to the display interface documentation data. The description object corresponding to the display interface documentation data reflects the data structure and data type of the interface documentation data.

[0043] In practical applications, the path object corresponding to the matching interface can include parameter objects and response objects. When determining the data object, the parameter objects can be recursively traversed in conjunction with the description object to generate the request data object, and the response objects can be recursively traversed in conjunction with the description object to generate the response data object. Accordingly, the request data object and the response data object constitute the data object. Typically, the path object can be denoted as a paths object, and the description object corresponding to the interface documentation data can be denoted as a definitions object. The paths object includes parameters (i.e., the aforementioned parameter objects) and responses (i.e., the aforementioned response objects), which can reflect the situation of the interface documentation data corresponding to the matching interface. When generating the data object, the parameters can be recursively traversed in conjunction with the definitions object to generate a requestDTO object containing path, body, and query (i.e., the aforementioned request data object), and the responses can be recursively traversed in conjunction with the definitions object to generate a responseDTO object (i.e., the aforementioned response data object). Recursion can refer to a process that repeatedly calls itself. During recursive traversal, if the same node is found to have been traversed along the recursive path, the traversal can stop; this is the logical condition for the termination of recursive traversal. Based on this, the request and response data objects generated by the definitions object can reflect the data structure and data type, ensuring that the subsequently generated mock data conforms to the data structure and data type of the interface documentation.

[0044] Furthermore, the request and response data objects can be displayed in a structured manner through the plugin panel. This allows users to view the structured request and response data objects directly from the plugin panel. In practical applications, Mockjs's `mock` method can be used to generate random data based on the data structure and data type, which is then displayed in the plugin panel. Correspondingly, after a user triggers a simulated operation through the plugin panel, the server can respond by generating simulated data based on the data structure and data type identified by the request and response data objects. This ensures that the generated simulated data conforms to the data structure and data type specified in the API documentation, facilitating further front-end development and debugging.

[0045] After generating the simulation data, it can be displayed through the plugin panel for easy copying by users. When a user wants to copy the simulation data locally, a copy operation can be triggered. The server can then respond to this operation by copying the simulation data to the system clipboard, allowing users to save it locally. In practical applications, the simulation data displayed in the plugin panel can be copied to the system clipboard using the `navigator.clipboard.writeText` method.

[0046] In practical applications, Swagger displays API documentation in a hierarchical, collapsed format. Collapsed document content is not displayed on the page; it is only added when the collapse is expanded. This makes it impossible for browser search functions to find collapsed document content. Furthermore, in daily development, backend developers typically deliver the full API documentation, and the current display method makes finding a specific API document within the entire documentation inconvenient. To address this, this application provides a query function based on the target plugin, thereby extending Swagger's functionality to solve the problem of finding API documentation.

[0047] In practical implementation, if the page link does not contain the target interface, it indicates that the corresponding display interface documentation data on the current target tag page does not contain a collapsed document. To facilitate users' access to collapsed documents, the object data corresponding to the display interface documentation data can be parsed to obtain the selection element. The object data can refer to the `paths` array of the display interface documentation data, and the selection element can include all interfaces in the display interface documentation data, including those in collapsed documents. This selection element can then be used as an option in the query input box of the plugin panel, allowing users to quickly find the desired document. In practical applications, when a user wants to find a specific interface document, they can perform a query in the query input box. The server can respond to this query by displaying options, allowing the user to select the desired interface document. The server can then match the corresponding interface documentation data in response to the selection of the target option. Based on this, a query function is provided, extending the Swagger functionality to facilitate users' quick search for specific interface documents.

[0048] In actual queries, users can also enter their query content (input element) in the query input box. The server can then perform fuzzy matching in the paths data based on the user's query content to determine the corresponding target options. Therefore, users who are very familiar with the displayed API documentation and the API documentation they want to find can quickly search by directly entering their query content in the query input box without having to browse the options.

[0049] Furthermore, during front-end and back-end integration testing, if a problem is found with an interface, it's necessary to consult the corresponding interface documentation and test the request. This is especially true when the access environment changes; the backend service deployment address may differ from the Swagger address and domain name provided during initial development. Swagger can only provide requests within the same domain, and headers cannot be added or modified. This can cause the "Try it out -- Execute" request method provided by Swagger to be inapplicable, resulting in request errors or requests that are available but require authentication from the backend service. Interfaces requiring authentication often cannot be directly debugged. For these issues, it's necessary to customize and edit the request interface's address, domain name, port, path, headers, and parameters to generate requests for testing the problematic interface. To address this, this application also provides interface testing functionality based on the target plugin, thereby extending Swagger's capabilities.

[0050] In practical implementation, the plugin panel can include an address input box and an authentication information input box. When testing a target service interface, the user can input the target interface address and authentication information through these boxes. Correspondingly, the server can obtain the target interface address entered through the address input box and the authentication information entered through the authentication information input box. Based on the target interface address and authentication information, a target interface request can be generated for testing the target service interface. Finally, the target interface request can be sent to the target service interface corresponding to the target interface address for relevant testing. Typically, authentication refers to verifying whether the user is logged in. Therefore, the authentication information entered through the authentication information input box can be headers carrying a token, which indicates whether the user is logged in. Based on this, the Swagger functionality can be extended through the target plugin. For situations where the backend service deployment address differs from the Swagger address and domain name provided during initial development, the target interface address and authentication information can be customized to generate a target interface request for testing the target service interface.

[0051] In practical applications, the target API address and authentication information are entered through the address input boxes and authentication information input boxes in the plugin panel. To prevent the loss of the target API address and authentication information when switching from the browser to other applications and then switching back to the target plugin, these two types of information can be persisted locally using the `chrome.storage.local` set and get methods after entering the target API address and authentication information. Typically, after configuring the target service API prefix and headers, i.e., after generating the target API request, the `axios` method of Axios can be used to send the target API request to the target service API corresponding to the specified target API address.

[0052] As can be seen, the target plugin provided in this application can provide functions for generating simulated data, querying interface documentation, and generating target interface requests for testing target service interfaces, thereby extending the functionality of Swagger and facilitating front-end and back-end separation development. Furthermore, the target plugin runs in the form of a plugin panel, which facilitates user interaction. For example, users can trigger a startup operation to invoke the target plugin when needed, or it can display request and response data objects in a structured manner. Users can also trigger simulated data requests and simulated operations when they need to generate simulated data.

[0053] As can be seen from the above technical solution, firstly, in response to a data simulation request, the target plugin can obtain the page link corresponding to the target tab. This target tab can refer to the tab currently being developed, and the link parameters of the page link are matched to determine the matching interface. Then, a data object is generated based on the path object corresponding to the matching interface. This data object can refer to the data used to generate simulation data, and the data object is displayed through the plugin panel of the target plugin. Finally, in response to the simulation operation performed through the plugin panel, simulation data is generated based on the data object, thus completing the generation of simulation data. In this way, when front-end personnel need to generate simulation data, they can directly use the target plugin to trigger a data simulation request, thereby utilizing the target plugin to generate and display the data object. This allows front-end personnel to quickly generate simulation data by triggering simulation operations through the plugin panel. In other words, by providing the simulation data generation function through the target plugin, the functionality of Swagger is extended, facilitating front-end and back-end separation development, and especially convenient for front-end personnel to generate simulation data.

[0054] Figure 2 This is a structural diagram of a data processing apparatus provided in an embodiment of this application. The apparatus includes an acquisition unit 201, a matching unit 202, a generation unit 203, and a display unit 204.

[0055] The acquisition unit 201 is used to obtain the page link corresponding to the target tab page through the target plugin in response to the data simulation request.

[0056] The matching unit 202 is used to match the link parameters in the page links and determine the matching interface;

[0057] The generation unit 203 is used to generate a data object based on the path object corresponding to the matching interface;

[0058] The display unit 204 is used to display the data object through the plugin panel of the target plugin;

[0059] The generation unit 203 is also configured to generate simulated data based on the data object in response to a simulation operation performed through the plug-in panel.

[0060] In one possible implementation, the apparatus further includes a copying unit and a replacement unit:

[0061] The copying unit is used to copy the page link in response to the startup operation of the target plugin;

[0062] The replacement unit is used to replace the copied page link with the target link;

[0063] The acquisition unit is further configured to acquire the display interface document data corresponding to the target tab page through the target plugin based on the target link;

[0064] The generation unit is further configured to:

[0065] The path object corresponding to the matching interface is determined from the path object corresponding to the display interface document data;

[0066] The data object is generated based on the path object corresponding to the matching interface and the description object corresponding to the display interface document data.

[0067] In one possible implementation, the path object corresponding to the matching interface includes a parameter object and a response object, and the generation unit is further configured to:

[0068] The request data object is generated by recursively traversing the parameter object using the description object, and the response data object is generated by recursively traversing the response object using the description object; the request data object and the response data object constitute the data object.

[0069] In one possible implementation, the display unit is further configured to:

[0070] The plugin panel provides a structured display of the request data object and the response data object.

[0071] The generation unit is further configured to generate the simulated data in response to the simulation operation performed through the plug-in panel, based on the data structure and data type identified by the request data object and the response data object.

[0072] In one possible implementation, the display unit is further configured to:

[0073] The simulation data is displayed through the plugin panel;

[0074] In response to a copy operation on the simulation data, the simulation data is copied to the system clipboard.

[0075] In one possible implementation, the apparatus further includes a parsing unit, an as-a unit, and a matching unit:

[0076] The parsing unit is used to parse the object data corresponding to the display interface document data if the page link does not contain the target interface, so as to obtain the selection element corresponding to the display interface document data.

[0077] The unit is used to select the element as an alternative to the query input box in the plug-in panel.

[0078] The display unit is also used to display the alternative options in response to a query operation performed through the query input box;

[0079] The matching unit is used to match the interface document data corresponding to the target alternative in response to the selection operation of the target alternative.

[0080] In one possible implementation, the plug-in panel includes an address input box and an authentication information input box, and the device further includes a sending unit:

[0081] The acquisition unit is also used to acquire the target interface address input through the address input box, and to acquire the authentication information input through the authentication information input box;

[0082] The generation unit is further configured to generate a target interface request based on the target interface address and the authentication information;

[0083] The sending unit is used to send the target interface request to the target service interface corresponding to the target interface address.

[0084] As can be seen from the above technical solution, firstly, in response to a data simulation request, the target plugin can obtain the page link corresponding to the target tab. This target tab can refer to the tab currently being developed, and the link parameters of the page link are matched to determine the matching interface. Then, a data object is generated based on the path object corresponding to the matching interface. This data object can refer to the data used to generate simulation data, and the data object is displayed through the plugin panel of the target plugin. Finally, in response to the simulation operation performed through the plugin panel, simulation data is generated based on the data object, thus completing the generation of simulation data. In this way, when front-end personnel need to generate simulation data, they can directly use the target plugin to trigger a data simulation request, thereby utilizing the target plugin to generate and display the data object. This allows front-end personnel to quickly generate simulation data by triggering simulation operations through the plugin panel. In other words, by providing the simulation data generation function through the target plugin, the functionality of Swagger is extended, facilitating front-end and back-end separation development, and especially convenient for front-end personnel to generate simulation data.

[0085] In another aspect, embodiments of this application provide a computer device, the computer device including a processor and a memory:

[0086] The memory is used to store program code and transmit the program code to the processor;

[0087] The processor is used to execute the data processing method provided in the above embodiments according to the instructions in the program code.

[0088] The computer device may include a terminal device or a server, and the aforementioned data processing device may be configured in the computer device.

[0089] In another aspect, embodiments of this application also provide a storage medium for storing a computer program for executing the data processing method provided in the above embodiments.

[0090] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium can be at least one of the following media: read-only memory (ROM), RAM, magnetic disk, or optical disk, etc., and other media capable of storing program code.

[0091] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0092] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0093] The data processing method and related apparatus provided in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method of this application. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the method of this application.

[0094] In summary, the content of this specification should not be construed as limiting this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. Furthermore, based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods.

Claims

1. A data processing method, characterized in that, The method includes: In response to a data simulation request, the page link corresponding to the target tab is obtained through the target plugin; Match the link parameters in the page links to determine the matching interface; Generate a data object based on the path object corresponding to the matching interface; The data object is displayed through the plugin panel of the target plugin; In response to a simulation operation performed via the plug-in panel, simulated data is generated based on the data object; Before generating the data object based on the path object corresponding to the matching interface, the method further includes: In response to the activation operation of the target plugin, copy the page link; Replace the copied page link with the target link; Based on the target link, obtain the display interface document data corresponding to the target tab page through the target plugin; The step of generating a data object based on the path object corresponding to the matching interface includes: The path object corresponding to the matching interface is determined from the path object corresponding to the display interface document data; The data object is generated based on the path object corresponding to the matching interface and the description object corresponding to the display interface document data; The path object corresponding to the matching interface includes a parameter object and a response object. Generating the data object based on the path object corresponding to the matching interface and the description object corresponding to the display interface document data includes: The request data object is generated by recursively traversing the parameter object using the description object, and the response data object is generated by recursively traversing the response object using the description object; the request data object and the response data object constitute the data object.

2. The method according to claim 1, characterized in that, The process of displaying the data object through the plugin panel of the target plugin includes: The plugin panel provides a structured display of the request data object and the response data object. The step of generating simulation data based on the data object in response to a simulation operation performed through the plug-in panel includes: In response to the simulation operation performed through the plugin panel, the simulation data is generated based on the data structure and data type identified by the request data object and the response data object.

3. The method according to claim 2, characterized in that, The method further includes: The simulation data is displayed through the plugin panel; In response to a copy operation on the simulation data, the simulation data is copied to the system clipboard.

4. The method according to claim 1, characterized in that, The method further includes: If the page link does not contain the target interface, the object data corresponding to the display interface document data is parsed to obtain the selection element corresponding to the display interface document data. The selected element is used as an alternative to the query input box in the plugin panel; In response to a query operation performed through the query input box, the alternative options are displayed; In response to the selection of a target alternative, the interface document data corresponding to the target alternative is matched.

5. The method according to claim 1, characterized in that, The plugin panel includes an address input box and an authentication information input box, and the method further includes: Obtain the target interface address entered through the address input box, and obtain the authentication information entered through the authentication information input box; Generate a target interface request based on the target interface address and the authentication information; Send the target interface request to the target service interface corresponding to the target interface address.

6. A data processing apparatus, characterized in that, The device includes an acquisition unit, a matching unit, a generation unit, a display unit, a copying unit, and a replacement unit: The acquisition unit is used to obtain the page link corresponding to the target tab page through the target plugin in response to the data simulation request; The matching unit is used to match the link parameters in the page links and determine the matching interface; The generation unit is used to generate a data object based on the path object corresponding to the matching interface; The display unit is used to display the data object through the plugin panel of the target plugin; The generation unit is also configured to generate simulated data based on the data object in response to a simulation operation performed through the plug-in panel; The copying unit is used to copy the page link in response to the startup operation of the target plugin; The replacement unit is used to replace the copied page link with the target link; The acquisition unit is further configured to acquire the display interface document data corresponding to the target tab page through the target plugin based on the target link; The generation unit is further configured to: The path object corresponding to the matching interface is determined from the path object corresponding to the display interface document data; The data object is generated based on the path object corresponding to the matching interface and the description object corresponding to the display interface document data; The path object corresponding to the matching interface includes a parameter object and a response object, and the generation unit is further used for: The request data object is generated by recursively traversing the parameter object using the description object, and the response data object is generated by recursively traversing the response object using the description object; the request data object and the response data object constitute the data object.

7. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the method described in any one of claims 1-5 according to the instructions in the program code.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program for performing the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Mock data control method, device terminal and computer readable storage medium

    CN113836460A

  • Method and device for generating interface data, equipment and storage medium

    CN114238129A

  • Test method and device for detecting application exception, computing equipment and storage medium

    CN114968762A