Data processing method and device, electronic equipment and storage medium

By writing simulated data into the application programming interface platform, the problem of writing simulated data into local code in front-end development is solved, improving system resource utilization and user experience.

CN118660201AInactive Publication Date: 2024-09-17BEIJING DAJIA INTERNET INFORMATION TECH CO LTD

Patent Information

Application Number
CN202410831659.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-17
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the existing technology, front-end development needs to write simulation data when the back-end interface is not developed, which leads to an increase in the amount of local code, high resource consumption, abnormal operation, and may send debugging code to the production environment, reducing user experience.

Method used

Write the target simulation data to the application programming interface platform for debugging the functions of the target object, thereby avoiding writing and operating simulation data in local code and obtaining data directly from the API platform.

Benefits of technology

It reduces the consumption of system resources during the development process, avoids local code exceptions, and improves the user account experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118660201A
    Figure CN118660201A
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to a data processing method and device, electronic equipment and a storage medium. The method comprises the steps of obtaining a type declaration file for a target object; the type declaration file comprises a data type and declaration information corresponding to the data type; analyzing the data type based on the declaration information, and generating target simulation data for the target object; writing the target simulation data into the application programming interface platform for debugging the function of the target object, the generated simulation data can be written into the application programming interface platform, the generated simulation data does not need to be written into a local code, consumption of system resources in the development process is reduced, and the development efficiency is improved. The abnormal condition of the local code in the actual operation process is avoided, and the use experience of the user account is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data processing method, device, electronic device and storage medium. Background Art

[0002] At present, project development includes front-end development and back-end development. In order to speed up the development progress, front-end development and back-end development can be carried out in parallel. Front-end development depends on the data provided by the back-end. If the back-end has not developed the corresponding interface, the front-end cannot obtain data through the interface, which will affect the development progress of the front-end. In the case that the front-end cannot obtain data through the interface, some sample data (called simulation data or mock data) is usually written for use in the development stage of the front-end.

[0003] In the related art, after the simulation data is generated, it is necessary to write the simulation data into the local code one by one, and implement the simulation device in the local code. However, the demand for development and joint debugging is increasing, resulting in a large amount of simulation data required in the development and joint debugging process and a high frequency of simulation data operation. The method of writing the simulation data into the local code one by one not only increases the amount of local code and the consumption of system resources in the code writing process, but also causes abnormalities in the actual operation of the local code due to frequent operations on the simulation data written in the local code. In addition, during the actual operation of the local code, if the simulation data written therein is not deleted, the simulation data written in the local code will be returned regardless of the type of user or the type of scenario, which is equivalent to sending the debugging code to the actual production environment, thereby reducing the user experience of the user account. Summary of the invention

[0004] The present disclosure provides a data processing method, device, electronic device and storage medium to at least solve the problems in the related art of writing simulation data into local code, such as a large amount of local code, large consumption of system resources during the code writing process, abnormalities in the local code during actual operation, and low user account usage experience. The technical solution of the present disclosure is as follows:

[0005] According to a first aspect of an embodiment of the present disclosure, there is provided a data processing method, including:

[0006] Obtain a type declaration file for a target object; the type declaration file includes a data type and declaration information corresponding to the data type;

[0007] Parsing the data type based on the declaration information to generate target simulation data for the target object;

[0008] The target simulation data is written to an application programming interface platform for debugging the function of the target object.

[0009] In an optional embodiment, the application programming interface platform includes a preset interface, and writing the target simulation data to the application programming interface platform includes:

[0010] The target simulation data is written to an application programming interface platform based on the preset interface.

[0011] In an optional embodiment, writing the target simulation data to an application programming interface platform based on the preset interface includes:

[0012] In response to a call instruction from a user account to a preset interface in the application programming interface platform, transmitting the preset interface to the user account;

[0013] In response to the user account's write operation on the target simulation data through the preset interface, the simulation data is written to the application programming interface platform.

[0014] In an optional embodiment, the method further includes:

[0015] In the process of writing the target simulation data to the application programming interface platform, no backup of the target simulation data is retained at the front end and / or the back end.

[0016] In an optional embodiment, the target object includes a component / interface, and after writing the target simulation data to the application programming interface platform, the method further includes:

[0017] Receiving a data acquisition request sent by a user account, wherein the data acquisition request carries identification information of the user account;

[0018] Acquire simulation data corresponding to the identification information from the application programming interface platform;

[0019] The simulation data corresponding to the identification information is sent to the user account; the user account is used to debug the function of the component / interface based on the simulation data corresponding to the identification information.

[0020] In an optional embodiment, after generating the target simulation data for the target object, the method further includes:

[0021] In response to the modification instruction for the target simulation data, the target simulation data is modified to obtain modified target simulation data.

[0022] In an optional embodiment, in response to the modification instruction of the target simulation data, modifying the target simulation data to obtain the modified target simulation data includes:

[0023] In response to a custom modification instruction for the target simulation data, defining the target simulation data as a preset data value to obtain modified target simulation data; and / or,

[0024] In response to a custom modification instruction for the target simulation data, the target data is defined as any data value in a preset data value range to obtain modified target simulation data.

[0025] In an optional embodiment, the type declaration file includes multiple data types and declaration information corresponding to at least some of the multiple data types, and the parsing of the data types based on the declaration information to generate target simulation data for the target object includes:

[0026] For some data types that have corresponding declaration information in the type declaration file, the partial data types are parsed based on the declaration information corresponding to the partial data types, and simulation data corresponding to the partial data types are generated;

[0027] For other data types for which corresponding declaration information does not exist in the type declaration file, obtaining the declaration information of the other data types from a preset type declaration file that has declared the other data types, parsing the other data types based on the declaration information of the other data types, and generating simulation data corresponding to the other data types;

[0028] The simulation data corresponding to each of the plurality of data types are combined to generate target simulation data for the target object.

[0029] In an optional embodiment, the method further includes:

[0030] In the process of parsing the data type based on the declaration information, if it is determined that the parsing of the target data type among the multiple data types meets the preset condition, the simulation data of the target data type is determined as invalid data.

[0031] In an optional embodiment, in the process of parsing the data type based on the declaration information, if it is determined that the parsing of the target data type among the multiple data types meets a preset condition, determining the simulation data of the target data type as invalid data includes:

[0032] In the process of parsing the data type based on the declaration information, if it is determined that the parsing of the target data type fails and / or it is determined that the target data type cannot be supported to generate simulation data, the simulation data of the target data type is determined as invalid data.

[0033] In an optional embodiment, the method further includes:

[0034] In a case where the preset type declaration file including the declaration information of the other data types is not obtained, it is determined that the simulation data of the other data types is invalid data.

[0035] In an optional embodiment, the method further includes:

[0036] In the process of parsing the data type based on the declaration information, determining whether the data type to be parsed is the data type for which simulation data needs to be generated;

[0037] When it is determined that the data type to be parsed is a data type for which simulation data needs to be generated, simulation data corresponding to the data type to be parsed is generated.

[0038] In an optional embodiment, determining whether the data type to be parsed is a data type for which simulation data needs to be generated includes:

[0039] Acquire data type tag information, where the data type tag information is used to describe the data type that is marked as requiring simulation data to be generated;

[0040] In a case where the data type to be parsed is the data type described by the data type tag information, determining that the data type to be parsed is the data type for which simulation data needs to be generated;

[0041] In the case that the data type to be parsed is not a data type described by the data type tag information, it is determined that the data type to be parsed is not a data type for which simulation data needs to be generated.

[0042] According to a second aspect of an embodiment of the present disclosure, a data processing device is provided, the device comprising:

[0043] A type declaration file acquisition module is configured to execute acquisition of a type declaration file for a target object; the type declaration file includes a data type and declaration information corresponding to the data type;

[0044] A parsing module, configured to parse the data type based on the declaration information to generate target simulation data for the target object;

[0045] The writing module is configured to execute writing of the target simulation data into an application programming interface platform for debugging the function of the target object.

[0046] In an optional embodiment, the writing module includes:

[0047] The target simulation data writing unit is configured to write the target simulation data to the application programming interface platform based on the preset interface.

[0048] In an optional embodiment, the target simulation data writing unit includes:

[0049] a call instruction response subunit, configured to execute a call instruction of a user account to a preset interface in the application programming interface platform, and transmit the preset interface to the user account;

[0050] The write operation response subunit is configured to execute a write operation on the target simulation data by the user account through the preset interface, and write the simulation data to the application programming interface platform.

[0051] In an optional embodiment, the device further comprises:

[0052] The backup processing unit is configured to execute a process of not retaining a backup of the target simulation data at the front end and / or the back end during the process of writing the target simulation data to the application programming interface platform.

[0053] In an optional embodiment, the target object includes a component / interface, and the apparatus further includes:

[0054] A data acquisition request receiving module, configured to execute and receive a data acquisition request sent by a user account, wherein the data acquisition request carries identification information of the user account;

[0055] A simulation data acquisition module, configured to execute acquisition of simulation data corresponding to the identification information from the application programming interface platform;

[0056] The simulation data sending module is configured to execute sending the simulation data corresponding to the identification information to the user account; the user account is used to debug the function of the component / interface based on the simulation data corresponding to the identification information.

[0057] In an optional embodiment, the device further comprises:

[0058] The modification instruction response module is configured to execute in response to the modification instruction on the target simulation data, modify the target simulation data, and obtain modified target simulation data.

[0059] In an optional embodiment, the modification instruction response module includes:

[0060] a custom modification instruction response unit, configured to execute in response to a custom modification instruction on the target simulation data, define the target simulation data as a preset data value, and obtain modified target simulation data; and / or,

[0061] In response to a custom modification instruction for the target simulation data, the target data is defined as any data value in a preset data value range to obtain modified target simulation data.

[0062] In an optional embodiment, the type declaration file includes multiple data types and declaration information corresponding to at least some of the multiple data types, and the parsing module includes:

[0063] A generating unit is configured to execute, for some data types for which corresponding declaration information exists in the type declaration file, parsing the some data types based on the declaration information corresponding to the some data types, and generating simulation data corresponding to the some data types; for other data types for which corresponding declaration information does not exist in the type declaration file, obtaining the declaration information of the other data types from a preset type declaration file in which the other data types have been declared, parsing the other data types based on the declaration information of the other data types, and generating simulation data corresponding to the other data types;

[0064] The combining unit is configured to combine the simulation data corresponding to each of the plurality of data types to generate target simulation data for the target object.

[0065] In an optional embodiment, the device further comprises:

[0066] The first invalid data determination module is configured to execute a process of parsing data types based on declaration information, and if it is determined that the parsing of a target data type among the multiple data types meets a preset condition, determine the simulation data of the target data type as invalid data.

[0067] In an optional embodiment, the first invalid data determination module includes:

[0068] The invalid data determination unit is configured to execute a process of parsing a data type based on declaration information, and when it is determined that the parsing of the target data type fails and / or it is determined that the target data type cannot be supported to generate simulation data, the simulation data of the target data type is determined as invalid data.

[0069] In an optional embodiment, the device further comprises:

[0070] The second invalid data determination module is configured to determine that the simulation data of the other data types is invalid data when a preset type declaration file including declaration information of the other data types is not obtained.

[0071] In an optional embodiment, the device further comprises:

[0072] A type determination module is configured to execute a process of parsing a data type based on the declaration information to determine whether the data type to be parsed is a data type for which simulation data needs to be generated;

[0073] The module for processing data of the type to be parsed is configured to generate simulation data corresponding to the data type to be parsed when it is determined that the data type to be parsed is a data type for which simulation data needs to be generated.

[0074] In an optional embodiment, the type determination module includes:

[0075] A marking information acquiring unit, configured to acquire data type marking information, wherein the data type marking information is used to describe the data type marked as the data type that needs to generate simulation data;

[0076] A first data type determining unit is configured to determine, when the data type to be parsed is the data type described by the data type tag information, that the data type to be parsed is the data type for which simulation data needs to be generated;

[0077] The second data type determining unit is configured to determine, when the data type to be parsed is not a data type described by the data type tag information, that the data type to be parsed is not a data type for which simulation data needs to be generated.

[0078] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device for data processing, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the data processing method as described above.

[0079] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of a server, the server is enabled to execute the data processing method as described above.

[0080] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes a computer program stored in a readable storage medium, and at least one processor of a computer device reads and executes the computer program from the readable storage medium, so that the device performs the above-mentioned data processing method.

[0081] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0082] The present disclosure obtains a type declaration file for a target object, parses a data type, generates target simulation data for the target object, and writes the target simulation data to an application programming interface platform for debugging the function of the target object. Since the present disclosure writes the generated target simulation data to an application programming interface platform for debugging the function of the target object, in the subsequent process of debugging the function of the target object, the target simulation data can be directly obtained from the application programming interface platform, thereby making it unnecessary for the front end to perceive the authenticity of the data in the process of obtaining the data, and thus eliminating the need to write the generated simulation data into the local code, thereby reducing the consumption of system resources during the development process, avoiding abnormal situations in the local code during the actual operation process, and improving the user account usage experience.

[0083] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0084] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0085] Figure 1 The diagram is a schematic diagram of an application environment of a data processing method according to an exemplary embodiment.

[0086] Figure 2 The figure is an architecture diagram of a mock system according to an exemplary embodiment.

[0087] Figure 3 A data processing method according to an exemplary embodiment is shown in FIG. Figure 1 .

[0088] Figure 4 The present invention is a schematic diagram showing a flow chart of parsing a type declaration file according to an exemplary embodiment.

[0089] Figure 5 A data processing method according to an exemplary embodiment is shown in FIG. Figure 2 .

[0090] Figure 6 It is a block diagram of a data processing device according to an exemplary embodiment.

[0091] Figure 7It is a block diagram of an electronic device for data processing according to an exemplary embodiment. DETAILED DESCRIPTION

[0092] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0093] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar first objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0094] After generating the simulation data, the related technology usually needs to write the simulation data into the local code one by one and implement the simulation device in the local code, wherein implementing the simulation device in the local code means: if it is a local environment, then return the simulation data, if it is a production environment, then return the real interface data.

[0095] However, with the increasing demand for front-end development, the amount of simulation data required in the front-end development process is large and the frequency of simulation data operations is high. The method of writing simulation data into the local code one by one not only increases the amount of local code and the consumption of system resources in the code writing process, but also makes the local code prone to exceptions during actual operation due to frequent operations on the simulation data written in the local code.

[0096] In addition, the related technology of writing the generated simulation data into the local code has the following risks: during the online operation of the local code, if the user account does not delete the simulation data written in the local code, the simulation data written in the local code will be returned regardless of the type of user or the type of scenario, which is equivalent to sending a debugging code to the actual production environment, thereby causing abnormal use of the user account and reducing the user experience of the user account.

[0097] Based on this, the present disclosure provides a data processing method, device, electronic device and storage medium. The method writes target simulation data to an application programming interface platform for debugging the functions of the target object. In the subsequent debugging of the functions of the target object, the target simulation data can be directly obtained from the application programming interface platform. As a result, the front end does not need to perceive the authenticity of the data during the data retrieval process, so there is no need to write the generated simulation data into the local code, which reduces the consumption of system resources in the development process, avoids abnormal situations in the actual operation of the local code, and improves the user account usage experience.

[0098] First, some nouns or terms involved in the claims and description of this application are explained below.

[0099] Front-end: Web front-end, APP end, desktop end, etc. all belong to this layer of user interface.

[0100] Backend: The server side, which refers to everything below the user interface.

[0101] See also Figure 1 , Figure 1 is a schematic diagram of an application environment of a data processing method according to an exemplary embodiment. Figure 2 As shown, the application environment may include an electronic device 01 and a server 02. The electronic device 01 and the server 02 may be interconnected and communicate with each other through a network.

[0102] The execution subject of the data generation method can be a simulation system (which can be called a mock system), which can be used to generate simulation data (i.e., mock data) for joint debugging between the electronic device 01 and the server 02. For the mock system, the present disclosure can be executed on the electronic device 01 or on the server 02, and the specific method can be determined according to actual use requirements and is not limited to this.

[0103] Electronic device 01 can belong to the front end of project development, and server 02 can belong to the back end of project development. Electronic device 01 can display pages for interaction, and server 02 can interact with the database to process the corresponding business logic and provide service interfaces for electronic device 01 to call to complete functional testing. Generally, the development of the front end needs to rely on the interface definition and returned data provided by the back end.

[0104] In an optional embodiment, the electronic device 01 may include but is not limited to a smart phone, a desktop computer, a tablet computer, a laptop computer, a smart speaker, a digital assistant, an augmented reality (AR) / virtual reality (VR) device, a smart wearable device, and other types of electronic devices. A data processing platform terminal is installed in the electronic device 01. Optionally, the operating system running on the electronic device may include but is not limited to Android system, IOS system, Linux, Windows, etc.

[0105] In an optional embodiment, the server 02 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.

[0106] In addition, it should be noted that Figure 1 What is shown is only one application environment of the data processing method provided by the present disclosure. In other scenarios, there may be other application environments, which are not limited by the present disclosure.

[0107] Figure 2 is an architecture diagram of a mock system according to an exemplary embodiment. Figure 2 As shown, the mock system includes:

[0108] 1. Basic Dependencies

[0109] The basic dependencies include:

[0110] Typescript: Contains the ts syntax parser, which is used to parse the ts type declaration file to generate an abstract syntax tree.

[0111] @faker-js: Generates mock data based on data types.

[0112] Lodash: A consistent, modular, high-performance JavaScript utility library.

[0113] 2. Core Layer

[0114] The core layer includes: ts syntax parser, type traversal, and simulation data generator.

[0115] The ts syntax parser is used to parse type declaration files through type detection, syntax detection, type parsing, etc. to generate a syntax tree.

[0116] Type walkers are used to traverse the syntax tree.

[0117] The simulation data generator is used to generate different simulation data according to different data types, wherein the data types include basic data types and complex data types.

[0118] 3. Access Layer

[0119] The access layer includes:

[0120] data: The type declaration file passed in, such as index.d.ts, needs to use the file system apifs.readFile to read the file as a string.

[0121] interface: the part where simulation data needs to be generated. It means that when generating simulation data, you can mark which types need to be generated. For example, in the index.d.ts file, if you only want to parse and generate simulation data for IParams, you can specify the parameter interface as ["IParams"].

[0122] anyTypeValue: fallback data when parsing fails. When data type parsing fails or simulation data cannot be generated, the default fallback value is assigned; for example, in the index.d.ts file, the data type of Custom is any, and simulation data cannot be accurately generated. You can specify the parameter anyTypeValue as invalid data (null), then the value of the simulation data of the data type Custom generated will be null, where null refers to invalid data.

[0123] importCommonInterface: refers to the additional type files that need to be imported when parsing the type declaration file. For example, the actual type of type Extra is IRemoteParams, which is not declared in the type file, so you need to import other type files that have declared IRemoteParams.

[0124] customMockData: custom mock data. Customize and replace the generated mock data with new mock data to make the new data more accurate and closer to the real situation.

[0125] 4. Business Scenarios

[0126] The business scenarios supported by this disclosure include:

[0127] 1) Used for development and joint debugging, supporting automatic simulation of data and docking with the application programming interface platform (API platform);

[0128] 2) Write test cases.

[0129] It should be noted that the user information (including but not limited to user accounts, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0130] The following takes the execution subject as a mock system as an example, and describes the data processing method provided by the embodiment of the present disclosure in an exemplary manner in combination with various drawings.

[0131] Figure 3 A data processing method according to an exemplary embodiment is shown in FIG. Figure 1 ,like Figure 3 As shown, the method comprises at least the following steps:

[0132] In step S11, a type declaration file for a target object is obtained; the type declaration file includes a data type and declaration information corresponding to the data type.

[0133] Optionally, the type declaration file may be a typescript file, which refers to a language file.

[0134] The type declaration file is defined for the target object during the development process. Exemplarily, the target object can be a component and / or an interface. Among them, the interface is generated by the back end, which is a general term for data interaction between the front end and the back end, and the back end transmits data to the front end through the interface. In the case where the type declaration file is defined for the interface, the type declaration file may refer to the output parameters of the interface. The component is generated by the front end, and the component is used to consume data, that is, the component usually obtains data through the interface provided by the back end to complete the rendering of the front-end page. In the case where the type declaration file is defined for the component, the type declaration file may refer to the input parameters of the component. As a result, the user account does not need to pay attention to the differences in the environment and the specific implementation of the component / interface during the development process. It only needs to pay attention to the input and output parameter types of the component and interface, and the mock data and debugging component / interface functions can be automatically constructed through the mock system in the present disclosure.

[0135] Optionally, the type declaration file includes a data type and declaration information corresponding to the data type. The declaration information is the data description information of the data type. The data description information may include at least one of the following: data type information, data size information, etc., and of course may also include any other possible information, which is not limited in the embodiments of the present disclosure. The data description information of different data types may be different. For example, for a numeric type, its data description information may include data type information "number"; data size information "[1, 10]", which is used to agree on a legal numeric range. For another example, for a string type, its data description information may include data type information "string"; data size information "maximum length: 9", which is used to agree on a string length range.

[0136] It should be noted that the data type can be various data types, and the present disclosure does not make any specific limitation on this.

[0137] In step S12, the data type is parsed based on the declaration information to generate target simulation data for the target object.

[0138] Optionally, the mock system can be based on Figure 2 The basic dependencies, core layer, and access layer parse the data types and generate target simulation data for the target object. The target simulation data should conform to the declaration information corresponding to the data type.

[0139] In step S13, the target simulation data is written to the application programming interface platform for debugging the function of the target object.

[0140] After generating the target simulation data, the mock system can write the target simulation data to the API platform. The target simulation data written to the API platform is used to debug the function of the target object, that is, to develop the joint debugging process.

[0141] Since the present invention writes the generated target simulation data to the application programming interface platform for debugging the functions of the target object, in the subsequent process of debugging the functions of the target object, the target simulation data can be directly obtained from the application programming interface platform, thereby making it unnecessary for the front end to perceive the authenticity of the data during the process of retrieving the data, so that there is no need to write the generated simulation data into the local code, thereby reducing the consumption of system resources in the development process. At the same time, since there is no need to write the generated simulation data into the local code, frequent operations on the local code are avoided, which may cause abnormal situations in the actual operation of the local code. In addition, there is no need to write the generated simulation data into the local code, which can also avoid sending the debugging code to the actual production environment, thereby avoiding abnormal use of user accounts, thereby improving the user account usage experience.

[0142] The following first provides an overall description of the parsing process of the type declaration file.

[0143] Figure 4 is a schematic diagram of a flow chart of parsing a type declaration file according to an exemplary embodiment. Figure 4 As shown, the process of parsing the type declaration file includes:

[0144] The ts syntax parser parses the type declaration file and generates a syntax tree of the type declaration file; the syntax tree includes at least one node, and at least one node corresponds to at least one data type.

[0145] The type traversal device traverses each node and determines whether the type traversal device supports the data type corresponding to each node.

[0146] For type data that supports the generation of simulated data, the type traverser transfers the type data to the simulated data generator for processing. The simulated data generator uses the @faker-js package to generate simulated data of the data type. The generated simulated data should conform to the declaration information of the type data. Exemplarily, the simulated data may include but is not limited to: numbers, types, Booleans, tuples, objects, arrays, enumerations, etc.

[0147] After the traversal, the type traverser will assemble the simulation data generated by the simulation data generator to obtain the target simulation data for the target object. It will also process the data according to the customMockData and importCommonInterface parameters passed in by the access layer to finally produce the simulation data.

[0148] Among them, faker is a JavaScript library for generating random data, including name, address, phone number, email, date, etc. It provides a large number of data generation methods, which can quickly generate various types of simulated data, which is very useful for situations where real data needs to be used for verification during development and testing; on the other hand, the data generation method based on faker generates random data according to different rules and patterns, which helps to simulate the data changes and diversity in the real world. For example, if the data type is a numeric type, faker.random.number() is called to generate a random integer; if it is a string type, faker.lorem.word() is called to generate a random word; if it is a Boolean type, faker.random.boolean() is called to generate a random Boolean value, and so on.

[0149] It should be noted that the generated simulation data should comply with the declaration information of the data type. When the data type is a numeric type, a random integer that complies with the data description information corresponding to the numeric type is generated. When the data type is a string type, a random string that complies with the data description information corresponding to the string type is generated. When the data type is a Boolean type, a random Boolean value that complies with the data description information corresponding to the Boolean type is generated. Exemplarily, for a numeric type, its simulation data can be a random number that complies with the data description information corresponding to the numeric type, that is, the random number should be within the agreed legal numeric range (for example, [1,10]). For a string type, its simulation data can be a random string that complies with the data description information corresponding to the string type, that is, the random string should be within the agreed string length range (for example, the maximum string length is 9).

[0150] In an optional embodiment, the type declaration file includes multiple data types and declaration information corresponding to at least some of the multiple data types. Figure 5 A data processing method according to an exemplary embodiment is shown in FIG. Figure 2 ,like Figure 5 As shown, in the above step S12, the above-mentioned parsing data types based on the declaration information to generate target simulation data for the target object includes:

[0151] S121. For some data types for which corresponding declaration information exists in the type declaration file, the part of the data type is parsed based on the declaration information corresponding to the part of the data type, and simulation data corresponding to the part of the data type is generated; for other data types for which corresponding declaration information does not exist in the type declaration file, the declaration information of the other data types is obtained from the preset type declaration file in which the other data types have been declared, the other data types are parsed based on the declaration information of the other data types, and simulation data corresponding to the other data types is generated;

[0152] S123. Combine the simulation data corresponding to each of the multiple data types to generate target simulation data for the target object.

[0153] In this embodiment, the above-mentioned type declaration file includes multiple data types and declaration information corresponding to at least some of the multiple data types. That is, the type declaration file includes multiple data types and declaration information corresponding to each data type. For example, the type declaration file includes N data types and declaration information corresponding to the N data types. Or, the type declaration file includes multiple data types and declaration information corresponding to some data types. For example, the type declaration file includes N data types and declaration information corresponding to M data types, where N is a positive integer greater than 1 and M is a positive integer less than N.

[0154] The mock system can use the ts syntax parser to parse the type declaration file and generate a syntax tree of the type declaration file; the syntax tree includes multiple nodes, and the multiple nodes correspond to multiple data types one by one. The type traverser traverses each node to determine whether the data type corresponding to the node has corresponding declaration information in the type declaration file. If so, the data type is a partial data type. If it is determined that the simulation data generator supports the generation of simulation data for this partial data type, faker is called to generate simulation data that conforms to the declaration information corresponding to the partial data type. If not, it is considered that the data type is a type other than the partial data type. The mock system can import additional type declaration files through the importCommonInterface of the access layer. Specifically, the mock system obtains the declaration information of the other data type from other preset type declaration files that have declared the other data type. If it is determined that the simulation data generator supports the generation of simulation data for the other data type, faker is called to generate simulation data that conforms to the declaration information corresponding to the other data type. For example, the actual type of type Extra is IRemoteParams, which is not declared in the type declaration file, so it is necessary to import other type files that have declared IRemoteParams.

[0155] After obtaining the simulation data of some data types and the simulation data of other data types, the mock system combines the simulation data of some data types with the simulation data of other data types to obtain target simulation data for the target object.

[0156] Therefore, for some data types that have corresponding declaration information in the type declaration file, the corresponding simulation data is directly generated based on the declaration information. For other data types that do not have corresponding declaration information, a special type declaration file can be imported to accurately generate corresponding simulation data for each data type, thereby improving the accuracy of debugging the target object and writing test cases.

[0157] In an optional embodiment, the method further includes: in the process of parsing the data type based on the declaration information, if it is determined that the parsing of the target data type among the multiple data types meets a preset condition, determining the simulation data of the target data type as invalid data.

[0158] It should be noted that the “process of parsing data types based on declaration information” includes the above-mentioned process of parsing some types of data, as well as the process of parsing other types of data.

[0159] In the process of parsing data types based on declaration information, if the mock system determines that the parsing of the target data type among multiple data types meets the preset conditions, a fallback value is assigned to the target data type through anyTypeValue in the access layer. For example, the mock data of the target data type is determined to be invalid data.

[0160] It should be noted that the preset condition can be set according to actual needs and is not specifically limited thereto.

[0161] Therefore, when the data type parsing fails, a fallback invalid data can be assigned to the data type, so that the mock system can generate corresponding simulation data for each data type, thereby improving the performance of the mock system in generating simulation data.

[0162] In a specific embodiment, in the process of parsing the data type based on the declaration information, if it is determined that the parsing of the target data type among the multiple data types meets the preset condition, the simulation data of the target data type is determined as invalid data, including:

[0163] In the process of parsing the data type based on the declaration information, if it is determined that the parsing of the target data type fails and / or it is determined that the target data type cannot be supported to generate simulation data, the simulation data of the target data type is determined as invalid data.

[0164] Optionally, the preset condition may include, but is not limited to: a condition that the parsing of the target data type fails, and a condition that the target data type cannot be supported to generate simulated data. When the mock system determines that the parsing of the target data type fails, and / or determines that the target data type cannot be supported to generate simulated data, the target data type is assigned a fallback value through anyTypeValue in the access layer, for example, the simulated data of the target data type is determined to be invalid data.

[0165] Exemplarily, the condition for the target data type to fail to parse may refer to: during the process of parsing the target data type based on the declaration information, no simulation data that conforms to the declaration information corresponding to the target data type is generated. Or, during the process of parsing the target data type, an error such as parsing termination occurs.

[0166] Exemplarily, the condition that the target data type cannot be supported to generate simulation data may refer to: the simulation data generator does not support the generation of simulation data of the target data type, etc.

[0167] Therefore, when the parsing of the target data type fails and / or it is determined that the target data type cannot be supported to generate simulation data, a fallback invalid data can be assigned to the data type, so that the mock system can set fallback data for the data type that fails to parse and / or cannot generate simulation data, further improving the performance of the mock system in generating simulation data.

[0168] In an optional embodiment, the above method may further include:

[0169] In the case that the preset type declaration file including declaration information of other data types is not obtained, it is determined that the simulation data of other data types are invalid data.

[0170] In this embodiment, if the mock system fails to obtain the preset type declaration file that includes declaration information of other data types, that is, the mock system cannot obtain the preset type declaration file that has declared the other data type through the importCommonInterface of the access layer, the mock system can assign a fallback value to the other data type through anyTypeValue in the access layer, for example, determining the simulated data of other data types as invalid data.

[0171] Therefore, when the declaration information of other data types is not included in the type declaration file and the declaration information of other data types cannot be obtained from the general preset type declaration file, a fallback invalid data can be assigned to the other data type, further improving the performance of the mock system in generating simulation data.

[0172] In an optional embodiment, the above method may further include:

[0173] In the process of parsing the data type based on the declaration information, it is determined whether the data type to be parsed is a data type for which simulation data needs to be generated.

[0174] When it is determined that the data type to be parsed is a data type for which simulation data needs to be generated, simulation data corresponding to the data type to be parsed is generated.

[0175] In this embodiment, in addition to determining the simulation data of all data types included in the type declaration file in the above manner, the mock system can also pre-specify which data types in the type declaration file need to generate simulation data, thereby improving the flexibility of simulation data generation and making the simulation data generation process more in line with the needs of the user account.

[0176] Optionally, in the process of the type traverser traversing each node, the mock system can determine whether the data type to be parsed corresponding to the currently traversed node is the data type that needs to generate simulated data. If the data type to be parsed corresponding to the currently traversed node is the data type that needs to generate simulated data, and the simulation data generator supports the generation of simulated data for the data type to be parsed, the simulation data generator will use the @faker-js package to generate simulated data for the data type to be parsed, and the generated simulated data should comply with the declaration information of the corresponding type data.

[0177] In an optional embodiment, the above-mentioned determining whether the data type to be parsed is the data type for which simulation data needs to be generated includes:

[0178] Get data type tag information, where the data type tag information is used to describe the data type that is marked as requiring simulation data to be generated.

[0179] In the case that the data type to be parsed is the data type described by the data type tag information, it is determined that the data type to be parsed is the data type for which simulation data needs to be generated.

[0180] In the case that the data type to be parsed is a data type not described by the data type tag information, it is determined that the data type to be parsed is not a data type for which simulation data needs to be generated.

[0181] Optionally, the mock system can use the interface parameter in the access layer to mark the data type for which simulation data needs to be generated, and obtain data type marking information. The data type marking information is used to describe the data type marked as the data type for which simulation data needs to be generated. For example, if the type declaration file is an index.d.ts file, and if only the data type in it needs to parse IParams and generate simulation data, the parameter interface can be specified as ["IParams"].

[0182] Exemplarily, when the mock system obtains the type declaration file at the access layer, it can simultaneously pass in the data type tag information. In the process of traversing each node by the traversal type traverser, the mock system can determine whether the data type to be parsed corresponding to the currently traversed node is the data type that needs to generate simulation data, that is, whether the data type to be parsed is the data type described by the data type tag information. If so, it is determined that the data type to be parsed is the data type that needs to generate simulation data. If not, it is determined that the data type to be parsed is not the data type that needs to generate simulation data. Therefore, the data type tag information passed in through the access layer can accurately determine which data types are the data types that need to generate simulation data at a low cost, further improving the generation accuracy of simulation data.

[0183] In an optional embodiment, in the above step S123, combining the simulation data corresponding to each of the multiple data types to generate target simulation data for the target object may include:

[0184] According to the sorting order information corresponding to the multiple data types, the simulation data corresponding to the multiple data types are combined to generate target simulation data for the target object, wherein the sorting order information is used to indicate the order in which the declaration information corresponding to the multiple data types is arranged.

[0185] In an optional embodiment, after generating the target simulation data for the target object, the method further includes:

[0186] In response to the modification instruction for the target simulation data, the target simulation data is modified to obtain the modified target simulation data.

[0187] In this embodiment, after obtaining the target simulation data, if the target simulation data does not meet expectations or does not meet the actual situation, the user account can also modify the target simulation data. Specifically, the mock system can modify the target simulation data in response to the user account's modification instruction on the target simulation data, so that the modified target simulation data meets expectations or meets the actual situation.

[0188] Therefore, when the generated target simulation data does not meet the requirements, the target simulation data can be modified so that the modified target simulation data meets expectations or the actual situation, and the expected or actual situation can be used to write test cases or functional tests of the target objects, which can further improve the accuracy of functional testing or test case writing, thereby further improving the user experience of the user account.

[0189] In an optional embodiment, in response to the instruction to modify the target simulation data, modifying the target simulation data to obtain the modified target simulation data may include:

[0190] In response to a custom modification instruction for the target simulation data, defining the target simulation data as a preset data value to obtain modified target simulation data; and / or,

[0191] In response to a custom modification instruction for the target simulation data, the target data is defined as any data value in a preset data value range to obtain modified target simulation data.

[0192] In this embodiment, the mock system can customize the target simulation data through the customMockData in the access layer, define the target simulation data as a preset data value, or define the target data as any data value in the preset data value range to obtain the modified target simulation data. For example, the normal life of an object is 1 to 100 years old, and the value of the simulation data generated by the mock system is tens of thousands. The simulation data finally generated does not conform to the actual situation. At this time, the mock system can define in customMockData that the age field in IParams is 80, or randomly define a data value between 1 and 80 to obtain the modified target simulation number. Therefore, through the customized modification method, the generated simulation data is more consistent with the defined field semantics, which can further improve the accuracy of functional testing or test case writing, thereby further improving the user account usage experience.

[0193] In an optional embodiment, the application programming interface platform includes a preset interface, and in the above step S13, the above writing the target simulation data to the application programming interface platform includes:

[0194] The target simulation data is written to the application programming interface platform based on a preset interface.

[0195] It should be noted that the embodiments of the present disclosure do not limit the application programming interface platform. It can be a preset application programming interface platform or an application programming interface platform built by a user account. Regardless of whether it is preset or built by a user account, an open preset interface will be provided. The preset interface is used to provide it to the user account for calling. The user account uses the interface to automatically write the target simulation data to the application programming interface platform. On the one hand, the target simulation data is written into the application programming interface platform through an open preset interface, which improves the convenience of writing the target simulation data. On the other hand, the generated target simulation data is written into the application programming interface platform, and in the subsequent debugging of the function of the target object, the target simulation data can be directly obtained from the application programming interface platform. As a result, the front end does not need to perceive the authenticity of the data in the process of retrieving the data, and thus does not need to write the generated simulation data into the local code, which reduces the consumption of system resources in the development process. At the same time, since there is no need to write the generated simulation data into the local code, frequent operations on the local code are avoided, which may cause abnormal situations in the actual operation of the local code. In addition, there is no need to write the generated simulation data into the local code, which can also avoid the problem of sending the debugging code to the actual production environment, thereby avoiding abnormal use of user accounts and improving the user account usage experience.

[0196] In a specific embodiment, the above-mentioned writing the target simulation data to the application programming interface platform based on the preset interface may include:

[0197] In response to a call instruction from a user account to a preset interface in an application programming interface platform, the preset interface is transmitted to the user account.

[0198] In response to a write operation of the user account to the target simulation data through a preset interface, the simulation data is written to the application programming interface platform.

[0199] In this embodiment, when the user account wants to write the generated target simulation data into the API platform, the user account can send a call instruction of the preset interface to the mock system. The mock system calls the preset interface from the API platform in response to the call instruction and provides the preset interface to the user account. The user account writes the target simulation data through the preset interface, thereby triggering the write operation of the target simulation data. The mock system responds to the write operation and writes the simulation data to the API platform.

[0200] Optionally, the user account may be a user with permission to write simulation data, such as a developer.

[0201] Therefore, the preset interface can be called according to the user account, and the target simulation data can be written into the API platform through the write operation in the preset interface, thereby improving the writing convenience, writing efficiency and writing accuracy of the target simulation data.

[0202] In an optional embodiment, the above method may further include: in the process of writing the target simulation data to the application programming interface platform, not retaining a backup of the target simulation data at the front end and / or the back end.

[0203] Since the present invention writes the target simulation data to the application programming interface platform, in the process of writing the target simulation data to the application programming interface platform, the backup of the target simulation data is not retained in the front end and / or the back end, so there is no need to write the generated simulation data into the local code, which reduces the consumption of system resources in the development process. At the same time, since there is no need to write the generated simulation data into the local code, frequent operations on the local code are avoided, which may cause abnormal situations in the actual operation of the local code. In addition, there is no need to write the generated simulation data into the local code, which can also avoid the problem of sending the debugging code to the actual production environment, thereby avoiding abnormal use of user accounts and improving the user account usage experience.

[0204] In an optional embodiment, the target object includes a component / interface, and after writing the target simulation data to the application programming interface platform, the method further includes:

[0205] Receive a data acquisition request sent by a user account, where the data acquisition request carries identification information of the user account;

[0206] Acquire simulation data corresponding to the identification information from the application programming interface platform;

[0207] The simulation data corresponding to the identification information is sent to the user account; the user account is used to debug the function of the component / interface based on the simulation data corresponding to the identification information.

[0208] It should be noted that when a user account registers target simulation data to an API, a mapping relationship between the identification information of the user account and the target simulation data registered by the user account will be established.

[0209] In this embodiment, when the user account needs to be developed and debugged, that is, the function of the component / interface needs to be debugged, the user account can send a data acquisition request to the mock system. The mock system responds to the data acquisition request and determines whether the user account has written simulation data in the application programming interface platform. If so, the mock system obtains the simulation data corresponding to the identification information of the user account from the application programming interface platform according to the above mapping relationship, and sends the simulation data to the user account. The user account uses the historical simulation data to debug the function of the component / interface. If not, the simulation data is not sent to the user account. As a result, in the subsequent process of debugging the function of the target object, the target simulation data can be directly obtained from the application programming interface platform, so that the front end does not need to perceive the authenticity of the data in the process of retrieving data, which improves the user experience of the user account.

[0210] The present disclosure also provides a data processing device, Figure 6 is a block diagram of a data processing device according to an exemplary embodiment. Figure 6 As shown, the data processing device includes:

[0211] A type declaration file acquisition module 21 is configured to execute acquisition of a type declaration file for a target object; the type declaration file includes a data type and declaration information corresponding to the data type;

[0212] A parsing module 22, configured to parse the data type based on the declaration information to generate target simulation data for the target object;

[0213] The writing module 23 is configured to write the target simulation data into an application programming interface platform for debugging the function of the target object.

[0214] In an optional embodiment, the writing module includes:

[0215] The target simulation data writing unit is configured to write the target simulation data to the application programming interface platform based on the preset interface.

[0216] In an optional embodiment, the target simulation data writing unit includes:

[0217] a call instruction response subunit, configured to execute a call instruction of a user account to a preset interface in the application programming interface platform, and transmit the preset interface to the user account;

[0218] The write operation response subunit is configured to execute a write operation on the target simulation data by the user account through the preset interface, and write the simulation data to the application programming interface platform.

[0219] In an optional embodiment, the device further comprises:

[0220] The backup processing unit is configured to execute a process of not retaining a backup of the target simulation data at the front end and / or the back end during the process of writing the target simulation data to the application programming interface platform.

[0221] In an optional embodiment, the target object includes a component / interface, and the apparatus further includes:

[0222] A data acquisition request receiving module, configured to execute and receive a data acquisition request sent by a user account, wherein the data acquisition request carries identification information of the user account;

[0223] A simulation data acquisition module, configured to execute acquisition of simulation data corresponding to the identification information from the application programming interface platform;

[0224] The simulation data sending module is configured to execute sending the simulation data corresponding to the identification information to the user account; the user account is used to debug the function of the component / interface based on the simulation data corresponding to the identification information.

[0225] In an optional embodiment, the device further comprises:

[0226] The modification instruction response module is configured to execute in response to the modification instruction on the target simulation data, modify the target simulation data, and obtain modified target simulation data.

[0227] In an optional embodiment, the modification instruction response module includes:

[0228] a custom modification instruction response unit, configured to execute in response to a custom modification instruction on the target simulation data, define the target simulation data as a preset data value, and obtain modified target simulation data; and / or,

[0229] In response to a custom modification instruction for the target simulation data, the target data is defined as any data value in a preset data value range to obtain modified target simulation data.

[0230] In an optional embodiment, the type declaration file includes multiple data types and declaration information corresponding to at least some of the multiple data types, and the parsing module includes:

[0231] A generating unit is configured to execute, for some data types for which corresponding declaration information exists in the type declaration file, parsing the some data types based on the declaration information corresponding to the some data types, and generating simulation data corresponding to the some data types; for other data types for which corresponding declaration information does not exist in the type declaration file, obtaining the declaration information of the other data types from a preset type declaration file in which the other data types have been declared, parsing the other data types based on the declaration information of the other data types, and generating simulation data corresponding to the other data types;

[0232] The combining unit is configured to combine the simulation data corresponding to each of the plurality of data types to generate target simulation data for the target object.

[0233] In an optional embodiment, the device further comprises:

[0234] The first invalid data determination module is configured to execute a process of parsing data types based on declaration information, and if it is determined that the parsing of a target data type among the multiple data types meets a preset condition, determine the simulation data of the target data type as invalid data.

[0235] In an optional embodiment, the first invalid data determination module includes:

[0236] The invalid data determination unit is configured to execute a process of parsing a data type based on declaration information, and when it is determined that the parsing of the target data type fails and / or it is determined that the target data type cannot be supported to generate simulation data, the simulation data of the target data type is determined as invalid data.

[0237] In an optional embodiment, the device further comprises:

[0238] The second invalid data determination module is configured to determine that the simulation data of the other data types is invalid data when a preset type declaration file including declaration information of the other data types is not obtained.

[0239] In an optional embodiment, the device further comprises:

[0240] A type determination module is configured to execute a process of parsing a data type based on the declaration information to determine whether the data type to be parsed is a data type for which simulation data needs to be generated;

[0241] The module for processing data of the type to be parsed is configured to generate simulation data corresponding to the data type to be parsed when it is determined that the data type to be parsed is a data type for which simulation data needs to be generated.

[0242] In an optional embodiment, the type determination module includes:

[0243] A marking information acquiring unit, configured to acquire data type marking information, wherein the data type marking information is used to describe the data type marked as the data type that needs to generate simulation data;

[0244] A first data type determining unit is configured to determine, when the data type to be parsed is the data type described by the data type tag information, that the data type to be parsed is the data type for which simulation data needs to be generated;

[0245] The second data type determining unit is configured to determine, when the data type to be parsed is not a data type described by the data type tag information, that the data type to be parsed is not a data type for which simulation data needs to be generated.

[0246] Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.

[0247] In an exemplary embodiment, a data processing electronic device is also provided, including a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to implement the steps of any data processing method in the above embodiments when executing the instructions stored in the memory.

[0248] The electronic device may be a terminal, a server or a similar computing device. For example, the electronic device is a server. Figure 7It is a block diagram of an electronic device for data processing according to an exemplary embodiment. The electronic device 30 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 31 (the central processing unit 31 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 33 for storing data, and one or more storage media 32 (such as one or more mass storage devices) for storing application programs 323 or data 322. Among them, the memory 33 and the storage medium 32 can be short-term storage or permanent storage. The program stored in the storage medium 32 may include one or more modules, each of which may include a series of instruction operations in the electronic device. Furthermore, the central processing unit 31 can be configured to communicate with the storage medium 32 to execute a series of instruction operations in the storage medium 32 on the electronic device 30. The electronic device 30 may also include one or more power supplies 36, one or more wired or wireless network interfaces 35, one or more input and output interfaces 34, and / or one or more operating systems 321, such as Windows ServerTM, Mac OSXTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0249] The input / output interface 34 may be used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the electronic device 30. In one example, the input / output interface 34 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In an exemplary embodiment, the input / output interface 34 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0250] It can be understood by those skilled in the art that Figure 7 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 7 More or fewer components as shown, or with Figure 7 Different configurations shown.

[0251] In an exemplary embodiment, a computer-readable storage medium is also provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the steps of any data processing method in the above embodiments.

[0252] In an exemplary embodiment, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, the data processing method provided in any one of the above embodiments is implemented.

[0253] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present disclosure can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0254] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0255] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A data processing method, It is characterized in that The method comprises: Obtain a type declaration file for a target object; the type declaration file includes a data type and declaration information corresponding to the data type; Parsing the data type based on the declaration information to generate target simulation data for the target object; The target simulation data is written to an application programming interface platform for debugging the function of the target object.

2. The method according to claim 1, It is characterized in that The application programming interface platform includes a preset interface, and the step of writing the target simulation data to the application programming interface platform includes: The target simulation data is written to an application programming interface platform based on the preset interface.

3. The method according to claim 2, It is characterized in that The step of writing the target simulation data to the application programming interface platform based on the preset interface includes: In response to a call instruction from a user account to a preset interface in the application programming interface platform, transmitting the preset interface to the user account; In response to the user account's write operation on the target simulation data through the preset interface, the simulation data is written to the application programming interface platform.

4. The method according to claim 1, It is characterized in that The method further comprises: In the process of writing the target simulation data to the application programming interface platform, no backup of the target simulation data is retained at the front end and / or the back end.

5. The method according to claim 1, It is characterized in that The target object includes a component / interface. After writing the target simulation data to the application programming interface platform, the method further includes: Receiving a data acquisition request sent by a user account, wherein the data acquisition request carries identification information of the user account; Acquire simulation data corresponding to the identification information from the application programming interface platform; The simulation data corresponding to the identification information is sent to the user account; the user account is used to debug the function of the component / interface based on the simulation data corresponding to the identification information.

6. The method according to claim 1, It is characterized in that After generating the target simulation data for the target object, the method further includes: In response to a modification instruction for the target simulation data, modify the target simulation data to obtain modified target simulation data; The step of writing the target simulation data into an application programming interface platform for debugging the function of the target object includes: The modified target simulation data is written to an application programming interface platform for debugging the function of the target object.

7. The method according to claim 6, It is characterized in that The step of modifying the target simulation data in response to the modification instruction of the target simulation data to obtain the modified target simulation data comprises: In response to a custom modification instruction for the target simulation data, defining the target simulation data as a preset data value to obtain modified target simulation data; and / or, In response to a custom modification instruction for the target simulation data, the target data is defined as any data value in a preset data value range to obtain modified target simulation data.

8. The method according to claim 1, It is characterized in that The type declaration file includes a plurality of data types and declaration information corresponding to at least some of the data types in the plurality of data types, and the data types are parsed based on the declaration information to generate target simulation data for the target object, including: For some data types that have corresponding declaration information in the type declaration file, the partial data types are parsed based on the declaration information corresponding to the partial data types, and simulation data corresponding to the partial data types are generated; For other data types for which corresponding declaration information does not exist in the type declaration file, obtaining the declaration information of the other data types from a preset type declaration file that has declared the other data types, parsing the other data types based on the declaration information of the other data types, and generating simulation data corresponding to the other data types; The simulation data corresponding to each of the plurality of data types are combined to generate target simulation data for the target object.

9. The method according to claim 8, It is characterized in that The method further comprises: In the process of parsing the data type based on the declaration information, if it is determined that the parsing of the target data type among the multiple data types meets the preset condition, the simulation data of the target data type is determined as invalid data.

10. The method according to claim 9, It is characterized in that The step of determining, in the process of parsing the data type based on the declaration information, that the parsing of the target data type among the multiple data types satisfies a preset condition, determining the simulation data of the target data type as invalid data comprises: In the process of parsing the data type based on the declaration information, if it is determined that the parsing of the target data type fails and / or it is determined that the target data type cannot be supported to generate simulation data, the simulation data of the target data type is determined as invalid data.

11. The method according to claim 8, It is characterized in that The method further comprises: In a case where the preset type declaration file including the declaration information of the other data types is not obtained, it is determined that the simulation data of the other data types is invalid data.

12. The method according to claim 8, It is characterized in that The method further comprises: In the process of parsing the data type based on the declaration information, determining whether the data type to be parsed is the data type for which simulation data needs to be generated; When it is determined that the data type to be parsed is a data type for which simulation data needs to be generated, simulation data corresponding to the data type to be parsed is generated.

13. The method according to claim 12, It is characterized in that The step of determining whether the data type to be parsed is a data type for which simulation data needs to be generated includes: Acquire data type tag information, where the data type tag information is used to describe the data type that is marked as requiring simulation data to be generated; In a case where the data type to be parsed is the data type described by the data type tag information, determining that the data type to be parsed is the data type for which simulation data needs to be generated; In the case that the data type to be parsed is not a data type described by the data type tag information, it is determined that the data type to be parsed is not a data type for which simulation data needs to be generated.

14. A data processing device, It is characterized in that include: A type declaration file acquisition module is configured to execute acquisition of a type declaration file for a target object; The type declaration file includes a data type and declaration information corresponding to the data type; A parsing module, configured to parse the data type based on the declaration information to generate target simulation data for the target object; The writing module is configured to execute writing of the target simulation data into an application programming interface platform for debugging the function of the target object.

15. An electronic device, It is characterized in that include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the data processing method according to any one of claims 1 to 13.

16. A computer-readable storage medium, It is characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data processing method as claimed in any one of claims 1 to 13.

Citation Information

Patent Citations

  • Interface simulation method and system, medium and electronic equipment

    CN110489101A

  • Data generation method and device, electronic equipment and storage medium

    CN111399819A

  • Interface simulation method and device, equipment and storage medium

    CN111752644A

  • Intelligent gateway service management platform

    CN115037577A

  • Interface data simulation method and device, equipment, storage medium and program product

    CN116643902A

Cited By

  • Simulation data generation method and device and storage medium

    CN120123231A