CN112579055A - Interface parameter checking method and device and computer readable storage medium - Google Patents

Interface parameter checking method and device and computer readable storage medium Download PDF

Info

Publication number
CN112579055A
CN112579055A CN202011457956.6A CN202011457956A CN112579055A CN 112579055 A CN112579055 A CN 112579055A CN 202011457956 A CN202011457956 A CN 202011457956A CN 112579055 A CN112579055 A CN 112579055A
Authority
CN
China
Prior art keywords
parameter
interface
verification
checking
document
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.)
Pending
Application number
CN202011457956.6A
Other languages
Chinese (zh)
Inventor
程凯凌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011457956.6A priority Critical patent/CN112579055A/en
Publication of CN112579055A publication Critical patent/CN112579055A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Storage Device Security (AREA)

Abstract

The invention relates to the field of parameter processing and discloses an interface parameter checking method which comprises the steps of obtaining an interface parameter document, wherein the interface parameter document comprises a parameter entry field and an interface address corresponding to an interface; analyzing the interface parameter document, acquiring an analysis result corresponding to the parameter entry field, and storing the analysis result and the interface address in an associated manner based on the interface; traversing the analysis result based on the preset verification condition, acquiring a parameter field needing attribute conversion in the analysis result, converting the attribute of the parameter field into a corresponding verification judgment condition, and inputting the verification judgment condition into a verifier object; according to a call instruction sent to the interface, interface parameter check logic in the checker object is started, and a parameter check condition is acquired and checked based on the interface parameter check logic, so that a parameter check result corresponding to the interface is determined. The invention also relates to a blockchain technology, and the interface parameter document is stored in the blockchain. The invention can improve the efficiency and accuracy of the interface parameter verification.

Description

Interface parameter checking method and device and computer readable storage medium
Technical Field
The present invention relates to the field of parameter verification technologies, and in particular, to a method and an apparatus for verifying interface parameters, an electronic device, and a computer-readable storage medium.
Background
At present, in the process of forming a posterior application interface interacting with a front end, a plurality of corresponding interfaces and parameters are defined, some interface parameters have certain requirements, such as maximum value and minimum value constraints, and relate to regular verification of mobile phone numbers, identity cards and the like, whether the parameters are empty or not and the like, if the verification is judged one by one aiming at each parameter, a logic code is judged to be extremely tedious, not attractive and not convenient to read. It can be known that the verification of the interface parameters is a pain point when the coding personnel writes the service interface, the verification work is large in workload, no specific service logic exists, and the technical content is low.
An existing interface parameter verification usually adopts an identification component as a common interface parameter verification component, but because the component still needs to write a large number of field verification programs, the problems of high error rate, poor verification effect, low efficiency and the like are caused, and the component still does not obtain most user support.
Disclosure of Invention
The invention provides an interface parameter checking method, an interface parameter checking device, electronic equipment and a computer readable storage medium, and mainly aims to improve the efficiency and accuracy of interface parameter checking.
In order to achieve the above object, the present invention provides an interface parameter checking method, including:
acquiring an interface parameter document, wherein the interface parameter document comprises a parameter entry field of an interface and an interface address corresponding to the interface;
analyzing the interface parameter document, acquiring an analysis result corresponding to the parameter entry field, and storing the analysis result and the interface address in an associated manner based on the interface;
traversing the analysis result based on a preset verification condition, acquiring a parameter field needing attribute conversion in the analysis result, converting the attribute of the parameter field needing attribute conversion into a corresponding verification judgment condition, and inputting the verification judgment condition into a verifier object;
according to a call instruction sent to the interface, starting interface parameter check logic in the checker object, and acquiring and checking a check judgment condition corresponding to the call instruction based on the interface parameter check logic;
and determining a parameter checking result corresponding to the interface according to the checking result of the checking judgment condition.
Preferably, the step of storing the interface parameter document in a block chain, the step of analyzing the interface parameter document, obtaining an analysis result corresponding to the parameter entry field, and storing the analysis result and the interface address in association includes:
defining the parameter input fields in the interface parameter document as objects, and forming an object set corresponding to the parameter input fields based on all the objects;
acquiring attributes of all the parameter fields in the object set;
and storing the attributes of all the parameter fields in association with the interface addresses of the corresponding interfaces.
Preferably, the attributes of the reference field include a definition field name, a field description, whether encrypted, length, type, format, whether padding is necessary, an enumerated value, a default value, whether checked, and a modification time.
Preferably, the preset verification condition includes whether to verify or not and attribute information that needs to be verified.
Preferably, the step of converting the attribute of the reference field in the parsing result into a corresponding checking judgment condition includes:
presetting a conversion rule, wherein the conversion rule adopts a preset conversion template or a conversion model trained on the basis of a neural network model;
storing the preset conversion rule and the analysis result simultaneously;
when the analysis result needs to be verified, converting the attribute of the parameter field in the analysis result based on the conversion rule, and acquiring a verification judgment condition corresponding to the attribute of the parameter field; the checking judgment condition comprises a parameter field value corresponding to the parameter field and the parameter field name.
Preferably, the converting the attribute of the reference field into the corresponding checking and judging condition includes:
the process of obtaining and verifying the verification judgment condition corresponding to the call instruction based on the interface parameter verification logic comprises the following steps:
calling a verification judgment condition in the verifier object based on the interface parameter verification logic;
and comparing the checking judgment condition with preset standard data to obtain a parameter checking result corresponding to the interface.
In order to solve the above problem, the present invention further provides an interface parameter calibration apparatus, including:
the device comprises a document acquisition unit, a document processing unit and a document processing unit, wherein the document acquisition unit is used for acquiring an interface parameter document, and the interface parameter document comprises a parameter entry field of an interface and an interface address corresponding to the interface;
the analysis result acquisition and storage unit is used for analyzing the interface parameter document, acquiring an analysis result corresponding to the parameter entry field and storing the analysis result and the interface address in an associated manner;
the verification judgment condition conversion unit is used for traversing the analysis result based on a preset verification condition, converting the attribute of the parameter field in the analysis result into a corresponding verification judgment condition and inputting the verification judgment condition into a verifier object;
an interface parameter obtaining unit, configured to start an interface parameter check logic in the checker object according to a call instruction sent to the interface, and obtain and check a check judgment condition corresponding to the call instruction based on the interface parameter check logic;
and the interface parameter checking unit is used for determining a parameter checking result corresponding to the interface according to the checking result of the checking judgment condition.
Preferably, the step of storing the interface parameter document in a block chain, the step of analyzing the interface parameter document, obtaining an analysis result corresponding to the parameter entry field, and storing the analysis result and the interface address in association includes:
defining the parameter input fields in the interface parameter document as objects, and forming an object set corresponding to the parameter input fields based on all the objects;
acquiring attributes of all the parameter fields in the object set;
and storing the attributes of all the parameter fields in association with the interface addresses of the corresponding interfaces.
In order to solve the above problem, the present invention also provides an electronic device, including:
a memory storing at least one instruction; and
and the processor executes the instructions stored in the memory to realize the interface parameter checking method.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, where at least one instruction is stored, and the at least one instruction is executed by a processor in an electronic device to implement the interface parameter checking method described above.
The embodiment of the invention can transfer the concerned point to the correctness of the interface parameter document when the interface verification development is carried out, and only the corresponding reference field document needs to be modified when the interface parameter is maintained, thereby reducing the workload and the error rate of the interface parameter verification and improving the speed and the universality of the interface parameter verification.
Drawings
Fig. 1 is a schematic flowchart of an interface parameter verification method according to an embodiment of the present invention;
fig. 2 is a schematic block diagram of an interface parameter checking apparatus according to an embodiment of the present invention;
fig. 3 is a schematic diagram of an internal structure of an electronic device implementing an interface parameter verification method according to an embodiment of the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides an interface parameter checking method. Fig. 1 is a schematic flow chart of an interface parameter verification method according to an embodiment of the present invention. The method may be performed by an apparatus, which may be implemented by software and/or hardware.
In this embodiment, the interface parameter checking method includes:
s110: and acquiring an interface parameter document, wherein the interface parameter document comprises a parameter input field of an interface and an interface address corresponding to the interface.
The field name, the field description, whether encryption, length, type, format, whether filling is necessary, an enumeration value, a default value, whether verification is performed, modification time and the like are defined in each entry field.
S120: and analyzing the interface parameter document, acquiring an analysis result corresponding to the parameter entry field, and storing the analysis result and the interface address in an associated manner based on the interface.
The method comprises the following steps of analyzing an interface parameter document, acquiring an analysis result corresponding to a parameter entry field, and storing the analysis result and an interface address in an associated manner, wherein the steps of analyzing the interface parameter document, acquiring the analysis result corresponding to the parameter entry field, and storing the analysis result and the interface address in the associated manner comprise:
1. defining the parameter input field in the interface parameter document as an object, and forming an object set corresponding to the parameter input field based on all the objects;
2. acquiring attributes of all the parameter fields in the object set; the attributes of the reference field include a definition field name, a field description, whether encryption is required, a length, a type, a format, whether padding is required, an enumerated value, a default value, whether verification is required, a modification time and the like.
3. And storing the attributes of all the parameter fields and the interface addresses of the corresponding interfaces in an associated manner.
The attribute can be associated with the interface address of the corresponding interface respectively, so that all attribute information of the parameter field corresponding to the interface can be accurately acquired when the interface is called subsequently, and data acquisition and storage are facilitated.
It is emphasized that, in order to further ensure the privacy and security of the interface parameter document, the interface parameter document may also be stored in a node of a blockchain.
S130: and traversing the analysis result based on a preset verification condition, acquiring the parameter field needing attribute conversion in the analysis result, converting the attribute of the parameter field needing attribute conversion into a corresponding verification judgment condition, and inputting the verification judgment condition into the verifier object.
In this step, the preset checking condition includes whether to check, attribute information that needs to be checked, and the like, the parameter entry field that needs to be subjected to attribute conversion in the analysis result is obtained, and the parameter entry field that needs to be subjected to attribute conversion is subjected to conversion processing.
Specifically, whether the field in the attribute information is verified or not can be used as a verification condition for verifying the logic or not, which fields need to be verified and which fields do not need to be verified can be set according to the importance degree of data or product requirements in the application process; if the verification is needed, converting the length, the type, the format, whether the field needs to be filled, the enumeration value, the default value and the like in the attribute corresponding to the field into corresponding preset verification judgment conditions, and otherwise, not performing conversion processing.
In addition, besides the attribute of "check or not" is adopted as the check condition, other check marks may be set in the attribute of each entry field, for example, a non-null check is set in the attribute information of each entry field, or a check field value is set in the entry field, and when the check field value is non-null, the check is performed, and when the check field value is null, the check is not performed.
Specifically, the step of converting the attribute of the entry field in the analysis result into the corresponding check judgment condition further includes:
1. presetting a conversion rule, wherein the conversion rule adopts a preset conversion template or a conversion model trained on the basis of a neural network model;
2. storing the preset conversion rule and the analysis result at the same time;
3. and when the analysis result needs to be verified, converting the attribute of the parameter field in the analysis result based on the conversion rule, and acquiring a verification judgment condition corresponding to the attribute of the parameter field, wherein the verification judgment condition comprises a parameter field value corresponding to the parameter field and a parameter field name.
For example, converting the length to a field length limit or a length range decision; converting the type into type judgment of the input parameter field; converting the format into a date judgment or a number judgment; converting the enumeration value into an enumeration range for judgment; convert default values to numerical determinations, and so on.
As a specific example, when the attribute of the entry field needs to be checked, the converting the attribute of the entry field into the check judgment condition may include: converting the length field to a field length limit or range; the enumeration value is directly converted into an enumeration range; the format conversion conditions are more, for example, date needs to be provided, the arrangement format of the date needs to be provided, such as YYYY-MM-DD or yyyymmdd, and the like, the date is converted into a date format judgment, and for example, a string identity card is provided, the format judgment of the identity card is provided, for example, the first 6 regional digits +19/20+2 digits + two digits of 1-12 (pre-zero padding) + two digits of 1-31 (pre-zero padding) +3 digits +1 digits or a character X; when the attribute is a type, the type conversion only needs to judge the type of the input parameter field.
It should be understood that the conversion of the verification determination condition may be set according to a specific application scenario or a customer requirement, and is not limited to the specific conversion manner described above.
S140: according to a call instruction sent to an interface, interface parameter check logic in a checker object is started, and a check judgment condition corresponding to the call instruction is acquired and checked based on the interface parameter check logic.
Specifically, the process of obtaining and verifying the verification judgment condition corresponding to the call instruction based on the interface parameter verification logic includes: calling a verification judgment condition in the verifier object based on the interface parameter verification logic; and then, comparing the checking judgment condition with preset standard data to obtain a parameter checking result corresponding to the interface.
The checker objects comprise at least one of a type checker, a necessity checker, a minimum data range checker, a maximum data range checker, a discrete data range checker, a regular checker and a custom checker. For example, the checker object may take the form of a variety of checkers, such as a Type checker, a Require checker, a Min checker, a Max checker, a Oneof checker, a Regexp checker, and a Custom checker. Of course, other types of basic checkers may be provided according to actual situations, and rewriting or overwriting may be performed on the basis of the basic checkers.
Specifically, the Type checker is used as a Type checker for checking whether the Type of the parameter entry field meets an expected value. The Type checker supports all basic types and built-in types of javascript languages. For example, setting the value of the Type checker of a certain parameter a to 'Number', if the Type of the parameter a passed at the time of the actual interface call is not a legal Number, the checker fails the check.
The Require checker is a necessity checker for checking whether the reference field is missing or whether the value is empty. If a Require checker is set for a certain attribute, the Require checker will consider the following as a check failure: the attribute values are null string, null, undefinided, Invalid Date, NaN, null array, and null object (objects without traversable attributes, e.g., { })
The Min checker is a data range checker for checking whether the value of the production promotion field is not less than a specified value. If the value of the Min checker is set to be 1, the verification is performed to determine whether the parameter field is not less than 1, and if the value of the parameter field is 0 or negative, the Min checker fails the verification.
The Max checker is also a data range checker for checking whether the value of the entry field is not greater than a specified value. The Oneof checker is also a data range checker, and is configured to specify a group of discrete valid values and determine whether an interface parameter in the entry field is one of the specified discrete valid values. For example: if the Oneof checker designates three colors of red, yellow, and blue, it is determined whether the reference field is one of the three colors.
The Regexp checker is a general-purpose type regular checker, and is used for checking whether the value of the reference field satisfies a specified regular expression, for example, the Regexp checker can be used for verifying whether the formats of a telephone number, a mailbox and the like in an interface meet expectations.
The Custom checker is a general type of Custom checker, and can accept a checking method in which a user can complete Custom checking work.
It should be noted that, a certain priority level may be set for each verifier object in the verification process, that is, a verification sequence of each verifier may be set, and the sequence may be set by itself according to a user requirement or an applicable scenario, so that a preset verification sequence may be adopted for verification when verifying the verification judgment condition.
In another embodiment of the present invention, when the field needs to be checked, the verification judgment condition may be checked by using a component kit of validity, for example, the verification judgment condition may be used as a parameter to call the component kit of validity to generate a verifier object, and the verifier object itself is stored in jvm and has a function of being readable and updatable at any time.
Wherein, the verifier object selects an identification tool, and the tool aggregates a plurality of verification methods, such as: whether the verification object, the length of the verification object (Array, Collection, Map, String) are within a given range, whether the Number and the String object are larger than or equal to a specified value and the like are verified.
In addition, rewriting or modifying the validation tool can be performed in a java code programming mode, for example, a verification logic in a time-date format can be written in the validation tool, and by using matching of regular expressions, during the verification process, only the following data need to be input into the verification logic: the format characters of YYYY-MM-DD HH: MM: ss or YYYYMMDDHHmmss and the like can carry out format check on the parameters of the date time class, and the method is the same as the conventional method calling mode. If the existing validation verification method is defective, the existing validation verification method can be rewritten, and the defects can be overcome in the rewritten method class by distinguishing different parameter types or quantities, and the rewritten method meets the existing requirements.
S150: and determining a parameter checking result corresponding to the interface according to the checking result of the checking judgment condition.
In the step, when the interface is called, each parameter field in the check judgment condition can be checked one by one, when a certain field is checked, a checker corresponding to the field is called, the parameter is used as an input parameter of a check method in the checker to start checking, after the checking is finished, a result can be returned to the interface, the corresponding log is written into an error message log of the interface, the log can be taken out when the interface result is returned to facilitate error information inquiry, and corresponding rules are prompted to fail, such as length inconsistency, type inconsistency and format inconsistency.
According to the interface parameter checking method provided by the invention, when interface checking development is carried out, the interface document is uploaded and downloaded for analysis, the field object set is traversed according to the analysis result, the attribute keywords in the object are converted into the checking judgment condition, then when the interface is called, the interface parameter information is obtained according to the checking judgment condition for checking, the attention point can be transferred to the correctness of the interface parameter document, when the interface parameter is maintained, only the corresponding reference field document needs to be modified, the workload and the error rate of interface parameter checking can be reduced, the speed and the universality of the interface parameter checking are improved, the checking speed is high, the accuracy is high, and the universality is high.
In another embodiment of the present invention, as shown in fig. 2, a functional block diagram of the interface parameter checking apparatus of the present invention is shown.
The interface parameter verification apparatus 100 according to the present invention may be installed in an electronic device. According to the implemented functions, the interface parameter checking device may include: a document acquisition unit 101, an analysis result acquisition and storage unit 102, a verification judgment condition conversion unit 103, a verification judgment condition verification unit 104, and an interface parameter verification unit 105. A module according to the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the document acquiring unit 101 is configured to acquire an interface parameter document, where the interface parameter document includes a parameter entry field of an interface and an interface address corresponding to the interface.
It is emphasized that, in order to further ensure the privacy and security of the interface parameter document, the interface parameter document may also be stored in a node of a blockchain.
An analysis result obtaining and storing unit 102, configured to perform analysis processing on the interface parameter document, obtain an analysis result corresponding to the parameter entry field, and perform associated storage on the analysis result and the interface address;
a verification judgment condition conversion unit 103, configured to traverse the analysis result based on a preset verification condition, convert the attribute of the reference field in the analysis result into a corresponding verification judgment condition, and input the verification judgment condition into a verifier object;
an interface parameter obtaining unit 104, configured to start an interface parameter checking logic in the checker object according to a call instruction sent to the interface, and obtain and check a checking judgment condition corresponding to the call instruction based on the interface parameter checking logic;
and an interface parameter checking unit 105, configured to determine a parameter checking result corresponding to the interface according to a checking result of the checking determination condition.
Fig. 3 is a schematic structural diagram of an electronic device implementing the interface parameter verification method according to the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as an interface parameter checking program 12, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only to store application software installed in the electronic device 1 and various types of data, such as codes of an interface parameter checking program, but also to temporarily store data that has been output or is to be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (e.g., interface parameter checking programs, etc.) stored in the memory 11 and calling data stored in the memory 11.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
Fig. 3 only shows an electronic device with components, it will be understood by a person skilled in the art that the structure shown in fig. 2 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
For example, although not shown, the electronic device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so as to implement functions of charge management, discharge management, power consumption management, and the like through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Further, the electronic device 1 may further include a network interface, and optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), which are generally used for establishing a communication connection between the electronic device 1 and other electronic devices.
Optionally, the electronic device 1 may further comprise a user interface, which may be a Display (Display), an input unit (such as a Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The interface parameter checking program 12 stored in the memory 11 of the electronic device 1 is a combination of instructions, which when executed in the processor 10, can implement:
acquiring an interface parameter document, wherein the interface parameter document comprises a parameter entry field of an interface and an interface address corresponding to the interface;
analyzing the interface parameter document, acquiring an analysis result corresponding to the parameter entry field, and performing associated storage on the analysis result and the interface address;
traversing the analysis result based on a preset verification condition, converting the attribute of the parameter field in the analysis result into a corresponding verification judgment condition, and inputting the verification judgment condition into a verifier object;
according to a call instruction sent to the interface, starting interface parameter check logic in the checker object, and acquiring and checking a check judgment condition corresponding to the call instruction based on the interface parameter check logic;
and determining a parameter checking result corresponding to the interface according to the checking result of the checking judgment condition.
Preferably, the step of storing the interface parameter document in a block chain, the step of analyzing the interface parameter document, obtaining an analysis result corresponding to the parameter entry field, and storing the analysis result and the interface address in association includes:
defining the parameter input fields in the interface parameter document as objects, and forming an object set corresponding to the parameter input fields based on all the objects;
acquiring attributes of all the parameter fields in the object set;
and storing the attributes of all the parameter fields in association with the interface addresses of the corresponding interfaces.
Preferably, the attributes of the reference field include a definition field name, a field description, whether encrypted, length, type, format, whether padding is necessary, an enumerated value, a default value, whether checked, and a modification time.
Preferably, the preset verification condition includes whether to verify or not and attribute information that needs to be verified.
Preferably, the step of converting the attribute of the reference field in the parsing result into a corresponding checking judgment condition includes:
presetting a conversion rule, wherein the conversion rule adopts a preset conversion template or a conversion model trained on the basis of a neural network model;
storing the preset conversion rule and the analysis result simultaneously;
when the analysis result needs to be verified, converting the attribute of the parameter field in the analysis result based on the conversion rule, and acquiring a verification judgment condition corresponding to the attribute of the parameter field; the checking judgment condition comprises a parameter field value corresponding to the parameter field and the parameter field name.
Preferably, the converting the attribute of the reference field into the corresponding checking and judging condition includes:
the process of obtaining and verifying the verification judgment condition corresponding to the call instruction based on the interface parameter verification logic comprises the following steps:
calling a verification judgment condition in the verifier object based on the interface parameter verification logic;
and comparing the checking judgment condition with preset standard data to obtain a parameter checking result corresponding to the interface.
Preferably, the checker object includes at least one of a type checker, a necessity checker, a minimum data range checker, a maximum data range checker, a discrete data range checker, a regular checker, and a custom checker.
Specifically, the specific implementation method of the processor 10 for the instruction may refer to the description of the relevant steps in the embodiment corresponding to fig. 1, which is not described herein again. It is emphasized that, in order to further ensure the privacy and security of the interface parameter document, the interface parameter document may also be stored in a node of a blockchain. Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. An interface parameter verification method, the method comprising:
acquiring an interface parameter document, wherein the interface parameter document comprises a parameter entry field of an interface and an interface address corresponding to the interface;
analyzing the interface parameter document, acquiring an analysis result corresponding to the parameter entry field, and storing the analysis result and the interface address in an associated manner based on the interface;
traversing the analysis result based on a preset verification condition, acquiring a parameter field needing attribute conversion in the analysis result, converting the attribute of the parameter field needing attribute conversion into a corresponding verification judgment condition, and inputting the verification judgment condition into a verifier object;
according to a call instruction sent to the interface, starting interface parameter check logic in the checker object, and acquiring and checking a check judgment condition corresponding to the call instruction based on the interface parameter check logic;
and determining a parameter checking result corresponding to the interface according to the checking result of the checking judgment condition.
2. The method for checking interface parameters according to claim 1, wherein the interface parameter document is stored in a block chain, and the step of parsing the interface parameter document to obtain a parsing result corresponding to the entry field and storing the parsing result and the interface address in association with each other includes:
defining the parameter input fields in the interface parameter document as objects, and forming an object set corresponding to the parameter input fields based on all the objects;
acquiring attributes of all the parameter fields in the object set;
and storing the attributes of all the parameter fields in association with the interface addresses of the corresponding interfaces.
3. The interface parameter verification method of claim 1,
the attributes of the reference field include a definition field name, a field description, whether encryption is required, a length, a type, a format, whether padding is required, an enumerated value, a default value, whether verification is required, and a modification time.
4. The interface parameter verification method of claim 3,
the preset checking condition comprises whether checking is performed or not and attribute information needing checking.
5. The interface parameter verification method according to claim 2, wherein the step of converting the attribute of the entry field in the parsing result into the corresponding verification judgment condition includes:
presetting a conversion rule, wherein the conversion rule adopts a preset conversion template or a conversion model trained on the basis of a neural network model;
storing the preset conversion rule and the analysis result simultaneously;
when the analysis result needs to be verified, converting the attribute of the parameter field in the analysis result based on the conversion rule, and acquiring a verification judgment condition corresponding to the attribute of the parameter field; the checking judgment condition comprises a parameter field value corresponding to the parameter field and the parameter field name.
6. The interface parameter verification method of claim 5,
the process of obtaining and verifying the verification judgment condition corresponding to the call instruction based on the interface parameter verification logic comprises the following steps:
calling a verification judgment condition in the verifier object based on the interface parameter verification logic;
and comparing the checking judgment condition with preset standard data to obtain a parameter checking result corresponding to the interface.
7. An interface parameter verification apparatus, comprising:
the device comprises a document acquisition unit, a document processing unit and a document processing unit, wherein the document acquisition unit is used for acquiring an interface parameter document, and the interface parameter document comprises a parameter entry field of an interface and an interface address corresponding to the interface;
the analysis result acquisition and storage unit is used for analyzing the interface parameter document, acquiring an analysis result corresponding to the parameter entry field and storing the analysis result and the interface address in an associated manner;
the verification judgment condition conversion unit is used for traversing the analysis result based on a preset verification condition, converting the attribute of the parameter field in the analysis result into a corresponding verification judgment condition and inputting the verification judgment condition into a verifier object;
an interface parameter obtaining unit, configured to start an interface parameter check logic in the checker object according to a call instruction sent to the interface, and obtain and check a check judgment condition corresponding to the call instruction based on the interface parameter check logic;
and the interface parameter checking unit is used for determining a parameter checking result corresponding to the interface according to the checking result of the checking judgment condition.
8. The interface parameter verification apparatus according to claim 7, wherein the interface parameter document is stored in a block chain, and the step of parsing the interface parameter document, obtaining a parsing result corresponding to the entry field, and storing the parsing result and the interface address in association with each other includes:
defining the parameter input fields in the interface parameter document as objects, and forming an object set corresponding to the parameter input fields based on all the objects;
acquiring attributes of all the parameter fields in the object set;
and storing the attributes of all the parameter fields in association with the interface addresses of the corresponding interfaces.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the steps of the interface parameter checking method according to any one of claims 1 to 7.
10. A computer-readable storage medium, storing a computer program, wherein the computer program, when executed by a processor, implements the interface parameter checking method according to any one of claims 1 to 6.
CN202011457956.6A 2020-12-11 2020-12-11 Interface parameter checking method and device and computer readable storage medium Pending CN112579055A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011457956.6A CN112579055A (en) 2020-12-11 2020-12-11 Interface parameter checking method and device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011457956.6A CN112579055A (en) 2020-12-11 2020-12-11 Interface parameter checking method and device and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN112579055A true CN112579055A (en) 2021-03-30

Family

ID=75132116

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011457956.6A Pending CN112579055A (en) 2020-12-11 2020-12-11 Interface parameter checking method and device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112579055A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407469A (en) * 2021-06-10 2021-09-17 浙江华创视讯科技有限公司 Parameter configuration method and device, storage medium and electronic device
CN116956330A (en) * 2023-09-18 2023-10-27 中信消费金融有限公司 Data verification method, device, equipment and storage medium
CN117707653A (en) * 2024-02-06 2024-03-15 天津医康互联科技有限公司 Parameter monitoring method, device, electronic equipment and computer readable storage medium
CN118069539A (en) * 2024-04-19 2024-05-24 建信金融科技有限责任公司 Data processing method, device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107766040A (en) * 2017-09-19 2018-03-06 深圳市买买提乐购金融服务有限公司 A kind of method, apparatus and computer-readable recording medium for generating interface document
CN109766264A (en) * 2018-12-15 2019-05-17 深圳壹账通智能科技有限公司 Method of calibration, device, computer equipment and the storage medium of interface parameters
CN111478969A (en) * 2020-04-09 2020-07-31 吉林亿联银行股份有限公司 Interface checking method and device
CN111694572A (en) * 2020-05-27 2020-09-22 平安普惠企业管理有限公司 Code format conversion method, device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107766040A (en) * 2017-09-19 2018-03-06 深圳市买买提乐购金融服务有限公司 A kind of method, apparatus and computer-readable recording medium for generating interface document
CN109766264A (en) * 2018-12-15 2019-05-17 深圳壹账通智能科技有限公司 Method of calibration, device, computer equipment and the storage medium of interface parameters
CN111478969A (en) * 2020-04-09 2020-07-31 吉林亿联银行股份有限公司 Interface checking method and device
CN111694572A (en) * 2020-05-27 2020-09-22 平安普惠企业管理有限公司 Code format conversion method, device, computer equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407469A (en) * 2021-06-10 2021-09-17 浙江华创视讯科技有限公司 Parameter configuration method and device, storage medium and electronic device
CN113407469B (en) * 2021-06-10 2023-04-07 浙江华创视讯科技有限公司 Parameter configuration method and device, storage medium and electronic device
CN116956330A (en) * 2023-09-18 2023-10-27 中信消费金融有限公司 Data verification method, device, equipment and storage medium
CN117707653A (en) * 2024-02-06 2024-03-15 天津医康互联科技有限公司 Parameter monitoring method, device, electronic equipment and computer readable storage medium
CN117707653B (en) * 2024-02-06 2024-05-10 天津医康互联科技有限公司 Parameter monitoring method, device, electronic equipment and computer readable storage medium
CN118069539A (en) * 2024-04-19 2024-05-24 建信金融科技有限责任公司 Data processing method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN112579055A (en) Interface parameter checking method and device and computer readable storage medium
CN112148577B (en) Data anomaly detection method and device, electronic equipment and storage medium
WO2021189899A1 (en) Link state tracking method and apparatus, and electronic device and computer storage medium
CN113434674A (en) Data analysis method and device, electronic equipment and readable storage medium
CN112115145A (en) Data acquisition method and device, electronic equipment and storage medium
CN112883042A (en) Data updating and displaying method and device, electronic equipment and storage medium
CN112364107A (en) System analysis visualization method and device, electronic equipment and computer readable storage medium
CN112115143A (en) Automatic data updating and synchronizing method and device, electronic equipment and storage medium
CN114398194A (en) Data collection method and device, electronic equipment and readable storage medium
CN111639857B (en) Order intelligent auditing method and device, electronic equipment and storage medium
CN114610747A (en) Data query method, device, equipment and storage medium
CN113489704A (en) Sensitive data identification method and device based on flow, electronic equipment and medium
CN113176968A (en) Safety test method, device and storage medium based on interface parameter classification
CN112486957B (en) Database migration detection method, device, equipment and storage medium
CN112637341B (en) File uploading method and device, electronic equipment and storage medium
CN113434542A (en) Data relation identification method and device, electronic equipment and storage medium
CN112541688A (en) Service data checking method and device, electronic equipment and computer storage medium
CN111651292A (en) Data verification method and device, electronic equipment and computer readable storage medium
CN115544566A (en) Log desensitization method, device, equipment and storage medium
CN114547011A (en) Data extraction method and device, electronic equipment and storage medium
WO2022110647A1 (en) Risk control data generation method and apparatus, device, and computer readable storage medium
CN113377857A (en) Data distribution method and device, electronic equipment and readable storage medium
CN112506931A (en) Data query method and device, electronic equipment and storage medium
CN111859452A (en) Page information checking method, device and equipment and computer readable storage medium
CN111738005A (en) Named entity alignment method and device, electronic equipment and readable 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