CN112269706B - Interface parameter verification method, device, electronic equipment and computer readable medium - Google Patents
Interface parameter verification method, device, electronic equipment and computer readable medium Download PDFInfo
- Publication number
- CN112269706B CN112269706B CN202011279136.2A CN202011279136A CN112269706B CN 112269706 B CN112269706 B CN 112269706B CN 202011279136 A CN202011279136 A CN 202011279136A CN 112269706 B CN112269706 B CN 112269706B
- Authority
- CN
- China
- Prior art keywords
- parameter
- interface
- verification
- name
- checked
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000012795 verification Methods 0.000 title claims abstract description 206
- 238000000034 method Methods 0.000 title claims abstract description 64
- 230000015654 memory Effects 0.000 claims description 19
- 230000004044 response Effects 0.000 claims description 19
- 238000000605 extraction Methods 0.000 claims description 11
- 208000011580 syndromic disease Diseases 0.000 claims description 9
- 238000006243 chemical reaction Methods 0.000 claims description 8
- 238000001514 detection method Methods 0.000 claims description 7
- 238000004891 communication Methods 0.000 abstract description 6
- 238000011161 development Methods 0.000 abstract description 5
- 238000012360 testing method Methods 0.000 abstract description 2
- 230000005540 biological transmission Effects 0.000 description 8
- 238000012545 processing Methods 0.000 description 5
- 238000004590 computer program Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 239000000284 extract Substances 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 229940004975 interceptor Drugs 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000007667 floating Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/22—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
- G06F11/2205—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/22—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
- G06F11/2247—Verification or detection of system hardware configuration
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/22—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
- G06F11/2273—Test methods
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The application discloses an interface parameter verification method and device, relates to the technical field of cloud computing, and further relates to the fields of data testing and data communication. One embodiment of the method comprises the following steps: loading a parameter verification rule, wherein the parameter verification rule is used for verifying interface parameters of at least one interface; receiving an interface check request message in a network; extracting an interface name and an interface parameter to be checked in an interface check request message; and based on the parameter verification rule, verifying the interface parameters to be verified, and returning a verification result. This embodiment saves development costs.
Description
Technical Field
The present disclosure relates to the field of cloud computing technologies, and in particular, to the field of data testing and data communication, and in particular, to an interface parameter verification method and apparatus, an electronic device, and a computer readable medium.
Background
Applications and applications often require specific business logic to be implemented through interface calls, such as: the "merchandise manager" invokes the interface provided by the "order manager" to obtain all associated orders for a single merchandise. When the interface is called, information is transmitted through interface parameters, such as: in the above scenario, the product ID is an interface parameter that the "product manager" passes to the "order manager".
Each parameter when the interface is called requires corresponding check logic to be written by a developer. If more parameters are required in the interface call or the fields are required to be increased or decreased frequently in the interface call, the workload of the developer is larger and the development cost is higher.
Disclosure of Invention
An interface parameter verification method, an interface parameter verification device, an electronic device and a computer readable medium are provided.
According to a first aspect, there is provided an interface parameter checking method, the method comprising: loading a parameter verification rule, wherein the parameter verification rule is used for verifying interface parameters of at least one interface; receiving an interface check request message in a network; extracting an interface name and an interface parameter to be checked in an interface check request message; and verifying the interface parameters to be verified based on the parameter verification rules corresponding to the interface names, and returning a verification result.
According to a second aspect, there is provided an interface parameter verification apparatus, the apparatus comprising: the loading unit is configured to load parameter verification rules, and the parameter verification rules are used for verifying interface parameters of at least one interface; a receiving unit configured to receive an interface check request message in a network; the extraction unit is configured to extract an interface name and an interface parameter to be checked in the interface check request message; and the verification unit is configured to verify the interface parameters to be verified based on the parameter verification rules corresponding to the interface names and return a verification result.
According to a third aspect, there is provided an electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor, wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method as described in any one of the implementations of the first aspect.
According to a fourth aspect, there is provided a non-transitory computer readable storage medium storing computer instructions for causing a computer to perform a method as described in any implementation of the first aspect.
The embodiment of the application provides an interface parameter verification method and device, which comprises the steps of firstly loading a parameter verification rule for verifying interface parameters of at least one interface; secondly, receiving an interface check request message in a network; then, extracting an interface name and an interface parameter to be checked in the interface checking request message; and finally, checking the interface parameters to be checked based on the parameter checking rules corresponding to the interface names, and returning a checking result. Therefore, all the interface parameters to be checked in the interface check message can be checked through the loaded parameter check rule, the automation of the interface parameter check is improved, and the development cost of technicians in checking all the interface parameters to be checked is saved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for better understanding of the present solution and do not constitute a limitation of the present application. Wherein:
FIG. 1 is a flow chart according to one embodiment of an interface parameter verification method of the present application;
FIG. 2 is a flow chart of a method of extracting interface parameters to be checked in an interface check request message according to the present application;
FIG. 3 is a flow chart of the present application for verifying interface parameters to be verified;
FIG. 4 is a flow chart of another embodiment of an interface parameter verification method of the present application;
FIG. 5 is a schematic structural diagram of an embodiment of an interface parameter verification apparatus according to the present application;
fig. 6 is a block diagram of an electronic device for implementing the interface parameter verification method of the embodiments of the present application.
Detailed Description
Exemplary embodiments of the present application are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present application to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
FIG. 1 illustrates a flow 100 according to one embodiment of an interface parameter verification method of the present application. The interface parameter checking method comprises the following steps:
and step 101, loading parameter verification rules.
The parameter verification rule is used for verifying interface parameters of at least one interface.
In this embodiment, the parameter checking rule is a predetermined checking rule, and all interface parameters of the interface to be called currently can be checked. The parameter verification rules correspond to at least one interface name, and each interface name may correspond to a parameter verification rule involving verification of a plurality of interface parameters.
Wherein, checking the interface parameter includes: the rule for determining whether the interface parameter meets the requirement of the attribute (the type of the parameter, the size range of the parameter value, etc.), for example, the check rule includes: whether the interface parameter is null, whether the type of the interface parameter meets the preset type requirement, whether the length of the interface parameter meets the preset length, and the like.
Further, since the interface call request including the interface parameter needs to meet the requirement of the network transmission protocol in the network (such as a local area network or the internet) transmission process, the checking rule for the interface parameter may further include checking whether the interface call request including the interface parameter meets the network transmission protocol of the interface parameter, and of course, the checking rule for the interface parameter may also be that: after determining that the interface call request containing the interface parameters meets the network transmission protocol of the interface parameters, it may also be checked whether the interface parameters meet the requirements of the attributes thereof.
Optionally, in this embodiment, the checking the interface parameter by the parameter checking rule may further include: the acquired interface parameters are subjected to format processing (for example, the interface parameters are converted into the interface parameter corresponding types), and then whether the interface parameters subjected to actual format processing meet the requirements of the interface parameter corresponding types is judged.
In this embodiment, the operation of the interface parameter verification method and the execution body thereon may acquire the parameter verification rule from the terminal in real time or from the database, and after loading the parameter verification rule, the verification logic based on the parameter verification rule verifies the interface parameter in the received verification request message.
Step 102, receiving an interface check request message in a network.
In this embodiment, the network may be the internet or a local area network. The interface verification request message is a message about an interface parameter to be verified, which is sent to another application program in the process that the application program invokes the interface of the other application program in order to realize the specific service logic.
Specifically, the interface verification request message includes an interface parameter to be verified, and based on different transmission protocols, the positions of the interface parameter to be verified in the interface verification request message are different. For example, based on HTTP (HyperText Transfer Protocol ) transport protocol, the interface parameters to be checked may be located at three positions of Query (request line), header (request Header), body (request Body) of the corresponding protocol in the interface check request message, respectively.
And step 103, extracting the interface name and the interface parameter to be checked in the interface checking request message.
In this embodiment, after the execution body receives the interface verification request message, the Interceptor (e.g., the Interceptor tool) may extract the interface name and the interface parameter to be verified in the interface verification request message.
Optionally, before extracting the interface name and the interface parameter to be checked in the interface check request message, the service requirement information in the interface check request message may be pre-checked, where the interface check request message generally carries its own service requirement information, for example, "obtain an item detail information according to an item ID", and the request will have an item ID at this time, where the item ID is its own service requirement information, and the item ID may be checked first, and the pre-check is completed if the check is passed.
Step 104, based on the parameter checking rule corresponding to the interface name, checking the interface parameter to be checked, and returning the checking result.
In this embodiment, the parameter verification rule includes at least one parameter verification rule corresponding to an interface name, and since different interface names have different parameter verification rules, the extracted interface names may be used as indexes to search and determine the parameter verification rule corresponding to the interface name in the parameter verification rules.
Further, the parameter verification rule corresponding to the interface name further includes a parameter verification rule corresponding to at least one interface parameter, where the interface parameter includes: the interface parameter name and the parameter value corresponding to the interface parameter name can be used as an index to search and determine the parameter verification rule corresponding to the interface parameter to be verified in the parameter verification rule corresponding to the interface name.
In this embodiment, the interface parameter to be checked is a member of at least one interface parameter, and the interface parameter to be checked includes: and the interface parameter name to be checked and the parameter value corresponding to the interface parameter name to be checked. As shown in example one.
Example one: {
"paramName":"emailAddress",
"apiName":"submitEmailAddress",
"position":"Query",
"using":"ture",
"type":"string",
"required":true,
"maxLength":100,
"minLength":5,
"pattern":"^[a-z0-9A-Z]+[-|a-z0-9A-Z._]+@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-z]{2,}$"}
The parameter check rule corresponding to the interface name shown in example one indicates:
and checking the interface name sub-mtemail address and the parameter name email address to be checked of the position Query, wherein the maximum length of the parameter name to be checked is 100, the minimum length of the parameter name to be checked is 5, and the parameter value corresponding to the parameter name to be checked must meet the regular expression of the pattern part.
In this embodiment, the verification result includes: and if the checksum does not pass the verification, and if the verification result is that the checksum passes the verification, a subsequent interface calling mode can be performed. And when the checking result is that the checking is not passed, determining that the interface parameters to be checked are illegal, and sending out an abnormal message or/and an alarm.
According to the interface parameter verification method provided by the embodiment of the application, firstly, a parameter verification rule for verifying interface parameters of at least one interface is loaded; secondly, receiving an interface check request message in a network; then, extracting an interface name and an interface parameter to be checked in the interface checking request message; and finally, checking the interface parameters to be checked based on the parameter checking rules corresponding to the interface names, and returning a checking result. Therefore, all the interface parameters to be checked in the interface check message can be checked through the loaded parameter check rule, the automation of the interface parameter check is improved, and the development cost of technicians in checking all the interface parameters to be checked is saved.
In this embodiment, the interface parameters to be checked include: in some optional implementations of the present embodiment, as shown in fig. 2, the method for extracting the interface parameter to be checked in the interface check request message includes the following steps:
step 201, extracting the interface parameter name to be checked from the interface check request message.
In this optional implementation manner, after the execution body receives the interface verification request message, the interceptor may extract the name of the interface parameter to be verified in the interface verification request message.
Step 202, checking the interface parameter name to be checked based on the parameter checking rule corresponding to the interface name.
In this optional implementation manner, the parameter verification rule corresponding to the interface name includes a parameter verification rule corresponding to at least one interface parameter, and since the interface parameter name to be verified is already determined, the parameter verification rule corresponding to the interface parameter name to be verified can be determined from the parameter verification rule corresponding to the at least one interface parameter, and the parameter verification rule corresponding to the interface parameter name to be verified is adopted to verify the interface parameter name to be verified. The specific verification process for verifying the interface parameter name to be verified can be based on the type, the length and the like of the interface parameter name to be verified.
Of course, the verification may also be performed based on the position of the to-be-verified interface parameter name in the interface verification request message, and in some optional implementations of this embodiment, the verifying the to-be-verified interface parameter name based on the parameter verification rule corresponding to the interface name includes: determining the position of an interface parameter name to be checked in an interface check request message; determining a parameter verification rule corresponding to the parameter to be verified from the parameter verification rule corresponding to the interface name; and determining that the to-be-checked interface parameter name passes the check according to the position of the to-be-checked interface parameter name in the interface check request message and the position of the to-be-checked interface parameter name recorded in the parameter check rule corresponding to the to-be-checked parameter.
In this optional implementation manner, the interface verification request message based on the HTTP transmission protocol may use the attribute of the extracted encoded data of the interception tool to obtain the parameters of the Query, header, body three parts in the interface verification request message, and store the parameters respectively, so as to determine the location of the name of the interface parameter to be verified in the interface verification request message. Further, a position of the name of the parameter to be verified of the current interface is defined in the parameter verification rule corresponding to the parameter to be verified, as shown in example two.
Example two: {
"paramName":"products.specification.price",
"apiName":"batchSubmitProduct",
"position":"Body",
"using":"true",
"type":"Float",
"required":true,
"maxDigital":5,
"minDigital":1
}
The parameter verification rule corresponding to the parameter to be verified shown in the second example represents:
and (3) checking the interface name, namely the batch sub-mitproduct, the position Body and the interface parameter name to be checked, namely the product.
In this optional implementation manner, by judging whether the position of the interface parameter name to be checked in the interface check request message matches with the position of the interface parameter name to be checked recorded in the parameter check rule corresponding to the parameter to be checked, whether the interface parameter name to be checked is checked correctly is verified, for some interface check request messages based on network transmission protocols, such as HTTP and RMI (Remote Method Invocation), remote method calling protocols, the effective result of the interface parameter name to be checked can be obtained due to the fixed position of each interface parameter, and the reliability of the check result is ensured.
In step 203, in response to determining that the interface parameter name to be checked passes the check, the parameter value is extracted.
In this optional implementation manner, the parameter value corresponding to the interface parameter name to be checked in the interface checking request message can be extracted through the interceptor.
In the alternative implementation manner, firstly, extracting an interface parameter name to be checked from an interface check request message, and checking the interface parameter name to be checked based on a parameter check rule corresponding to the interface name; finally, after the parameter name of the interface to be checked passes the check, the parameter value is extracted, and the extraction and check and re-extraction modes ensure the reliability of the extraction of the parameter of the interface to be checked.
In another optional implementation manner of this embodiment, since the interface parameters to be checked include: the interface parameter name to be checked and the parameter value corresponding to the interface parameter name to be checked may also be sequentially extracted from the interface check request message, and then the parameter values corresponding to the interface parameter name to be checked and the interface parameter to be checked are sequentially checked, and in some alternative implementations of the embodiment, as shown in fig. 3, the method for checking the interface parameter to be checked includes the following steps:
step 301, verifying the interface parameter name to be verified based on the parameter verification rule corresponding to the interface name.
In this optional implementation manner, the parameter verification rule corresponding to the interface name includes a parameter verification rule corresponding to at least one interface parameter, and since the interface parameter name to be verified is already determined, the parameter verification rule corresponding to the interface parameter name to be verified can be determined in the parameter verification rule corresponding to the at least one interface parameter, and the parameter verification rule corresponding to the interface parameter name to be verified is adopted to verify the interface parameter name to be verified. The specific verification process for verifying the interface parameter name to be verified can be based on the type, the length and the like of the interface parameter name to be verified.
In some optional implementations of this embodiment, the verifying the interface parameter name to be verified based on the parameter verification rule corresponding to the interface name includes: determining the position of an interface parameter name to be checked in an interface check request message; determining a parameter verification rule corresponding to the parameter to be verified from the parameter verification rule corresponding to the interface name; and determining that the to-be-checked interface parameter name passes the check according to the position of the to-be-checked interface parameter name in the interface check request message and the position of the to-be-checked interface parameter name recorded in the parameter check rule corresponding to the to-be-checked parameter.
In the alternative implementation manner, by judging whether the position of the interface parameter name to be checked in the interface check request message is matched with the position of the interface parameter name to be checked recorded in the parameter check rule corresponding to the parameter to be checked, whether the interface parameter name to be checked is checked correctly is checked, for some interface check request messages based on network transmission protocols, such as HTTP and RMI, the position of each interface parameter is fixed, so that an effective result of the interface parameter name to be checked can be obtained, and the reliability of the check result is ensured.
In step 302, in response to determining that the interface parameter name to be checked passes the check, the parameter value is checked.
In this embodiment, the parameter verification rule corresponding to the interface name includes a parameter verification rule corresponding to a parameter to be verified, and the parameter verification rule corresponding to the parameter to be verified may include: the data type of the parameter value corresponding to the interface parameter name to be checked, such as character string, integer, floating point type, boolean type, enumeration and list. The data type of the parameter value corresponding to the interface parameter name to be checked can be used for checking the parameter value corresponding to the interface parameter name to be checked.
In some optional implementations of this embodiment, the parameter verification rule corresponding to the parameter to be verified may include: the method for verifying the parameter value comprises the following steps of:
converting the data type of the parameter values according to the preset data type; detecting whether the converted parameter value meets a syndrome rule or not in response to the fact that the data type of the converted parameter value is the same as the preset data type; and determining that the parameter value passes the verification in response to the detection result that the converted parameter value meets the syndrome rule.
In this optional implementation manner, since the extracted parameter value is generally a character string, it is not beneficial to data type verification, so that data type conversion is performed on the parameter value according to a preset data type, which is beneficial to data type verification on one hand, and whether the extracted parameter value is correctly transmitted in the interface verification request message can be confirmed on the other hand.
In this alternative implementation manner, the syndrome rule is used to check whether the specific value of the parameter value meets the requirement, and as in the regular expression in the first example and the second example, the maximum and minimum decimal digits belong to the syndrome rule.
According to the method for verifying the parameter values, the extracted parameter values are subjected to data type conversion to be changed into the preset data types in the parameter verification rules, and whether the converted parameter values meet the syndrome rules is verified in response to the fact that the converted parameter values are identical to the preset data types, so that the reliability of verifying the parameter values is improved.
According to the method for verifying the interface parameters to be verified, the interface names, the interface parameter names and the parameter values corresponding to the interface parameter names to be verified are sequentially verified after the interface names, the interface parameter names and the parameter values corresponding to the interface parameter names to be verified are extracted, and therefore reliability of verification of the interface parameters to be verified is improved.
In order to update the parameter verification rule, for all the above embodiments, the parameter verification rule may also be updated by reading the database, referring to fig. 4, which shows a flow 400 of another embodiment of the interface parameter verification method of the present application, where the interface parameter verification method includes the following steps:
step 401, loading a preset parameter checking rule.
The parameter verification rule is used for verifying interface parameters of at least one interface.
In this embodiment, the preset parameter verification rule is a preset parameter verification rule, which may be placed in some applications or databases in advance, and the interface parameter verification method and the running main body on the interface parameter verification method may obtain the preset parameter verification rule by calling an interface or accessing the database. Of course, the preset parameter verification rule may be the same parameter verification rule as that in the embodiment shown in fig. 1.
Step 402, an interface check request message in a network is received.
Step 403, extracting the interface name and the interface parameter to be checked in the interface checking request message.
Step 404, based on the parameter verification rule corresponding to the interface name, verifying the interface parameter to be verified, and returning the verification result.
It should be understood that the operations and features in steps 401-404 described above correspond to those in steps 101-104, respectively, and thus the descriptions of the operations and features in steps 101-104 described above also apply to steps 401-404, and are not repeated here.
Step 405, periodically reads the parameter checking rules of the database.
In this embodiment, the time for periodically reading the parameter verification rule of the database may be set according to the requirement of the execution subject, and all the reading times covering the update time of the parameter verification rule in the database are within the protection scope of this embodiment.
Step 406, in response to determining that the parameter calibration rule of the database is different from the preset parameter calibration rule, replacing the preset parameter calibration rule with the parameter calibration rule of the database, and returning to step 401.
In this embodiment, when the parameter verification rule of the database is different from the preset parameter verification rule, it is explained that the parameter verification rule of the database is already the latest parameter verification rule, and by returning to step 401, the latest parameter verification rule is reloaded, so that it can be ensured that the version of the rule according to the parameter verification method is always the latest version.
According to the interface parameter verification method, the parameter verification rules in the database are read regularly, and when the parameter verification rules in the database are different from the preset parameter verification rules, the parameter verification rules in the database are replaced by the preset parameter verification rules, so that the regular update of the parameter verification rules is achieved, and the real-time performance of the interface parameter verification is ensured.
With further reference to fig. 5, as an implementation of the method shown in the foregoing figures, the present application provides an embodiment of an interface parameter checking apparatus, where an embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 1, and the apparatus is specifically applicable to various electronic devices.
As shown in fig. 5, the interface parameter checking apparatus 500 provided in this embodiment includes: a loading unit 501, a receiving unit 502, an extracting unit 503, and a checking unit 504. The loading unit 501 may be configured to load a parameter verification rule, where the parameter verification rule is used to verify an interface parameter of at least one interface. The receiving unit 502 may be configured to receive an interface check request message in the network. The extracting unit 503 may be configured to extract the interface name and the interface parameter to be checked in the interface check request message. The verification unit 504 may be configured to verify the interface parameter to be verified based on the parameter verification rule corresponding to the interface name, and return the verification result.
In this embodiment, in the interface parameter checking apparatus 500: the specific processing of the loading unit 501, the receiving unit 502, the extracting unit 503, and the verifying unit 504 and the technical effects thereof may refer to the descriptions related to the steps 101, 102, 103, and 104 in the corresponding embodiment of fig. 1, and are not repeated herein.
In some optional implementations of this embodiment, the interface parameters to be verified include: the extracting unit 503 includes: a parameter extraction module (not shown in the figure), a parameter verification module (not shown in the figure), and a value extraction module (not shown in the figure). The parameter extraction module may be configured to extract the name of the interface parameter to be checked from the interface check request message. The parameter verification module may be configured to verify the interface parameter name to be verified based on a parameter verification rule corresponding to the interface name. The above-described value extraction module may be configured to extract the parameter value in response to determining that the interface parameter name to be checked passes the check.
In some optional implementations of this embodiment, the interface parameters to be verified include: the interface parameter name to be checked and the parameter value corresponding to the interface parameter name to be checked; the verification unit 504 includes: a parameter checking module (not shown in the figure), and a value checking module (not shown in the figure). The parameter verification module may be configured to verify the interface parameter name to be verified based on a parameter verification rule corresponding to the interface name. The value verification module may be configured to verify the parameter value in response to determining that the interface parameter name to be verified passes the verification.
In some optional implementations of this embodiment, the parameter verification module includes: a positioning sub-module (not shown), a determining sub-module (not shown), and a verifying sub-module (not shown). The positioning sub-module determines the position of the interface parameter name to be checked in the interface check request message. The determining submodule may be configured to determine a parameter verification rule corresponding to the parameter to be verified from parameter verification rules corresponding to the interface name. The verification sub-module may be configured to determine that the to-be-verified interface parameter name passes the verification in response to the matching of the position of the to-be-verified interface parameter name in the interface verification request message and the position of the to-be-verified interface parameter name recorded in the parameter verification rule corresponding to the to-be-verified parameter.
In some optional implementations of this embodiment, the parameter verification rule corresponding to the parameter to be verified includes: the value verification module comprises a preset data type and a syndrome rule for carrying out numerical verification on a parameter value, wherein the value verification module comprises: a conversion sub-module (not shown), a detection sub-module (not shown), and a verification sub-module (not shown). The conversion submodule may be configured to perform data type conversion on the parameter value according to a preset data type. The detection sub-module may be configured to detect whether the converted parameter value satisfies the syndrome rule in response to the data type of the converted parameter value being the same as a preset data type. The above-described verification sub-module may be configured to determine that the parameter value passes the verification in response to the detection result being that the converted parameter value satisfies the verification sub-rule.
In some optional implementations of this embodiment, the apparatus 500 further includes: a reading unit (not shown in the figure), and a replacement unit (not shown in the figure). The reading unit may be configured to periodically read a parameter verification rule of the database. The replacing unit may be configured to replace the parameter check rule with the parameter check rule of the database in response to determining that the parameter check rule of the database is not identical to the parameter check rule.
According to the interface parameter verification device provided by the embodiment of the application, firstly, a loading unit 501 loads a parameter verification rule for verifying interface parameters of at least one interface; second, the receiving unit 502 receives an interface check request message in the network; then, the extracting unit 503 extracts the interface name and the interface parameter to be checked in the interface check request message; finally, the verification unit 504 verifies the interface parameters to be verified based on the parameter verification rule corresponding to the interface name, and returns a verification result. Therefore, all the interface parameters to be checked in the interface check message can be checked through the loaded parameter check rule, the automation of the interface parameter check is improved, and the development cost of technicians in checking all the interface parameters to be checked is saved.
According to embodiments of the present application, an electronic device and a readable storage medium are also provided.
As shown in fig. 6, a block diagram of an electronic device according to an interface parameter verification method according to an embodiment of the present application is shown. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the application described and/or claimed herein.
As shown in fig. 6, the electronic device includes: one or more processors 601, memory 602, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the electronic device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In other embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple electronic devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system). One processor 601 is illustrated in fig. 6.
Memory 602 is a non-transitory computer-readable storage medium provided herein. The memory stores instructions executable by the at least one processor to cause the at least one processor to perform the interface parameter checking methods provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the interface parameter verification method provided by the present application.
The memory 602 is used as a non-transitory computer readable storage medium, and may be used to store a non-transitory software program, a non-transitory computer executable program, and modules, such as program instructions/modules (e.g., the loading unit 501, the receiving unit 502, the extracting unit 503, and the verifying unit 504 shown in fig. 5) corresponding to the interface parameter verification method in the embodiment of the present application. The processor 601 executes various functional applications of the server and data processing by running non-transitory software programs, instructions and modules stored in the memory 602, i.e., implements the interface parameter verification method in the method embodiments described above.
The memory 602 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for a function; the storage data area may store data created according to the use of the electronic device of the interface parameter checking method, and the like. In addition, the memory 602 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 602 may optionally include memory remotely located with respect to processor 601, which may be connected to the electronic device of the interface parameter verification method via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the interface parameter checking method may further include: an input device 603 and an output device 604. The processor 601, memory 602, input devices 603 and output devices 604 may be connected by a bus 605 or otherwise, in fig. 6 by way of example by bus 605.
The input device 603 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device of the interface parameter verification method, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointer stick, one or more mouse buttons, a track ball, a joystick, and the like. The output means 604 may include a display device, auxiliary lighting means (e.g., LEDs), tactile feedback means (e.g., vibration motors), and the like. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device may be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASIC (application specific integrated circuit), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
These computing programs (also referred to as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented in a high-level procedural and/or object-oriented programming language, and/or in assembly/machine language. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and virtual special server (VPS, virtual Private Server) service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, provided that the desired results of the technical solutions disclosed in the present application can be achieved, and are not limited herein.
The above embodiments do not limit the scope of the application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application are intended to be included within the scope of the present application.
Claims (10)
1. An interface parameter verification method, the method comprising:
loading a parameter verification rule, wherein the parameter verification rule is used for verifying interface parameters of at least one interface;
receiving an interface check request message in a network;
extracting an interface name and an interface parameter to be checked in the interface check request message; the interface parameters to be checked comprise: the method comprises the steps of checking an interface parameter name to be checked and a parameter value corresponding to the interface parameter name to be checked;
and verifying the interface parameters to be verified based on the parameter verification rules corresponding to the interface names, and returning a verification result comprises the following steps: determining the position of the interface parameter name to be checked in the interface check request message; determining a parameter verification rule corresponding to the parameter to be verified from the parameter verification rule corresponding to the interface name; determining that the to-be-verified interface parameter name passes verification according to the fact that the position of the to-be-verified interface parameter name in the interface verification request message is matched with the position of the to-be-verified interface parameter name recorded in a parameter verification rule corresponding to the to-be-verified parameter; and extracting the parameter value in response to determining that the interface parameter name to be checked passes the check.
2. The method of claim 1, wherein the extracting the interface parameter to be verified in the interface verification request message comprises:
extracting the interface parameter name to be checked from the interface check request message;
checking the interface parameter name to be checked based on a parameter checking rule corresponding to the interface name;
and extracting the parameter value in response to determining that the interface parameter name to be checked passes the check.
3. The method according to claim 1, wherein the parameter verification rule corresponding to the parameter to be verified includes: the method comprises the steps of presetting a data type and a check sub-rule for carrying out numerical check on the parameter value, wherein the step of checking the parameter value comprises the following steps:
carrying out data type conversion on the parameter value according to the preset data type;
detecting whether the converted parameter value meets the syndrome rule or not according to the fact that the data type of the converted parameter value is the same as the preset data type;
and responding to the detection result that the converted parameter value meets the syndrome rule, and determining that the parameter value passes the verification.
4. A method according to one of claims 1-3, the method further comprising:
periodically reading parameter verification rules of a database;
and in response to determining that the parameter check rule of the database is not identical to the loaded parameter check rule, replacing the parameter check rule of the database with the parameter check rule.
5. An interface parameter verification apparatus, the apparatus comprising:
the loading unit is configured to load parameter verification rules, and the parameter verification rules are used for verifying interface parameters of at least one interface;
a receiving unit configured to receive an interface check request message in a network;
an extracting unit, configured to extract an interface name and an interface parameter to be checked in the interface check request message, where the interface parameter to be checked includes: the method comprises the steps of checking an interface parameter name to be checked and a parameter value corresponding to the interface parameter name to be checked;
the verification unit is configured to verify the interface parameters to be verified based on the parameter verification rules corresponding to the interface names, and returns a verification result; the verification unit includes: the system comprises a parameter verification module and a value verification module, wherein the parameter verification module comprises: the positioning sub-module is configured to determine the position of the interface parameter name to be checked in the interface check request message; the determining submodule is configured to determine a parameter verification rule corresponding to a parameter to be verified from the parameter verification rules corresponding to the interface names; the verification sub-module is configured to determine that the to-be-verified interface parameter name passes verification according to the fact that the position of the to-be-verified interface parameter name in the interface verification request message is matched with the position of the to-be-verified interface parameter name recorded in a parameter verification rule corresponding to the to-be-verified parameter; the value verification module is configured to verify the parameter value in response to determining that the interface parameter name to be verified passes verification.
6. The apparatus of claim 5, wherein the extraction unit comprises:
the parameter extraction module is configured to extract the interface parameter name to be checked from the interface check request message;
the parameter verification module is configured to verify the interface parameter name to be verified based on a parameter verification rule corresponding to the interface name;
and a value extraction module configured to extract the parameter value in response to determining that the interface parameter name to be checked passes the check.
7. The apparatus of claim 5, wherein the parameter verification rule corresponding to the parameter to be verified comprises: the method comprises the steps of presetting a data type and a check sub-rule for carrying out numerical check on the parameter value, wherein the value check module comprises:
the conversion sub-module is configured to perform data type conversion on the parameter values according to the preset data types;
the detection sub-module is configured to respond to the fact that the data type of the converted parameter value is the same as the preset data type, and detect whether the converted parameter value meets the check sub-rule or not;
and the checking sub-module is configured to determine that the parameter value passes the check in response to the detection result that the converted parameter value meets the check sub-rule.
8. The apparatus according to one of claims 5-7, the apparatus further comprising:
a reading unit configured to periodically read a parameter verification rule of the database;
and a replacement unit configured to replace the parameter verification rule with the parameter verification rule of the database in response to determining that the parameter verification rule of the database is not identical to the loaded parameter verification rule.
9. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.
10. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011279136.2A CN112269706B (en) | 2020-11-16 | 2020-11-16 | Interface parameter verification method, device, electronic equipment and computer readable medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011279136.2A CN112269706B (en) | 2020-11-16 | 2020-11-16 | Interface parameter verification method, device, electronic equipment and computer readable medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112269706A CN112269706A (en) | 2021-01-26 |
CN112269706B true CN112269706B (en) | 2024-04-05 |
Family
ID=74340677
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011279136.2A Active CN112269706B (en) | 2020-11-16 | 2020-11-16 | Interface parameter verification method, device, electronic equipment and computer readable medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112269706B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113535776A (en) * | 2021-05-28 | 2021-10-22 | 国网辽宁省电力有限公司 | Parameter validity checking method and system applied to monitoring device |
CN113377361B (en) * | 2021-06-28 | 2023-01-13 | 浙江孚临科技有限公司 | Method for realizing timing verification of data source based on linux crontad and jar packets |
CN114666258B (en) * | 2022-03-22 | 2023-11-07 | 阿波罗智联(北京)科技有限公司 | Interface testing method, device, electronic equipment and medium |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018006789A1 (en) * | 2016-07-04 | 2018-01-11 | 中兴通讯股份有限公司 | Parameter checking method and apparatus, and network management server and computer storage medium |
CN108132880A (en) * | 2017-12-21 | 2018-06-08 | 武汉斑马快跑科技有限公司 | A kind of parameter verification method and device |
CN109101812A (en) * | 2018-08-28 | 2018-12-28 | 北京神州绿盟信息安全科技股份有限公司 | A kind of parameter verification method, apparatus, computing device and storage medium |
CN109344642A (en) * | 2018-08-31 | 2019-02-15 | 平安科技(深圳)有限公司 | Interface rules method of calibration, device, computer equipment and storage medium |
CN109408381A (en) * | 2018-10-10 | 2019-03-01 | 四川新网银行股份有限公司 | A kind of product data automatic Verification platform and method based on data check template |
CN109597816A (en) * | 2018-10-30 | 2019-04-09 | 京信通信系统(中国)有限公司 | Parameter verification method, apparatus, computer storage medium and embedded device |
CN109871294A (en) * | 2019-01-31 | 2019-06-11 | 北京百度网讯科技有限公司 | Method and apparatus for verifying data, processing request |
CN110390069A (en) * | 2019-07-31 | 2019-10-29 | 中国工商银行股份有限公司 | The method, apparatus of data check calculates equipment and medium |
CN110389765A (en) * | 2019-07-24 | 2019-10-29 | 深圳市盟天科技有限公司 | A kind of parameter verification method and parameter verification system |
WO2020124286A1 (en) * | 2018-12-16 | 2020-06-25 | 吉安市井冈山开发区金庐陵经济发展有限公司 | Authentication method |
CN111679975A (en) * | 2020-05-28 | 2020-09-18 | 平安普惠企业管理有限公司 | Document generation method and device, electronic equipment and medium |
CN111782517A (en) * | 2020-06-23 | 2020-10-16 | 浙江保融科技有限公司 | Automatic file checking method |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9178705B2 (en) * | 2007-04-13 | 2015-11-03 | International Business Machines Corporation | Method and system for stateless validation |
-
2020
- 2020-11-16 CN CN202011279136.2A patent/CN112269706B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018006789A1 (en) * | 2016-07-04 | 2018-01-11 | 中兴通讯股份有限公司 | Parameter checking method and apparatus, and network management server and computer storage medium |
CN108132880A (en) * | 2017-12-21 | 2018-06-08 | 武汉斑马快跑科技有限公司 | A kind of parameter verification method and device |
CN109101812A (en) * | 2018-08-28 | 2018-12-28 | 北京神州绿盟信息安全科技股份有限公司 | A kind of parameter verification method, apparatus, computing device and storage medium |
CN109344642A (en) * | 2018-08-31 | 2019-02-15 | 平安科技(深圳)有限公司 | Interface rules method of calibration, device, computer equipment and storage medium |
CN109408381A (en) * | 2018-10-10 | 2019-03-01 | 四川新网银行股份有限公司 | A kind of product data automatic Verification platform and method based on data check template |
CN109597816A (en) * | 2018-10-30 | 2019-04-09 | 京信通信系统(中国)有限公司 | Parameter verification method, apparatus, computer storage medium and embedded device |
WO2020124286A1 (en) * | 2018-12-16 | 2020-06-25 | 吉安市井冈山开发区金庐陵经济发展有限公司 | Authentication method |
CN109871294A (en) * | 2019-01-31 | 2019-06-11 | 北京百度网讯科技有限公司 | Method and apparatus for verifying data, processing request |
CN110389765A (en) * | 2019-07-24 | 2019-10-29 | 深圳市盟天科技有限公司 | A kind of parameter verification method and parameter verification system |
CN110390069A (en) * | 2019-07-31 | 2019-10-29 | 中国工商银行股份有限公司 | The method, apparatus of data check calculates equipment and medium |
CN111679975A (en) * | 2020-05-28 | 2020-09-18 | 平安普惠企业管理有限公司 | Document generation method and device, electronic equipment and medium |
CN111782517A (en) * | 2020-06-23 | 2020-10-16 | 浙江保融科技有限公司 | Automatic file checking method |
Also Published As
Publication number | Publication date |
---|---|
CN112269706A (en) | 2021-01-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112269706B (en) | Interface parameter verification method, device, electronic equipment and computer readable medium | |
CN110765024B (en) | Simulation test method, simulation test device, electronic equipment and computer readable storage medium | |
CN107390983B (en) | Service instruction execution method, client and storage medium | |
CN112182037B (en) | Data verification method, device, equipment and storage medium | |
CN111813623B (en) | Page monitoring method and device, electronic equipment and storage medium | |
CN112491617B (en) | Link tracking method, device, electronic equipment and medium | |
CN111475164B (en) | Component dependency relationship detection method and device and electronic equipment | |
CN111752843A (en) | Method, device, electronic equipment and readable storage medium for determining influence surface | |
CN111698326A (en) | Method and apparatus for determining cost attribution of cloud service resources | |
CN111985760A (en) | Data content evaluation method and device, electronic equipment and storage medium | |
CN114764713A (en) | Method and device for generating merchant patrol task, electronic equipment and storage medium | |
CN111694686B (en) | Processing method and device for abnormal service, electronic equipment and storage medium | |
CN114706774A (en) | Interface test method, device, equipment and storage medium | |
CN111782445B (en) | Configuration method and device of equipment debugging environment | |
CN112822302B (en) | Data normalization method and device, electronic equipment and storage medium | |
CN112052347A (en) | Image storage method and device and electronic equipment | |
CN113760695A (en) | Method and device for positioning problem code | |
CN112261072A (en) | Service calling method, device, equipment and storage medium | |
CN112732471A (en) | Error correction method and error correction device for interface return data | |
CN118503944B (en) | Authentication method, device, equipment and storage medium | |
CN115840604B (en) | Data processing method, device, electronic equipment and computer readable storage medium | |
CN118069539B (en) | Data processing method, device, electronic equipment and storage medium | |
CN112925482B (en) | Data processing method, device, system, electronic equipment and computer storage medium | |
CN111833024B (en) | Method, apparatus, device and storage medium for outputting information | |
CN115480922A (en) | Resource information processing method, device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |