Data verification method and device, electronic equipment and storage medium

By extracting and encapsulating the key information in the data verification request and using the verification service class to obtain the validator chain for verification, the problems of limited scenarios and low efficiency of the existing data verification solution are solved, and flexible and efficient data verification is achieved.

CN119849480APending Publication Date: 2025-04-18创优数字科技(广东)有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510117162.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

Existing data verification solutions have limited support scenarios, insufficient flexibility, and low verification efficiency.

Method used

By receiving data verification requests, extract the data object to be verified, verify context information and validator types, encapsulate this information, obtain the validator chain and verification logic provided by the verification service class, and use the validator chain to verify the data to obtain the data verification results.

Benefits of technology

Improves the efficiency and flexibility of data verification, and can adapt to different verification scenarios without modifying rules and redeployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119849480A_ABST
    Figure CN119849480A_ABST
Patent Text Reader

Abstract

The invention discloses a data verification method and device, electronic equipment and a storage medium, which are used for solving the technical problems of limited support scene, insufficient flexibility and low verification efficiency of the existing data verification scheme. The method comprises the steps of receiving a data verification request; extracting a to-be-verified data object, verification context information and a verifier type from the data verification request; packaging the to-be-verified data object, the verification context information and the verifier type to obtain packaged data; obtaining a verifier chain and verification logic corresponding to the encapsulation data through a verification service class; and executing the verification logic on the encapsulated data by adopting the verifier chain to obtain a data verification result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Data validation is the process of checking input or stored data to ensure that it meets specific standards or rules. This process involves many aspects, including but not limited to the format, type, scope, uniqueness, and relevance of data to other data. Data validation is a common requirement in current enterprise application systems. The existing data validation solutions mainly include:

[0003] 1. Hard-coded verification: Writing if-else verification logic directly in the business code is common in early systems or simple projects. There are problems such as high coupling between verification logic and business logic, poor code readability and maintainability.

[0004] 2. Annotation validation: Using annotations provided by frameworks such as Hibemate Validator has problems such as limited support for complex validation scenarios and insufficient flexibility. Summary of the invention

[0005] The present invention provides a data verification method, device, electronic device and storage medium, which are used to solve the technical problems that existing data verification schemes support limited scenarios, lack flexibility and have low verification efficiency.

[0006] The present invention provides a data verification method, comprising:

[0007] receiving data verification requests;

[0008] Extracting the data object to be verified, verification context information and verifier type from the data verification request;

[0009] Encapsulate the data object to be verified, the verification context information and the verifier type to obtain encapsulated data;

[0010] Obtain the validator chain and verification logic corresponding to the encapsulated data through the verification service class;

[0011] The validator chain is used to execute the verification logic on the encapsulated data to obtain a data verification result.

[0012] Optionally, the step of obtaining the validator chain and verification logic corresponding to the encapsulated data through the verification service class includes:

[0013] Send the validator type to the validator factory through the validation service class;

[0014] Receive the validator returned by the validator factory in response to the validator type and the validation logic corresponding to each of the validators;

[0015] Get the rule priority and dependency between validators;

[0016] A validator chain is constructed based on the rule priorities and the dependencies.

[0017] Optionally, the step of using the validator chain to execute the verification logic on the encapsulated data to obtain a data verification result includes:

[0018] Determine each validator as the current validator in turn according to the order of the validators in the validator chain;

[0019] Determine whether the current validator has a dependent validator according to the dependency relationship;

[0020] If so, determining whether the dependency validator has been executed;

[0021] If the execution is completed, the verification logic corresponding to the current verifier is executed to obtain the verification result of the current verifier, and the verification result is saved;

[0022] Determine whether all the validators have been fully executed;

[0023] If not, the next validator is determined as the current validator, and the process returns to the step of determining whether the current validator has a dependent validator according to the dependency relationship;

[0024] If yes, combine all the verification results to obtain the data verification result.

[0025] Optionally, the step of combining all the verification results to obtain a data verification result includes:

[0026] extracting an error message from the verification result;

[0027] Merge all the error messages to obtain an error message list;

[0028] Extracting the verification status of each verifier from the verification result;

[0029] Merging all the verification statuses to obtain a verification status list;

[0030] The error message list and the verification status list are output as data verification results.

[0031] The present invention also provides a data verification device, comprising:

[0032] A data verification request receiving module, used for receiving a data verification request;

[0033] A data extraction module, used to extract the data object to be verified, verification context information and verifier type from the data verification request;

[0034] An encapsulation module, used to encapsulate the data object to be verified, the verification context information and the verifier type to obtain encapsulated data;

[0035] A validator chain and verification logic acquisition module, used to obtain the validator chain and verification logic corresponding to the encapsulated data through the verification service class;

[0036] A verification module is used to use the validator chain to execute the verification logic on the encapsulated data to obtain a data verification result.

[0037] Optionally, the validator chain and verification logic acquisition module include:

[0038] A validator type sending submodule, used for sending the validator type to the validator factory through the validation service class;

[0039] A validator and verification logic receiving submodule, used to receive the validator returned by the validator factory in response to the validator type and the verification logic corresponding to each of the validators;

[0040] The rule priority and dependency acquisition submodule is used to obtain the rule priority and dependency between each validator;

[0041] The validator chain building submodule is used to build a validator chain based on the rule priority and the dependency relationship.

[0042] Optionally, the verification module includes:

[0043] A current validator determination submodule, used to determine each validator as the current validator in turn according to the order of each validator in the validator chain;

[0044] A dependent validator judgment submodule is used to judge whether the current validator has a dependent validator according to the dependency relationship;

[0045] An execution completion judgment submodule, used to judge whether the dependency validator has been executed, if any;

[0046] A verification result saving submodule is used to execute the verification logic corresponding to the current verifier if the execution is completed, obtain the verification result of the current verifier, and save the verification result;

[0047] A full execution judgment submodule is used to judge whether all the validators have been fully executed;

[0048] The return submodule is used to determine the next validator as the current validator if no, and return to the step of determining whether the current validator has a dependent validator according to the dependency relationship;

[0049] The merging submodule is used to merge all the verification results to obtain a data verification result.

[0050] Optionally, the merging submodule includes:

[0051] An error message extraction unit, used to extract an error message from the verification result;

[0052] an error message list generating unit, used for merging all the error messages to obtain an error message list;

[0053] A verification status extraction unit, used to extract the verification status of each verifier from the verification result;

[0054] A verification status list generating unit, used for merging all the verification statuses to obtain a verification status list;

[0055] The data verification result output unit is used to output the error message list and the verification status list as the data verification result.

[0056] The present invention also provides an electronic device, the device comprising a processor and a memory:

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

[0058] The processor is used to execute any of the above data verification methods according to the instructions in the program code.

[0059] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program code, and the program code is used to execute the data verification method as described in any one of the above items.

[0060] It can be seen from the above technical solutions that the present invention has the following advantages: The present invention provides a data verification method, and specifically discloses: receiving a data verification request; extracting the data object to be verified, context information and validator type from the data verification request; encapsulating the data object to be verified, context information and validator type to obtain encapsulated data; obtaining the validator chain and verification logic corresponding to the encapsulated data through the verification service class; using the validator chain to execute the verification logic on the encapsulated data to obtain the data verification result. The present invention obtains the validator to verify the data object to be verified through the verification service class. According to the difference of the objects to be verified, the corresponding validator can be directly obtained for verification without modifying the rules and redeploying them, thereby improving the verification efficiency. At the same time, since different validators can be obtained to form a validator chain for verification, it can adapt to different verification scenarios and improve the flexibility of verification. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0062] Figure 1 A flowchart of a data verification method provided by an embodiment of the present invention;

[0063] Figure 2 A flowchart of a data verification method provided by another embodiment of the present invention;

[0064] Figure 3 An architectural diagram of a data verification method provided by an embodiment of the present invention;

[0065] Figure 4 A structural block diagram of a data verification device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0066] The embodiments of the present invention provide a data verification method, device, electronic device and storage medium, which are used to solve the technical problems that existing data verification solutions have limited support scenarios, insufficient flexibility and low verification efficiency.

[0067] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below 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 creative work are within the scope of protection of the present invention.

[0068] See also Figure 1 , Figure 1 A flowchart of the steps of a data verification method provided by an embodiment of the present invention.

[0069] A data verification method provided by the present invention may specifically include the following steps:

[0070] Step 101, receiving a data verification request;

[0071] In the embodiment of the present invention, the data verification request may be in JSON format. Taking the data verification request as a user login request as an example, the format is as follows:

[0072]

[0073] Step 102, extracting the data object to be verified, verification context information and verifier type from the data verification request;

[0074] Step 103, encapsulate the data object to be verified, the verification context information and the verifier type to obtain encapsulated data;

[0075] In the embodiment of the present invention, after receiving the data verification request, the data object to be verified, the verification context information and the verifier type can be extracted from the data verification request, and then the obtained information is encapsulated to obtain encapsulated data.

[0076] In one example, data encapsulation may be performed through ValidationRequest.

[0077] Step 104, obtaining the validator chain and verification logic corresponding to the encapsulated data through the verification service class;

[0078] In the embodiment of the present invention, the validator chain and the verification logic corresponding to the encapsulated data can be obtained through the verification service class, so as to facilitate the subsequent data verification of the data to be verified.

[0079] In an example, the validation service class ValidationService is used to provide data validation service functions, such as validating a single data object, validating data objects in batches, etc. Finally, the validation result is converted into ValidationResult for output.

[0080] Step 105, using the validator chain to execute the verification logic on the encapsulated data to obtain the data verification result.

[0081] After the validator chain and verification logic are determined, different data can be verified by different validators according to the verification logic of each validator, thereby completing the verification of the entire data to be verified.

[0082] The present invention obtains a validator through a verification service class to verify the data object to be verified. According to the difference of the object to be verified, the corresponding validator can be directly obtained for verification without modifying the rules and redeploying them, thereby improving the verification efficiency. At the same time, since different validators can be obtained to form a validator chain for verification, it can adapt to different verification scenarios and improve the verification flexibility.

[0083] See also Figure 2 , Figure 2 A flowchart of a data verification method provided by another embodiment of the present invention. Specifically, the following steps may be included:

[0084] Step 201, receiving a data verification request;

[0085] Step 202, extracting the data object to be verified, verification context information and verifier type from the data verification request;

[0086] Step 203, encapsulate the data object to be verified, the verification context information and the verifier type to obtain encapsulated data;

[0087] Steps 201-203 are the same as steps 101-103. For details, please refer to the description of steps 101-103, which will not be repeated here.

[0088] Step 204, sending the validator type to the validator factory through the validation service class;

[0089] Step 205, receiving the validator returned by the validator factory in response to the validator type and the validation logic corresponding to each validator;

[0090] Step 206, obtaining the rule priority and dependency relationship between each validator;

[0091] Step 207, constructing a validator chain based on rule priorities and dependencies;

[0092] The validator factory ValidationFactory is used to manage all validator instances, provide a validator cache mechanism, manage the validator lifecycle, and support dynamic registration of new validators. The validator factory communicates with the validator through the validator interface Validator. The validator interface can connect to multiple validators at the same time to implement synchronous or asynchronous validation of the validator.

[0093] In an embodiment of the present invention, the ValidationService service can be called and informed of the validator type type that needs to be validated for data. The ValidationService service includes a validator factory. Through the validator type type, the corresponding validator chain can be obtained from the validator factory to perform data validation.

[0094] It should be noted that the verification logic corresponding to different business scenarios will be different. Taking the user login request as an example, the login-related validator chain obtained may include: username validator, password validator, verification code validator, IP address validator and other validators. The data verification can be completed by performing data verification in sequence through the validator chain. The validator will be created and cached when it is used for the first time or when the project is running. The next time it is used, it can be directly obtained from the cache without having to be recreated.

[0095] In order to ensure that the use of each validator does not interfere with each other, different rule priorities can be set for different validators, and each validator is arranged according to the rule priority to form a validator chain. The higher the rule priority, the higher the ranking.

[0096] In addition, there may be dependencies between the validator nodes in the validator chain. For example, if validator B depends on the processing result of validator A, then when creating the validator chain, a higher rule priority is given to validator A, and it is created before validator B. The execution of validator B needs to wait for validator A to complete its execution and return the result before executing, so as to resolve the dependency.

[0097] Step 208: Use the validator chain to execute the verification logic on the encapsulated data to obtain the data verification result.

[0098] After the validator chain and verification logic are determined, different data can be verified by different validators according to the verification logic of each validator, thereby completing the verification of the entire data to be verified.

[0099] In one example, the step of using a validator chain to execute validation logic on encapsulated data to obtain a data validation result may include the following sub-steps:

[0100] S81, determining each validator as the current validator in turn according to the order of each validator in the validator chain;

[0101] S82, judging whether the current verifier has a dependent verifier according to the dependency relationship;

[0102] S83, if it exists, determine whether the dependent validator has been executed;

[0103] S84, if the execution is completed, execute the verification logic corresponding to the current verifier, obtain the verification result of the current verifier, and save the verification result;

[0104] S85, determining whether all validators have been executed;

[0105] S86, if not, determine the next validator as the current validator, and return to the step of determining whether the current validator has a dependent validator according to the dependency relationship;

[0106] S87, if yes, merge all verification results to obtain the data verification result.

[0107] In the specific implementation, each validator can be determined as the current validator in turn, and then whether the current validator is executed immediately is determined based on the dependency relationship. When the dependent validator of the current validator is executed and outputs the result, the current validator is executed until all validators have completed the verification, indicating that the verification of the validator chain is completed. At this time, all verification results can be merged to obtain the data verification result.

[0108] In one example, S87 may include the following sub-steps:

[0109] S871, extracting an error message from the verification result;

[0110] S872, merging all error messages to obtain an error message list;

[0111] S873, extracting the verification status of each verifier from the verification result;

[0112] S874, merging all verification statuses to obtain a verification status list;

[0113] S875, output an error message list and a verification status list as data verification results.

[0114] In the specific implementation, each validator will return a verification result. The execution results of each validator are merged into a list, and then the results are merged using the following strategy:

[0115] Merge error messages: Merge the error messages returned by each validator into a unified list of error messages.

[0116] In the specific implementation, when the verification fails, a specific error message is usually returned, indicating which field or part of the data does not meet the requirements and the reason for the non-compliance. For example, "the user name must contain at least 3 characters", "the password does not meet the complexity requirements", etc.

[0117] In addition, some systems may return error codes, which are predefined and used to uniquely identify different types of validation errors. This helps developers or system administrators quickly locate problems.

[0118] Merge validation status: Merge the validation status (valid or invalid) of each validator into a final validation status.

[0119] The verification status may include:

[0120] Success: Indicates that the input data passes all validation rules and is legal and valid.

[0121] Failed: Indicates that the input data does not pass one or more validation rules and needs further processing or prompting the user to enter correct data.

[0122] Finally, all error message lists and validation status are output as data validation results.

[0123] Furthermore, the request parameters and the final verification results can be cached so that if there is a request with the same parameters in a short period of time, the result can be directly obtained from the cache for response, thereby improving efficiency.

[0124] The present invention obtains a validator through a verification service class to verify the data object to be verified. According to the difference of the object to be verified, the corresponding validator can be directly obtained for verification without modifying the rules and redeploying them, thereby improving the verification efficiency. At the same time, since different validators can be obtained to form a validator chain for verification, it can adapt to different verification scenarios and improve the verification flexibility.

[0125] For ease of understanding, the embodiments of the present invention are described below by using specific examples.

[0126] like Figure 3 As shown, Figure 3 The following is an architecture diagram of a data verification method provided by an embodiment of the present invention. It includes:

[0127] ValidationRequest: used for user request encapsulation, including the data object to be verified, verification context information, and supports the passing of additional parameters.

[0128] ValidationService: Validation service class, including validator factory, used to provide data validation service functions, such as validating a single data object, validating data objects in batches, etc., and finally converting the validation results into ValidationResult for output.

[0129] ValidatorFactory: validator factory; function: manage all validator instances, provide validator caching mechanism, be responsible for validator life cycle management, and support dynamic registration of new validators.

[0130] ValidationResult: validation result, stores the validation pass / fail status, all validation error information, supports result merging operations, and contains validation context information.

[0131] Validator: Validator interface. All validator implementations are based on this interface. It provides methods such as synchronous validation and asynchronous validation.

[0132] The verification process is:

[0133] 1. The client creates a ValidationRequest and sends it to the ValidationService;

[0134] 2. ValidationService obtains the corresponding validator through ValidatorFactory;

[0135] 3. The validator executes the validation logic and generates a ValidationResult;

[0136] 4. ValidationService returns the final validation result.

[0137] See also Figure 4 , Figure 4 A structural block diagram of a data verification device provided by an embodiment of the present invention.

[0138] An embodiment of the present invention provides a data verification device, including:

[0139] A data verification request receiving module 401 is used to receive a data verification request;

[0140] The data extraction module 402 is used to extract the data object to be verified, the verification context information and the verifier type from the data verification request;

[0141] The encapsulation module 403 is used to encapsulate the data object to be verified, the verification context information and the verifier type to obtain the encapsulated data;

[0142] The validator chain and verification logic acquisition module 404 is used to obtain the validator chain and verification logic corresponding to the encapsulated data through the verification service class;

[0143] The verification module 405 is used to use the validator chain to execute the verification logic on the encapsulated data to obtain the data verification result.

[0144] In the embodiment of the present invention, the validator chain and verification logic acquisition module 404 includes:

[0145] The validator type sending submodule is used to send the validator type to the validator factory through the validation service class;

[0146] The validator and verification logic receiving submodule is used to receive the validator and verification logic corresponding to each validator returned by the validator factory in response to the validator type;

[0147] The rule priority and dependency acquisition submodule is used to obtain the rule priority and dependency between each validator;

[0148] Validator chain building submodule, used to build the validator chain based on rule priorities and dependencies.

[0149] In the embodiment of the present invention, the verification module 405 includes:

[0150] The current validator determination submodule is used to determine each validator as the current validator in turn according to the order of each validator in the validator chain;

[0151] The dependency validator judgment submodule is used to judge whether the current validator has a dependency validator based on the dependency relationship;

[0152] The execution completion judgment submodule is used to judge whether the dependent validator has been executed, if it exists;

[0153] The verification result saving submodule is used to execute the verification logic corresponding to the current validator if the execution is completed, obtain the verification result of the current validator, and save the verification result;

[0154] The full execution judgment submodule is used to judge whether all validators have been executed;

[0155] Return submodule, used for determining the next validator as the current validator if no, and returning to the step of determining whether the current validator has a dependent validator according to the dependency relationship;

[0156] The merging submodule is used to merge all verification results to obtain the data verification result.

[0157] In an embodiment of the present invention, the merging submodule includes:

[0158] An error message extraction unit, used for extracting error messages from the verification result;

[0159] An error message list generating unit, used for merging all error messages to obtain an error message list;

[0160] A verification status extraction unit, used to extract the verification status of each verifier from the verification result;

[0161] A verification status list generating unit, used for merging all verification statuses to obtain a verification status list;

[0162] The data verification result output unit is used to output an error message list and a verification status list as the data verification result.

[0163] An embodiment of the present invention further provides an electronic device, the device comprising a processor and a memory:

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

[0165] The processor is used to execute the data verification method of the embodiment of the present invention according to the instructions in the program code.

[0166] The embodiment of the present invention further provides a computer-readable storage medium, which is used to store program codes, and the program codes are used to execute the data verification method of the embodiment of the present invention.

[0167] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0168] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

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

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

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

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

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

[0174] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0175] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A data verification method, characterized in that: include: receiving data verification requests; Extracting the data object to be verified, verification context information and verifier type from the data verification request; Encapsulate the data object to be verified, the verification context information and the verifier type to obtain encapsulated data; Obtain the validator chain and verification logic corresponding to the encapsulated data through the verification service class; The validator chain is used to execute the verification logic on the encapsulated data to obtain a data verification result.

2. The method according to claim 1, characterized in that: The step of obtaining the validator chain and verification logic corresponding to the encapsulated data through the verification service class includes: Send the validator type to the validator factory through the validation service class; Receive the validator returned by the validator factory in response to the validator type and the validation logic corresponding to each of the validators; Get the rule priority and dependency between validators; A validator chain is constructed based on the rule priorities and the dependencies.

3. The method according to claim 1, characterized in that The step of using the validator chain to execute the verification logic on the encapsulated data to obtain a data verification result includes: Determine each validator as the current validator in turn according to the order of the validators in the validator chain; Determine whether the current validator has a dependent validator according to the dependency relationship; If so, determining whether the dependency validator has been executed; If the execution is completed, the verification logic corresponding to the current verifier is executed to obtain the verification result of the current verifier, and the verification result is saved; Determine whether all the validators have been fully executed; If not, the next validator is determined as the current validator, and the process returns to the step of determining whether the current validator has a dependent validator according to the dependency relationship; If yes, combine all the verification results to obtain the data verification result.

4. The method according to claim 3, characterized in that The step of combining all the verification results to obtain a data verification result includes: extracting an error message from the verification result; Merge all the error messages to obtain an error message list; Extracting the verification status of each verifier from the verification result; Merging all the verification statuses to obtain a verification status list; The error message list and the verification status list are output as data verification results.

5. A data verification device, characterized in that: include: A data verification request receiving module, used for receiving a data verification request; A data extraction module, used to extract the data object to be verified, verification context information and verifier type from the data verification request; An encapsulation module, used to encapsulate the data object to be verified, the verification context information and the verifier type to obtain encapsulated data; A validator chain and verification logic acquisition module, used to obtain the validator chain and verification logic corresponding to the encapsulated data through the verification service class; A verification module is used to use the validator chain to execute the verification logic on the encapsulated data to obtain a data verification result.

6. The device according to claim 5, characterized in that The validator chain and verification logic acquisition module include: A validator type sending submodule, used for sending the validator type to the validator factory through the validation service class; A validator and verification logic receiving submodule, used to receive the validator returned by the validator factory in response to the validator type and the verification logic corresponding to each of the validators; The rule priority and dependency acquisition submodule is used to obtain the rule priority and dependency between each validator; The validator chain building submodule is used to build a validator chain based on the rule priority and the dependency relationship.

7. The device according to claim 5, characterized in that The verification module comprises: A current validator determination submodule, used to determine each validator as the current validator in turn according to the order of each validator in the validator chain; A dependent validator judgment submodule is used to judge whether the current validator has a dependent validator according to the dependency relationship; An execution completion judgment submodule, used to judge whether the dependency validator has been executed, if any; A verification result saving submodule is used to execute the verification logic corresponding to the current verifier if the execution is completed, obtain the verification result of the current verifier, and save the verification result; A full execution judgment submodule is used to judge whether all the validators have been fully executed; The return submodule is used to determine the next validator as the current validator if no, and return to the step of determining whether the current validator has a dependent validator according to the dependency relationship; The merging submodule is used to merge all the verification results to obtain a data verification result.

8. The device according to claim 7, characterized in that The merging submodule comprises: An error message extraction unit, used to extract an error message from the verification result; an error message list generating unit, used for merging all the error messages to obtain an error message list; A verification status extraction unit, used to extract the verification status of each verifier from the verification result; A verification status list generating unit, used for merging all the verification statuses to obtain a verification status list; The data verification result output unit is used to output the error message list and the verification status list as the data verification result.

9. An electronic device, characterized in that: The device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the data verification method described in any one of claims 1-4 according to the instructions in the program code.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program code, and the program code is used to execute the data verification method according to any one of claims 1 to 4.