Data validity verification method, device and system and storage medium

By combining general verification rules and custom verification rules to verify JSON data, the problem of poor JSON verification flexibility in the prior art is solved, and more flexible and accurate data validity verification is achieved.

CN119109609APending Publication Date: 2024-12-10SHANGHAI WEIWENJIA INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310675957.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-08
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

The existing JSON pattern library has a single function when verifying JSON objects, and cannot meet the diversity of JSON field values ​​or verification under different requirements, resulting in poor verification flexibility.

Method used

By receiving data verification requests, determine the data to be verified and the verification configuration information, and verify the validity of the data in combination with general verification rules and custom verification rules, including comparison verification, condition verification, association verification, Hierarchical relationship checksum format checksum, etc.

Benefits of technology

It improves the flexibility and accuracy of data validity verification, meets the verification requirements under different needs, and enhances the universality and reliability of verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119109609A_ABST
    Figure CN119109609A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of electronics, in particular to a data validity verification method, device and system and a storage medium, and the data validity verification method is applied to the data verification system. The method comprises the following steps: receiving a data verification request; based on the data verification request, determining to-be-verified data and verification configuration information; the verification configuration information comprises a general verification rule and a user-defined verification rule. According to the data validity verification method provided by the invention, the to-be-verified data and the verification configuration information are determined based on the data verification request, and the validity of the to-be-verified data is verified according to the general verification rule and the self-defined verification rule in the verification configuration information, so that the flexibility and the accuracy of validity verification of the to-be-verified data are improved; therefore, the universality of data verification operation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field, and in particular to a data validity verification method, device, system and storage medium. Background Art

[0002] In network communication or API interaction, JSON is one of the most commonly used data formats and is widely used for data transmission and exchange. Due to the difficulty in ensuring the authenticity and accuracy of data sources and the inconsistency of the expression and format of the same data from different sources, it is necessary to identify and judge the validity, integrity, accuracy, security and other characteristics of the data. Verifying JSON data can ensure that the sent and received data conforms to the expected structure and format, and avoid communication problems or parsing errors caused by incorrect data formats. Therefore, a method or technology is needed to realize the function of validating JSON data.

[0003] In order to solve the above problem, the solution adopted in the prior art is to use the existing JOSN pattern library to verify whether the JSON object complies with specific specifications.

[0004] However, the existing technology uses the existing JOSN model library to verify whether the JSON object conforms to specific specifications. The technical solution has a single function and cannot perform verification on the values ​​of JSON fields in a diversified or different manner, resulting in poor verification flexibility. Summary of the invention

[0005] In view of this, an object of the present invention is to provide a data validity verification method, device, system and storage medium to improve the flexibility of data validity verification.

[0006] In a first aspect, an embodiment of the present invention provides a data validity verification method, which is applied to a data verification system; the method comprises:

[0007] Receiving a data verification request;

[0008] Based on the data verification request, determine the data to be verified and the verification configuration information; the verification configuration information includes general verification rules and user-defined verification rules;

[0009] The validity of the data to be verified is verified by using the general verification rules and the user-defined verification rules to obtain the verification result corresponding to the data to be verified.

[0010] In combination with the first aspect, based on the data verification request, the step of determining the data to be verified and the verification configuration information includes:

[0011] Analyzing the parameters of the data verification request to obtain the data to be verified and the verification configuration file;

[0012] The verification configuration file is parsed to obtain verification configuration information.

[0013] In combination with the first aspect, the step of performing validity verification on the data to be verified by using the general verification rule and the custom verification rule includes:

[0014] Performing a correctness check on the general check rule, and if the check result is correct, loading the declared custom check method from the custom check rule;

[0015] The validity of the data to be verified is verified by using the general verification rules and the custom verification method.

[0016] In combination with the first aspect, the step of performing validity verification on the data to be verified by using the general verification rule and the custom verification method includes:

[0017] Each piece of data in the to-be-verified data is taken as the current data in turn, and the following steps are performed:

[0018] Performing a first validity check on the current data using the general verification rule;

[0019] If the first validity check succeeds, executing each custom verification method declared in the custom verification rule in sequence to perform a second validity check on the current data;

[0020] If the first validity check fails, the check result corresponding to the current data is recorded as invalid data, and the reason for the invalid data is recorded.

[0021] In combination with the first aspect, the custom verification method includes at least one of the following: a comparison verification method, a condition verification method, an association verification method, a hierarchical relationship verification method, and a format verification method.

[0022] In combination with the first aspect, the step of sequentially executing each custom verification method declared in the custom verification rule to perform a second validity check on the current data includes:

[0023] Execute the custom verification method in sequence to perform a second validity check on the value of the field corresponding to the current data;

[0024] If the second validity check succeeds, marking the current data as valid data;

[0025] If the second validity check fails, the check result corresponding to the current data is recorded as invalid data, and the reason for the invalid data is recorded.

[0026] In a second aspect, an embodiment of the present application provides a data validity verification device, which is applied to a data verification system; the device includes:

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

[0028] A determination module, used to determine the data to be verified and the verification configuration information based on the data verification request; the verification configuration information includes general verification rules and user-defined verification rules;

[0029] The verification module is used to perform validity verification on the data to be verified through the general verification rules and the user-defined verification rules to obtain the verification result corresponding to the data to be verified.

[0030] In a third aspect, an embodiment of the present application provides a data validity verification system, which is used to execute the above method.

[0031] In conjunction with the third aspect, the system includes an initiator, a parser, and a verification engine;

[0032] Wherein, the launcher is used to receive a data verification request and start the verification engine;

[0033] The parser is used to determine the data to be verified and the verification configuration information based on the data verification request; the verification configuration information includes general verification rules and user-defined verification rules;

[0034] The verification engine is used to perform validity verification on the data to be verified through the general verification rules and the user-defined verification rules to obtain a verification result corresponding to the data to be verified.

[0035] In a fourth aspect, an embodiment of the present application provides a storage medium, wherein the computer storage medium stores a computer program, and the computer program is executed by a processor to implement the above method.

[0036] The embodiments of the present invention bring the following beneficial effects: the present invention provides a data validity verification method, device, system and storage medium, wherein the data validity verification method is applied to a data verification system; the method comprises: receiving a data verification request; based on the data verification request, determining the data to be verified and the verification configuration information; the verification configuration information comprises general verification rules and custom verification rules; and through the general verification rules and the custom verification rules, performing validity verification on the data to be verified to obtain the verification result corresponding to the data to be verified.

[0037] The data validity verification method provided in the present application determines the data to be verified and the verification configuration information based on the data verification request, and verifies the validity of the data to be verified according to the general verification rules and custom verification rules in the verification configuration information, so as to improve the flexibility and accuracy of the validity verification of the data to be verified, thereby improving the versatility of the verification data operation.

[0038] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0039] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0041] Figure 1 A flow chart of a data verification method provided by an embodiment of the present invention;

[0042] Figure 2 A schematic diagram of the structure of a data verification device provided by an embodiment of the present invention;

[0043] Figure 3 A schematic diagram of the structure of a data verification system provided in an embodiment of the present invention.

[0044] Reference numerals:

[0045] 1- request receiving module, 2- determination module, 3- verification module, 4- launcher, 5- parser, 6- verification engine. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0047] In order to facilitate the understanding of this embodiment, the technical terms designed in this application are briefly introduced below.

[0048] A parser is a program, usually part of a compiler, that takes as input a sequence of source program instructions, interactive online commands, tokens, or some other defined interface, and breaks them into parts (such as nouns (objects), verbs (methods), and their attributes or options) that can then be controlled by other programming (such as other components in the compiler). A parser can also be used to check whether all the input provided is necessary.

[0049] Data validation can verify whether JSON data conforms to the expected structure and format to verify the integrity of the data, which is very important for ensuring the integrity of the data, especially when the data is used by multiple systems or applications. Validation can catch errors or omissions in the data, thereby avoiding problems in subsequent processing or analysis.

[0050] Data validation can also verify whether the values ​​in JSON data meet specific constraints or business rules to verify the accuracy of the data. For example, you can check whether the value is within a specified range, whether the date conforms to a specific format, or whether the string meets a specific pattern. Through validation, you can ensure the accuracy and consistency of the data and avoid potential errors or misunderstandings.

[0051] Data verification can also verify the security of JSON data. Malicious users may try to tamper with or inject malicious code into JSON data to bypass the system's security measures or cause security vulnerabilities. By verifying JSON data, potential malicious data can be detected and rejected, thereby improving the security of the system.

[0052] After introducing the technical terms involved in this application, the application scenarios and design concepts of the embodiments of this application are briefly introduced.

[0053] The existing technology uses the existing JOSN model library to verify whether the JSON object conforms to a specific specification. The technical solution has a single function and cannot perform verification on the value of the JSON field in a diversified or different demand manner, resulting in poor verification flexibility.

[0054] In order to solve the problems of the prior art, the embodiments of the present application provide a data validity verification method, device system and storage medium, which verify the data to be verified by the general verification rules and custom verification rules obtained after parsing the data verification request to improve the flexibility of data validity verification.

[0055] This embodiment provides a data validity verification method, which is applied to a data verification system; Figure 1As shown, the method comprises the following steps:

[0056] S110, receiving a data verification request.

[0057] S120, based on the data verification request, determine the data to be verified and the verification configuration information; the verification configuration information includes general verification rules and user-defined verification rules.

[0058] S130, performing validity verification on the data to be verified by using general verification rules and user-defined verification rules to obtain verification results corresponding to the data to be verified.

[0059] The data verification method provided in this embodiment determines the data to be verified and the verification configuration information based on the verification request. Afterwards, the validity of the data to be verified is verified through general verification rules and custom verification rules. The data to be verified can be verified in a targeted manner according to different verification requirements, thereby improving the reliability and accuracy of data verification.

[0060] Step S120 determines the data to be verified and the verification configuration information based on the data verification request, including:

[0061] Parse the parameters of the data verification request to obtain the data to be verified and the verification configuration file.

[0062] Parse the verification configuration file to obtain the verification configuration information.

[0063] In step S120, according to the data verification request, the verification data and the verification configuration file are parsed, and then the verification configuration file is parsed to obtain the verification configuration information.

[0064] Step S130, the step of performing validity verification on the verification data by using the general verification rules and the user-defined verification rules, includes:

[0065] S131, perform a correctness check on the general verification rules. If the check result is correct, load the declared custom verification method from the custom verification rules.

[0066] S132, performing validity verification on the data to be verified through general verification rules and custom verification methods.

[0067] In step S130, the verification configuration information of the data to be verified is first verified according to the general verification rules, and the verification content at least includes the writing format and the writing content. If the verification content is correct, it indicates that the verification result is correct. At this time, the declared custom verification method is loaded from the custom verification rules, and then the validity of the data to be verified is verified according to the general verification rules and the custom verification method.

[0068] Among them, the custom validation rules are user-defined data validation rules, for example:

[0069] The first custom rule is to compare and verify the value of the data field. In the custom rule, a field representing time is set, the value cannot be greater than the current time and the value of the field end must be greater than the value of start.

[0070] The second custom rule is to verify the association and hierarchical relationship of the data field values. For example, if there are two fields representing provinces and cities, the province is Province A and the city is City B, then City B should be a city under Province A.

[0071] The third custom rule is a conditional check on the value of a data field. For example, when the value of the field type is 1, it should be checked whether the length of the field name is greater than 4.

[0072] In step S130, the configuration information of the data to be verified is first verified by the general verification rules. If the verification result is incorrect, the verification result indicating that the data to be verified is invalid is returned, and a prompt message indicating that the configuration information is wrong is returned. At the same time, the continued verification operation of the verification data is terminated. In this way, the data verification operation is terminated when the data to be verified fails to meet the general verification rules, thereby reducing unnecessary labor, facilitating the rapid screening of non-compliant data to be verified, and improving data verification efficiency.

[0073] Step S132 performs validity verification on the verification data using general verification rules and custom verification methods, specifically including:

[0074] Take each piece of data to be verified as the current data in turn, and perform the following steps:

[0075] Perform a first validity check on the current data using a general verification rule;

[0076] If the first validity check succeeds, each custom validation method declared in the custom validation rule is executed in turn to perform a second validity check on the current data;

[0077] If the first validity check fails, the check result corresponding to the current data is recorded as invalid data, and the reason for the invalid data is recorded.

[0078] In step S132, for each piece of data, the data is taken as the current data, and a first validity check is performed on the current data according to the general verification rules. After the first validity check is successful, a second validity check is performed on the current data according to the custom verification method, and the final data verification result is determined according to the first validity check result and the second validity check result. Specifically, the current data verification is successful only when both the first validity check result and the second validity check result are successful. At this time, the current data is marked as valid data; if the first validity verification fails or any of the second validity check results in the second validity verification method fails, then the current data is invalid, and the invalid reason is recorded, that is, which specific verification rule is not met.

[0079] Specifically, the general validation rules are used to validate data types, formats, and enumerations; the custom validation methods are user-defined, for example, the custom validation methods are used to validate the association relationship of data values, validate conditions, and the like.

[0080] In step S132, if each current data in the data to be verified is verified successfully, the data to be verified is marked as valid data, and prompt information indicating that the data is valid data is returned.

[0081] In combination with the first aspect, the custom verification method includes at least one of the following: a comparison verification method, a condition verification method, an association verification method, a hierarchical relationship verification method, and a format verification method.

[0082] In step S132, each custom verification method declared in the custom verification rule is executed in sequence to perform a second validity check on the current data, including:

[0083] Execute the custom verification method in sequence to perform a second validity check on the value of the field corresponding to the current data;

[0084] If the second validity check succeeds, marking the current data as valid data;

[0085] If the second validity check fails, the check result corresponding to the current data is recorded as invalid data, and the reason for the invalid data is recorded.

[0086] For example, the first custom verification method is the verify_by_pattern method, which is used to perform format verification on the current data. The verification method is specifically to split the value of the field of the current data by commas to obtain a series of values, and each split value should satisfy the preset expression.

[0087] The second custom verification method is the verify_compare method, which is used to perform the following verifications on the current data: the value of the publish_date field should be less than the current time expressed in the yyyy-MM-dd format, the value of the valFrom field should be less than or equal to the value of valTo, the value of the appScoreV2 field should be equal to the value of the appScore field multiplied by 5 and rounded to 2 digits, the length of the appRelated field value should be equal to the length of the appPackageNameRelated field value, and the value of the relaese_date field should be greater than or equal to the constant 946656000000.

[0088] The above is only an example and does not limit the custom verification method. The custom verification method can be a data verification method customized by the user according to different application scenarios and requirements, which will not be elaborated here.

[0089] In the second aspect, this embodiment provides a data validity verification device, which is applied to a data verification system; Figure 2 As shown, the device includes: a request receiving module 1, a determination module 2 and a verification module 3.

[0090] Request receiving module 1, used for receiving data verification request;

[0091] Determination module 2, used to determine the data to be verified and the verification configuration information based on the data verification request; the verification configuration information includes general verification rules and custom verification rules;

[0092] The verification module 3 is used to perform validity verification on the data to be verified through general verification rules and user-defined verification rules to obtain the verification result corresponding to the data to be verified.

[0093] In a third aspect, this embodiment provides a data verification system for executing the above method to achieve data verification.

[0094] In conjunction with the third aspect, the system includes an initiator 4, a parser 5 and a verification engine 6 (such as Figure 3 shown).

[0095] The initiator 4 is used to receive a data verification request and start the verification engine 6 .

[0096] The parser 5 is used to determine the data to be verified and the verification configuration information based on the data verification request; the verification configuration information includes general verification rules and user-defined verification rules.

[0097] The verification engine 6 is used to perform validity verification on the data to be verified through general verification rules and user-defined verification rules, and obtain the verification result corresponding to the data to be verified.

[0098] In a fourth aspect, this embodiment provides a storage medium, wherein the computer storage medium stores a computer program, and the computer program is executed by a processor to implement the data verification method as described above.

[0099] The computer-readable storage medium storing program code provided in the embodiment of the present invention may include instructions that can be used to execute the methods described in the foregoing method embodiments. For specific implementation, please refer to the method embodiments, which will not be described in detail here.

[0100] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0101] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0102] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a starter, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0103] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0104] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A data validity verification method, It is characterized in that Applied to a data verification system; the method comprises: Receiving a data verification request; Based on the data verification request, determine the data to be verified and the verification configuration information; the verification configuration information includes general verification rules and user-defined verification rules; The validity of the data to be verified is verified by using the general verification rules and the user-defined verification rules to obtain the verification result corresponding to the data to be verified.

2. The method according to claim 1, It is characterized in that Based on the data verification request, the step of determining the data to be verified and the verification configuration information includes: Parsing parameters of the data verification request to obtain the data to be verified and the verification configuration file; The verification configuration file is parsed to obtain verification configuration information.

3. The method according to claim 1, It is characterized in that The step of performing validity verification on the data to be verified by using the general verification rule and the custom verification rule comprises: Performing a correctness check on the general check rule, and if the check result is correct, loading the declared custom check method from the custom check rule; The validity of the data to be verified is verified by using the general verification rules and the custom verification method.

4. The method according to claim 3, It is characterized in that The step of performing validity verification on the data to be verified by using the general verification rule and the custom verification method includes: Each piece of data in the to-be-verified data is taken as the current data in turn, and the following steps are performed: Performing a first validity check on the current data using the general verification rule; If the first validity check succeeds, executing each custom verification method declared in the custom verification rule in sequence to perform a second validity check on the current data; If the first validity check fails, the check result corresponding to the current data is recorded as invalid data, and the reason for the invalid data is recorded.

5. The method according to claim 3, It is characterized in that The custom verification method includes at least one of the following: a comparison verification method, a condition verification method, an association verification method, a hierarchical relationship verification method, and a format verification method.

6. The method according to claim 4, It is characterized in that The step of sequentially executing each custom verification method declared in the custom verification rule to perform a second validity check on the current data includes: Execute the custom verification method in sequence to perform a second validity check on the value of the field corresponding to the current data; If the second validity check succeeds, marking the current data as valid data; If the second validity check fails, the check result corresponding to the current data is recorded as invalid data, and the reason for the invalid data is recorded.

7. A data validity verification device, It is characterized in that Applicable to a data verification system; the device comprises: A request receiving module, used for receiving a data verification request; A determination module, used to determine the data to be verified and the verification configuration information based on the data verification request; the verification configuration information includes general verification rules and user-defined verification rules; The verification module is used to perform validity verification on the data to be verified through the general verification rules and the user-defined verification rules to obtain the verification result corresponding to the data to be verified.

8. A data validity verification system, It is characterized in that The system is used to execute the method according to any one of claims 1 to 6.

9. The system according to claim 8, It is characterized in that The system includes an initiator, a parser and a verification engine; wherein, The launcher is used to receive a data verification request and start the verification engine; The parser is used to determine the data to be verified and the verification configuration information based on the data verification request; the verification configuration information includes general verification rules and user-defined verification rules; The verification engine is used to perform validity verification on the data to be verified through the general verification rules and the user-defined verification rules to obtain a verification result corresponding to the data to be verified.

10. A storage medium, It is characterized in that The storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 6.