Summary of the invention
The application's technical matters to be solved is to provide a kind of data checking and device, in order to solve in prior art in the detection to the json data, not only need manually traversal to check, and larger for the inspection difficulty of any degree of depth key, make the lower technical matters of efficiency of data check.
The application also provides a kind of data checking, comprising:
Obtain the test data dictionary corresponding with test data and masterplate dictionary, described masterplate dictionary comprises the masterplate key;
According to described masterplate key, in the mode of recurrence, check each object key in described test data dictionary successively, obtain check result information.
Said method, preferred, the described masterplate key of described foundation, check each object key in described test data dictionary in the mode of recurrence successively, obtains check result information, comprising:
Travel through in described test data dictionary and whether include corresponding with each masterplate key in described masterplate dictionary respectively object key, if, in the mode of recurrence, check each the described object key in described test data dictionary successively, obtain check result information, otherwise, generate the check result information of disappearance key and in the mode of recurrence, check each the described object key in described test dictionary successively, obtaining check result information;
Wherein, the check result information of described disappearance key comprises the identification information of the object key that lacks in described test data dictionary.
Said method, preferred, describedly in the mode of recurrence, check each the described object key in described test data dictionary successively, obtain check result information, comprising:
Using each object key in described test data dictionary as the current goal key;
Determine the type of described current goal key;
If the type of described current goal key is dictionary type or list type, the type that the judges described current goal key whether type of the masterplate key corresponding with it is consistent, if, determine in described current goal key whether to include corresponding with each submodule version key in its corresponding masterplate key respectively sub-goal key, otherwise, generate and show the inconsistent check result information of described current goal key type;
If in described current goal key, include corresponding with each submodule version key in its corresponding masterplate key respectively sub-goal key, using each the sub-goal key in described current goal key as the current goal key, return and carry out the described type of determining described current goal key, otherwise, generation includes the check result information of the identification information of the sub-goal key that lacks in described current goal key, and, using each the sub-goal key in described current goal key as the current goal key, return and carry out the described type of determining described current goal key;
If the type of described current goal key is the type except dictionary type and list type, the type that the judges the current goal key whether type of the masterplate key corresponding with it is consistent, if, generation shows the check result information of described current goal bonding method, otherwise, generate and show the inconsistent check result information of described current goal key type.
Said method, preferred, describedly in the mode of recurrence, check each the described object key in described test data dictionary successively, obtain check result information, comprising:
Using each object key in described test data dictionary as the current goal key;
The type that the judges described current goal key whether type of the masterplate key corresponding with it is consistent, if so, determines the type of described current goal key, otherwise, generate and show the inconsistent check result information of described current goal key type;
if the type of described current goal key is dictionary type or list type, determine in described current goal key whether to include corresponding with each submodule version key in its corresponding masterplate key respectively sub-goal key, if, using each the sub-goal key in described current goal key as the current goal key, return and carry out the described type that judges described current goal key the type of the masterplate key corresponding with it is consistent, otherwise, generation includes the check result information of the identification information of the sub-goal key that lacks in described current goal key, and using each the sub-goal key in described current goal key as the current goal key, return and carry out the described type that judges described current goal key the type of the masterplate key corresponding with it is consistent,
If the type of described current goal key is the type except dictionary type and list type, generate the check result information that shows described current goal bonding method.
The application also provides a kind of data detecting device, comprising:
The dictionary acquiring unit, be used to obtaining the test data dictionary corresponding with test data and masterplate dictionary, described masterplate dictionary comprises the masterplate key;
The recurrence inspection unit, for according to described masterplate key, check each object key in described test data dictionary in the mode of recurrence successively, obtains check result information.
Said apparatus, preferred, described recurrence inspection unit comprises:
Masterplate traversal subelement, for traveling through described test data dictionary, whether include corresponding with each masterplate key in described masterplate dictionary respectively object key, if so, trigger recurrence examination subelement, otherwise, trigger the first information and generate subelement and recurrence examination subelement;
Recurrence examination subelement, in the mode of recurrence, checking each described object key of described test data dictionary successively, obtain check result information;
The first information generates subelement, be used to generating the check result information of disappearance key;
Wherein, the check result information of described disappearance key comprises the identification information of the object key that lacks in described test data dictionary.
Said apparatus, preferred, described recurrence examination subelement comprises:
The first object determination module, for each object key using described test data dictionary as the current goal key;
First kind determination module, for determining the type of described current goal key, if the type of described current goal key is dictionary type or list type, trigger first kind comparing module, otherwise, trigger the Second Type comparing module;
First kind comparing module, the type of the masterplate key corresponding with it is consistent be used to the type that judges described current goal key, if so, triggers the first submodule version spider module, otherwise, trigger the second information generating module;
The first submodule version spider module, for determining whether described current goal key includes corresponding with each submodule version key in its corresponding masterplate key respectively sub-goal key, if in described current goal key, include corresponding with each submodule version key in its corresponding masterplate key respectively sub-goal key, using each the sub-goal key in described current goal key as the current goal key, trigger described first kind determination module, otherwise, trigger the 3rd information generating module and described first kind determination module;
The second information generating module, show the inconsistent check result information of described current goal key type for generation;
The 3rd information generating module, include the check result information of the identification information of the sub-goal key that described current goal key lacks for generation;
The Second Type comparing module, the type of the masterplate key corresponding with it is consistent be used to the type that judges the current goal key, if so, triggers the 4th information generating module, otherwise, trigger described the second information generating module.
The 4th information generating module, show the check result information of described current goal bonding method for generation.
Said apparatus, preferred, described recurrence examination subelement comprises:
The second target determination module, for each object key using described test data dictionary as the current goal key;
The 3rd type comparing module, the type of the masterplate key corresponding with it is consistent be used to the type that judges described current goal key, if so, triggers the Second Type determination module, otherwise, trigger the 5th information generating module;
The Second Type determination module, for determining the type of described current goal key, if the type of described current goal key is dictionary type or list type, trigger the second submodule version spider module, otherwise, trigger the 6th information generating module;
The 5th information generating module, show the inconsistent check result information of described current goal key type for generation;
The second submodule version spider module, for determining whether described current goal key includes corresponding with each submodule version key in its corresponding masterplate key respectively sub-goal key, if, using each the sub-goal key in described current goal key as the current goal key, trigger described the 3rd type comparing module, otherwise, the 7th information generating module triggered, and, using each the sub-goal key in described current goal key as the current goal key, trigger described the 3rd type comparing module;
The 6th information generating module, show the check result information of described current goal bonding method for generation;
The 7th information generating module, include the check result information of the identification information of the sub-goal key that described current goal key lacks for generation.
As can be known by such scheme, a kind of data checking and device that the application provides, by obtaining the test data dictionary corresponding with testing the json data and comprising the masterplate dictionary of the necessary masterplate key of test data dictionary, again according to described masterplate key, in the mode of recurrence, check each object key in described test data dictionary successively, thereby obtain check result information.With respect in prior art, manually to each key in the test data dictionary, traveling through the scheme of inspection, the application is by obtaining respectively corresponding test data dictionary and the masterplate dictionary of test json data, again the key in two kinds of dictionaries is traveled through to inspection, obtain the check result of test data dictionary as check result information, without manual examination (check), thereby improved the efficiency of data check.Further, the application carries out the recurrence inspection by the key to having any degree of depth, without manual key to different depth, carries out data check, has further saved the time that manual type is judged and compared, thereby has more improved the efficiency of data check.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment is only the application's part embodiment, rather than whole embodiment.Based on the embodiment in the application, those of ordinary skills are not making under the creative work prerequisite the every other embodiment that obtains, and all belong to the scope of the application's protection.
With reference to figure 1, the process flow diagram of a kind of data checking embodiment mono-that provides for the application, described method can following steps:
Step 101: obtain the test data dictionary corresponding with test data and masterplate dictionary, described masterplate dictionary comprises the masterplate key.
It should be noted that, described test data is the test json data of examine.
While wherein, in described step 101, obtaining the test data dictionary, can realize in the following manner:
Test json data are obtained, described test json data are carried out to Data Format Transform, obtain the test data dictionary of python form, in this application described test data dictionary is obtained.
Wherein, the partial code of described test json data is as shown below:
it should be noted that, in described test data dictionary, may comprise a plurality of as numerical value type key, character string type key, list type key, the object key (target key) such as dictionary type key or Boolean type key, and in dictionary type key, may comprise a plurality of as numerical value type key, character string type key, list type key, the sub-goal keys such as dictionary type key or Boolean type key, list type key may comprise a plurality of as numerical value type key, character string type key, the sub-goal keys such as list type key or Boolean type key, by that analogy, level between key value in described test data dictionary can represent with the tree structure in Fig. 2, be convenient to understand.
Wherein, the masterplate dictionary that obtains in described step 101 can be the dictionary of python form, include necessary masterplate key (masterplate key) in the test data dictionary, each described masterplate key can for value type key, character string type key, list type key, dictionary type key and Boolean type key etc. any one, each masterplate key also may comprise value type key, character string type key, list type key, dictionary type key and Boolean type key etc., by that analogy.Wherein, the partial code of described masterplate dictionary is as shown below:
It should be noted that, whether the embodiment of the present application in carrying out described test data dictionary during target key validity checking, namely unanimously checks the type of the value of key.
Step 102: according to described masterplate key, check each object key in described test data dictionary in the mode of recurrence successively, obtain check result information.
Wherein, described step 102 can realize in the following manner:
Each described masterplate key in described masterplate dictionary and each the described target key in described test data dictionary are compared one by one, wherein, comprise that the key to containing sublayer key carries out the recurrence contrast, thereby obtain comparison information as check result information, wherein, described check result information may comprise in the key information that may lack in described test data dictionary, described test data dictionary in each key the multiple sign key such as sub-key information, key Type-Inconsistencies information and the key type of lacking be consistent legal information whether.
As can be known by such scheme, a kind of data checking embodiment mono-that the application provides, by obtaining the test data dictionary corresponding with testing the json data and comprising the masterplate dictionary of the necessary masterplate key of test data dictionary, again according to described masterplate key, in the mode of recurrence, check each the target key in described test data dictionary successively, thereby obtain check result information.With respect in prior art, manually to each key in the test data dictionary, traveling through the scheme of inspection, the application is by obtaining respectively corresponding test data dictionary and the masterplate dictionary of test json data, again the key in two kinds of dictionaries is traveled through to inspection, obtain the check result of test data dictionary as check result information, without manual examination (check), thereby improved the efficiency of data check.Further, the application carries out the recurrence inspection by the key to having any degree of depth, without manual key to different depth, carries out data check, has further saved the time that manual type is judged and compared, thereby has more improved the efficiency of data check.
With reference to figure 3, the process flow diagram of step 102 described in a kind of data checking embodiment bis-that provides for the application, described step 102 can comprise the following steps:
Step 301: travel through in described test data dictionary and whether include corresponding with each masterplate key in described masterplate dictionary respectively object key, if so, carry out described step 302, otherwise, execution step 303 and described step 302.
Wherein, in described step 301, refer to, at first masterplate key in each described masterplate dictionary is traveled through, whether inspection comprises corresponding with each masterplate key respectively target key in described test data dictionary, while in described test data dictionary, comprising corresponding with each masterplate key respectively target key, trigger and carry out described step 302, while in described test data dictionary, lacking the key corresponding with some masterplate key, trigger simultaneously described step 302 and described step 303.
Step 302: check each described object key in described test data dictionary in the mode of recurrence successively, obtain check result information.
Wherein, in described step 301, no matter in described test data dictionary, whether include corresponding with each masterplate key in described masterplate dictionary respectively target key, described step 302 all can be triggered.
It should be noted that, by as can be known in preamble, each described target key may be the key of any degree of depth, therefore, in described step 302, adopts the method for recurrence inspection to carry out data check to each target key.
Step 303: the check result information that generates the disappearance key.
Wherein, the check result information of described disappearance key comprises the identification information of the object key that lacks in described test data dictionary.
It should be noted that, described step 301 to described step 303 can be understood as: check in the masterplate dictionary, whether all masterplate key all exist in the target key of described test data dictionary, if lack necessary target key, generate so the check result information of disappearance key, and can comprise in the check result information of described disappearance key: the identification information of the target key that lacks in described test data dictionary, the identification information of described target key, except can comprising this target key self value, can also comprise the routing information of this target key.
With reference to figure 4, the process flow diagram of step 302 described in a kind of data checking embodiment tri-that provides for the application, described step 302 can comprise the following steps:
Step 401: using each object key in described test data dictionary as the current goal key.
It should be noted that the data check of subsequent step for the some target key in described test data dictionary are carried out as current goal key in the embodiment of the present application.Legitimacy for each target key in described test data dictionary all can adopt the method in the embodiment of the present application to check, be: the embodiment of the present application has generality, can apply the data validity checking to each target key in described test data dictionary.
Step 402: determine the type of described current goal key, if the type of described current goal key is dictionary type or list type, execution step 403, otherwise, execution step 407.
Wherein, the type of described current goal key can be dictionary type, list type, value type, character string type or Boolean type etc.if the type of described current goal key is the dictionary type, so described current goal key can comprise the dictionary type, list type, value type, the sub-key of character string type or Boolean type etc., if the type of described current goal key is list type, so described current goal key can comprise list type, value type, the sub-key of character string type or Boolean type etc., therefore, for the target key that may have different depth, at first determine its type, again for its type, carry out the data check of different modes, therefore, when the type of described current goal key is dictionary type or list type, carry out described step 403, carry out the data check of recursive fashion, type at described current goal key is value type, when character string type or Boolean type etc., execution step 407, carry out the data check of basic mode.
Step 403: the type that the judges described current goal key whether type of the masterplate key corresponding with it is consistent, if so, and execution step 404, otherwise, execution step 405.
Wherein, the type of determining described current goal key in described step 402 is after dictionary type or list type, at first the consistance of the type of the type of this current target key masterplate key corresponding with it is judged, when consistent, execution step 404, carry out the recurrence inspection of the sub-key of subordinate of this current target key, otherwise, perform step 405, generate the check result information of the Type-Inconsistencies of this current target key, finish the data validity checking of this current target key.
It should be noted that, in the embodiment of the present application, in described step 403, current goal key can be the ground floor target key of described test data dictionary, also can be the sub-key of subordinate of ground floor target key, also can be the sub-key of subordinate of the sub-key of this subordinate, therefore, in the data validity checking of above-mentioned mentioned this current target key of end, key that this current target key refers to may be ground floor target key or the second straton key or other sub-key, but not refers in particular to the ground floor target key under the test data dictionary of some appointments.
Step 404: determine in described current goal key whether to include corresponding with each submodule version key in its corresponding masterplate key respectively sub-goal key, if in described current goal key, include corresponding with each submodule version key in its corresponding masterplate key respectively sub-goal key, using each the sub-goal key in described current goal key as the current goal key, return and carry out described step 402, otherwise, execution step 406, and, using each the sub-goal key in described current goal key as the current goal key, return and carry out described step 402.
It should be noted that, described step 404 is for the recurrence checking process to target key with any degree of depth, namely by returning to described step 402, the sub-goal key of the current goal key of dictionary type or list type traveled through and the recurrence inspection.
Step 405: generate and show the inconsistent check result information of described current goal key type.
It should be noted that, in the embodiment of the present application, in described step 405, current goal key can be the ground floor target key of described test data dictionary, also can be the sub-key of subordinate of ground floor target key, also can be the sub-key of subordinate of the sub-key of this subordinate, that is to say, the current goal key that key refers to that mentions in described step 405 may be ground floor target key or the second straton key or other sub-key, but not refers in particular to the ground floor target key under the test data dictionary of some appointments.
Step 406: the check result information that generates the identification information that includes the sub-goal key that lacks in described current goal key.
Step 407: the type that the judges the current goal key whether type of the masterplate key corresponding with it is consistent, if so, and execution step 408, otherwise, carry out described step 405.
Step 408: generate the check result information that shows described current goal bonding method.
wherein, the type that determines described current goal key in described step 402 is the type except dictionary type and list type, at this moment, described current goal key does not have the sub-key of any degree of depth, therefore, directly carry out the consistance of the type of the type of the described current goal key of judgement in the described step 407 masterplate key corresponding with it, and then when the type of the type of described current goal key and its corresponding masterplate key is consistent, execution step 408 generates and shows the check result information that described current goal key is legal, when the Type-Inconsistencies of the type of the described current goal key masterplate key corresponding with it, execution step 405 generates the check result information that shows described current goal key Type-Inconsistencies.
A kind of implementation of above-mentioned the embodiment of the present application three in the application, the recursive data of target key with any degree of depth being checked.
In actual applications, the application also has another kind of implementation, with reference to figure 5, and the process flow diagram of step 302 described in a kind of data checking embodiment tetra-that provides for the application, described step 302 can comprise the following steps:
Step 501: using each object key in described test data dictionary as the current goal key.
It should be noted that the data check of subsequent step for the some target key in described test data dictionary are carried out as current goal key in the embodiment of the present application.Legitimacy for each target key in described test data dictionary all can adopt the method in the embodiment of the present application to check, be: the embodiment of the present application has generality, can apply the data validity checking to each target key in described test data dictionary.
Step 502: the type that the judges described current goal key whether type of the masterplate key corresponding with it is consistent, if so, and execution step 503, otherwise, execution step 504.
Wherein, in described step 502, at first judge whether current goal key type is consistent with its corresponding masterplate key, if, according to the type of this current target key, carry out the data check of different modes, as the target key to having any degree of depth such as dictionary type or classification type etc., carry out the data check of recursive fashion, the target key that does not have any degree of depth such as numerical value type or character string type etc. is carried out to the data check of basic mode.
Step 503: determine the type of described current goal key, if the type of described current goal key is dictionary type or list type, execution step 505, otherwise, execution step 506.
Step 504: generate and show the inconsistent check result information of described current goal key type.
It should be noted that, in the embodiment of the present application, in described step 504, current goal key can be the ground floor target key of described test data dictionary, also can be the sub-key of subordinate of ground floor target key, also can be the sub-key of subordinate of the sub-key of this subordinate, that is to say, the current goal key that key refers to that mentions in described step 504 may be ground floor target key or the second straton key or other sub-key, but not refers in particular to the ground floor target key under the test data dictionary of some appointments.
Step 505: determine in described current goal key whether to include corresponding with each submodule version key in its corresponding masterplate key respectively sub-goal key, if, using each the sub-goal key in described current goal key as the current goal key, return and carry out described step 502, otherwise, execution step 507, and, using each the sub-goal key in described current goal key as the current goal key, return and carry out described step 502.
Wherein, the type of described current goal key can be dictionary type, list type, value type, character string type or Boolean type etc.if the type of described current goal key is the dictionary type, so described current goal key can comprise the dictionary type, list type, value type, the sub-key of character string type or Boolean type etc., if the type of described current goal key is list type, so described current goal key can comprise list type, value type, the sub-key of character string type or Boolean type etc., therefore, for the target key that may have different depth, at first determine its type, again for its type, carry out the data check of different modes, therefore, when the type of described current goal key is dictionary type or list type, carry out described step 505, carry out the data check of recursive fashion, type at described current goal key is value type, when character string type or Boolean type etc., execution step 506.
It should be noted that, described step 505 is for the recurrence checking process to target key with any degree of depth, namely by returning to described step 502, the sub-goal key of the current goal key of dictionary type or list type traveled through and the recurrence inspection.
Step 506: generate the check result information that shows described current goal bonding method.
Wherein, described step 506 is the type except dictionary type and list type for the type that determines described current goal key in described step 503, at this moment, described current goal key does not have the sub-key of any degree of depth, therefore, directly carry out described step 506 generation and show the check result information that described current goal key is legal.
Step 507: the check result information that generates the identification information that includes the sub-goal key that lacks in described current goal key.
Above-mentioned implementation is in the execution sequence difference of each step, but similar on its specific implementation separately, at this, is not described in detail.
With reference to figure 6, the structural representation of a kind of data detecting device embodiment five that provides for the application, described device can comprise:
Dictionary acquiring unit 601, be used to obtaining the test data dictionary corresponding with test data and masterplate dictionary, described masterplate dictionary comprises masterplate key.
It should be noted that, described test data is the test json data of examine.
Wherein, described dictionary acquiring unit 601 can be realized in the following manner when obtaining the test data dictionary:
Test json data are obtained, described test json data are carried out to Data Format Transform, obtain the test data dictionary of python form, in this application described test data dictionary is obtained.
it should be noted that, in described test data dictionary, may comprise a plurality of as numerical value type key, character string type key, list type key, the object key (target key) such as dictionary type key or Boolean type key, and in dictionary type key, may comprise a plurality of as numerical value type key, character string type key, list type key, the sub-goal keys such as dictionary type key or Boolean type key, list type key may comprise a plurality of as numerical value type key, character string type key, the sub-goal keys such as list type key or Boolean type key, by that analogy, level between key value in described test data dictionary can represent with the tree structure in Fig. 2, be convenient to understand.
Wherein, the masterplate dictionary that obtains in described dictionary acquiring unit 601 can be the dictionary of python form, include necessary masterplate key (masterplate key) in the test data dictionary, each described masterplate key can for value type key, character string type key, list type key, dictionary type key and Boolean type key etc. any one, each masterplate key also may comprise value type key, character string type key, list type key, dictionary type key and Boolean type key etc., by that analogy.
It should be noted that, whether the embodiment of the present application in carrying out described test data dictionary during target key validity checking, namely unanimously checks the type of the value of key.
Recurrence inspection unit 602, for according to described masterplate key, check each object key in described test data dictionary in the mode of recurrence successively, obtains check result information.
Wherein, described recurrence inspection unit 602 can realize in the following manner:
Each described masterplate key in described masterplate dictionary and each the described target key in described test data dictionary are compared one by one, wherein, comprise that the key to containing sublayer key carries out the recurrence contrast, thereby obtain comparison information as check result information, wherein, described check result information may comprise in the key information that may lack in described test data dictionary, described test data dictionary in each key the multiple sign key such as sub-key information, key Type-Inconsistencies information and the key type of lacking be consistent legal information whether.
As can be known by such scheme, a kind of data detecting device embodiment five that the application provides, by obtaining the test data dictionary corresponding with testing the json data and comprising the masterplate dictionary of the necessary masterplate key of test data dictionary, again according to described masterplate key, in the mode of recurrence, check each the target key in described test data dictionary successively, thereby obtain check result information.With respect in prior art, manually to each key in the test data dictionary, traveling through the scheme of inspection, the application is by obtaining respectively corresponding test data dictionary and the masterplate dictionary of test json data, again the key in two kinds of dictionaries is traveled through to inspection, obtain the check result of test data dictionary as check result information, without manual examination (check), thereby improved the efficiency of data check.Further, the application carries out the recurrence inspection by the key to having any degree of depth, without manual key to different depth, carries out data check, has further saved the time that manual type is judged and compared, thereby has more improved the efficiency of data check.
With reference to figure 7, the structural representation of the examination of recurrence described in a kind of data detecting device embodiment six that provides for the application single 602, wherein, described recurrence inspection unit 602 can comprise:
Masterplate traversal subelement 621, for traveling through described test data dictionary, whether include corresponding with each masterplate key in described masterplate dictionary respectively object key, if so, trigger recurrence examination subelement 622, otherwise, trigger the first information and generate subelement 623 and recurrence examination subelement 622.
Wherein, in described masterplate traversal subelement 621, refer to, at first masterplate key in each described masterplate dictionary is traveled through, whether inspection comprises corresponding with each masterplate key respectively target key in described test data dictionary, while in described test data dictionary, comprising corresponding with each masterplate key respectively target key, trigger described recurrence examination subelement 622, while in described test data dictionary, lacking the key corresponding with some masterplate key, trigger simultaneously described recurrence examination subelement 622 and the described first information and generate subelement 623.
Recurrence examination subelement 622, in the mode of recurrence, checking each described object key of described test data dictionary successively, obtain check result information.
Wherein, in described masterplate traversal subelement 621, no matter in described test data dictionary, whether include corresponding with each masterplate key in described masterplate dictionary respectively target key, described recurrence examination subelement 622 all can be triggered.
It should be noted that, by as can be known in preamble, each described target key may be the key of any degree of depth, therefore, in described recurrence examination subelement 622, adopts the method for recurrence inspection to carry out data check to each target key.
The first information generates subelement 623, be used to generating the check result information of disappearance key.
Wherein, the check result information of described disappearance key comprises the identification information of the object key that lacks in described test data dictionary.
it should be noted that, described masterplate traversal subelement 621, described recurrence examination subelement 622 and the described first information generate the functional description of subelement 623, can be understood as: check in the masterplate dictionary, whether all masterplate key all exist in the target key of described test data dictionary, if lack necessary target key, generate so the check result information of disappearance key, and can comprise in the check result information of described disappearance key: the identification information of the target key that lacks in described test data dictionary, the identification information of described target key is except can comprising this target key self value, the routing information that can also comprise this target key.
With reference to figure 8, the structural representation of the examination of recurrence described in a kind of data detecting device embodiment seven that provides for the application subelement 622, wherein, described recurrence examination subelement 622 comprises:
First object determination module 801, for each object key using described test data dictionary as the current goal key.
It should be noted that the data check of subsequent step for the some target key in described test data dictionary are carried out as current goal key in the embodiment of the present application.Legitimacy for each target key in described test data dictionary all can adopt the method in the embodiment of the present application to check, be: the embodiment of the present application has generality, can apply the data validity checking to each target key in described test data dictionary.
First kind determination module 802, for determining the type of described current goal key, if the type of described current goal key is dictionary type or list type, trigger first kind comparing module 803, otherwise, trigger Second Type comparing module 804.
Wherein, the type of described current goal key can be dictionary type, list type, value type, character string type or Boolean type etc.if the type of described current goal key is the dictionary type, so described current goal key can comprise the dictionary type, list type, value type, the sub-key of character string type or Boolean type etc., if the type of described current goal key is list type, so described current goal key can comprise list type, value type, the sub-key of character string type or Boolean type etc., therefore, for the target key that may have different depth, at first determine its type, again for its type, carry out the data check of different modes, therefore, when the type of described current goal key is dictionary type or list type, trigger described first kind comparing module 803 and carry out the data check of recursive fashion, type at described current goal key is value type, when character string type or Boolean type etc., trigger described Second Type comparing module 804 and carry out the data check of basic mode.
First kind comparing module 803, the type of the masterplate key corresponding with it is consistent be used to the type that judges described current goal key, if so, triggers the first submodule version spider module 805, otherwise, trigger the second information generating module 806.
wherein, described first kind determination module 802 is after the type of determining described current goal key is dictionary type or list type, by described first kind comparing module 803, at first the consistance of the type of the type of this current target key masterplate key corresponding with it is judged, when consistent, trigger described the first submodule version spider module 805 and carry out the recurrence inspection of the sub-key of subordinate of this current target key, otherwise, trigger the check result information that described the second information generating module 806 generates the Type-Inconsistencies of this current target key, finish the data validity checking of this current target key.
It should be noted that, in the embodiment of the present application, in described first kind comparing module 803, current goal key can be the ground floor target key of described test data dictionary, also can be the sub-key of subordinate of ground floor target key, also can be the sub-key of subordinate of the sub-key of this subordinate, therefore, in the data validity checking of above-mentioned mentioned this current target key of end, key that this current target key refers to may be ground floor target key or the second straton key or other sub-key, but not refers in particular to the ground floor target key under the test data dictionary of some appointments.
The first submodule version spider module 805, for determining whether described current goal key includes corresponding with each submodule version key in its corresponding masterplate key respectively sub-goal key, if in described current goal key, include corresponding with each submodule version key in its corresponding masterplate key respectively sub-goal key, using each the sub-goal key in described current goal key as the current goal key, trigger described first kind determination module 802, otherwise, trigger the 3rd information generating module 807 and described first kind determination module 802.
It should be noted that, described the first submodule version variable module 805 is the recurrence checking process of the target key to having any degree of depth, and namely the sub-goal key of the current goal key by triggering 802 pairs of dictionary types of described first kind determination module or list type travels through and the recurrence inspection.
The second information generating module 806, show the inconsistent check result information of described current goal key type for generation.
It should be noted that, in the embodiment of the present application, in described the second information generating module 806, current goal key can be the ground floor target key of described test data dictionary, also can be the sub-key of subordinate of ground floor target key, also can be the sub-key of subordinate of the sub-key of this subordinate, that is to say, the current goal key that key refers to that mentions in described the second information generating module 806 may be ground floor target key or the second straton key or other sub-key, but not refers in particular to the ground floor target key under the test data dictionary of some appointments.
The 3rd information generating module 807, include the check result information of the identification information of the sub-goal key that described current goal key lacks for generation.
Second Type comparing module 804, the type of the masterplate key corresponding with it is consistent be used to the type that judges the current goal key, if so, triggers the 4th information generating module 808, otherwise, trigger described the second information generating module 806.
The 4th information generating module 808, show the check result information of described current goal bonding method for generation.
wherein, the type that determines described current goal key in described first kind determination module 802 is the type except dictionary type and list type, at this moment, described current goal key does not have the sub-key of any degree of depth, therefore, directly trigger the consistance of the type of the type of the described current goal key of the described Second Type comparing module 804 judgement masterplate key corresponding with it, and then when the type of the type of described current goal key and its corresponding masterplate key is consistent, trigger described the 4th information generating module 808 generations and show the check result information that described current goal key is legal, when the Type-Inconsistencies of the type of the described current goal key masterplate key corresponding with it, trigger described the second information generating module 806 and generate the check result information that shows described current goal key Type-Inconsistencies.
A kind of implementation of above-mentioned the embodiment of the present application seven in the application, the recursive data of target key with any degree of depth being checked.
In actual applications, the application also has another kind of implementation, with reference to figure 9, and the structural representation of the examination of recurrence described in a kind of data detecting device embodiment eight that provides for the application subelement 622, wherein, described recurrence examination subelement 622 comprises:
The second target determination module 901, for each object key using described test data dictionary as the current goal key.
It should be noted that the data check of subsequent step for the some target key in described test data dictionary are carried out as current goal key in the embodiment of the present application.Legitimacy for each target key in described test data dictionary all can adopt the method in the embodiment of the present application to check, be: the embodiment of the present application has generality, can apply the data validity checking to each target key in described test data dictionary.
The 3rd type comparing module 902, the type of the masterplate key corresponding with it is consistent be used to the type that judges described current goal key, if so, triggers Second Type determination module 903, otherwise, trigger the 5th information generating module 904.
Wherein, in described the 3rd type comparing module 902, at first judge whether current goal key type is consistent with its corresponding masterplate key, if, trigger Second Type determination module 903 and carry out the data check of different modes according to the type of this current target key, as the target key to having any degree of depth such as dictionary type or classification type etc., carry out the data check of recursive fashion, the target key that does not have any degree of depth such as numerical value type or character string type etc. is carried out to the data check of basic mode.
Second Type determination module 903, for determining the type of described current goal key, if the type of described current goal key is dictionary type or list type, trigger the second submodule version spider module 905, otherwise, trigger the 6th information generating module 906.
The 5th information generating module 904, show the inconsistent check result information of described current goal key type for generation.
It should be noted that, in the embodiment of the present application, current goal key in described the 5th information generating module 904 can be the ground floor target key of described test data dictionary, also can be the sub-key of subordinate of ground floor target key, also can be the sub-key of subordinate of the sub-key of this subordinate, that is to say, the current goal key that key refers to that mentions in described the 5th information generating module 904 may be ground floor target key or the second straton key or other sub-key, but not refers in particular to the ground floor target key under the test data dictionary of some appointments.
The second submodule version spider module 905, for determining whether described current goal key includes corresponding with each submodule version key in its corresponding masterplate key respectively sub-goal key, if, using each the sub-goal key in described current goal key as the current goal key, trigger described the 3rd type comparing module 902, otherwise, the 7th information generating module 907 triggered, and, using each the sub-goal key in described current goal key as the current goal key, trigger described the 3rd type comparing module 902.
Wherein, the type of described current goal key can be dictionary type, list type, value type, character string type or Boolean type etc.if the type of described current goal key is the dictionary type, so described current goal key can comprise the dictionary type, list type, value type, the sub-key of character string type or Boolean type etc., if the type of described current goal key is list type, so described current goal key can comprise list type, value type, the sub-key of character string type or Boolean type etc., therefore, for the target key that may have different depth, at first determine its type, again for its type, carry out the data check of different modes, therefore, when the type of described current goal key is dictionary type or list type, trigger described the second submodule version spider module 905 and carry out the data check of recursive fashion, type at described current goal key is value type, when character string type or Boolean type etc., trigger described the 6th information generating module 906.
It should be noted that, described the second submodule version spider module 905 is the recurrence checking process of the target key to having any degree of depth, namely by triggering described the 3rd type comparing module 902, the sub-goal key of the current goal key of dictionary type or list type is traveled through and the recurrence inspection.
The 6th information generating module 906, show the check result information of described current goal bonding method for generation.
Wherein, described the 6th information generating module 906 is the type except dictionary type and list type for the type that determines described current goal key in described Second Type determination module 903, at this moment, described current goal key does not have the sub-key of any degree of depth, therefore, directly carry out described the 6th information generating module 906 generations and show the check result information that described current goal key is legal.
The 7th information generating module 907, include the check result information of the identification information of the sub-goal key that described current goal key lacks for generation.
Above-mentioned implementation is different in the operation order of each functional module, but similar on its specific implementation separately, at this, is not described in detail.
It should be noted that, each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is and the difference of other embodiment that between each embodiment, identical similar part is mutually referring to getting final product.
Finally, also it should be noted that, in this article, relational terms such as the first and second grades only is used for an entity or operation are separated with another entity or operational zone, and not necessarily requires or imply between these entities or operation the relation of any this reality or sequentially of existing.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thereby make the process, method, article or the equipment that comprise a series of key elements not only comprise those key elements, but also comprise other key elements of clearly not listing, or also be included as the intrinsic key element of this process, method, article or equipment.In the situation that not more restrictions, the key element that is limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment that comprises described key element and also have other identical element.
Above a kind of data checking provided by the present invention and device are described in detail, applied specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment is just be used to helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as the restriction to the application.