CN114090294A - Json-based interaction and verification method, system and equipment - Google Patents

Json-based interaction and verification method, system and equipment Download PDF

Info

Publication number
CN114090294A
CN114090294A CN202111394641.6A CN202111394641A CN114090294A CN 114090294 A CN114090294 A CN 114090294A CN 202111394641 A CN202111394641 A CN 202111394641A CN 114090294 A CN114090294 A CN 114090294A
Authority
CN
China
Prior art keywords
json
data
request
general transmission
transmission data
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
CN202111394641.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.)
Haoyun Technologies Co Ltd
Original Assignee
Haoyun Technologies 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 Haoyun Technologies Co Ltd filed Critical Haoyun Technologies Co Ltd
Priority to CN202111394641.6A priority Critical patent/CN114090294A/en
Publication of CN114090294A publication Critical patent/CN114090294A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/541Interprogram communication via adapters, e.g. between incompatible applications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the technical field of computers, in particular to a json-based interaction and verification method, system and equipment, which comprises the following steps: defining json general transmission data in advance through business modeling; receiving a hypertext transfer protocol request, and reading corresponding json general transmission data; analyzing json general transmission data to obtain request parameters; analyzing the request parameters to obtain a reference description; checking whether the entry description is legal or not, if so, executing service logic and returning the obtained request result data; if not, directly returning to the exception; the method solves the problems that the prior interface definition requires the front-end developer and the rear-end developer to jointly define, develop and butt joint, which not only causes heavy development workload, but also increases the communication cost of the developers.

Description

Json-based interaction and verification method, system and equipment
Technical Field
The invention relates to the technical field of computers, in particular to a json-based interaction and verification method, system and equipment.
Background
At present, as business functions required to be processed by front-end and back-end developers are more and more, interfaces for docking are gradually increased, however, the traditional interface definition usually requires the front-end developer and the back-end developer to coordinate and develop docking together, which not only results in heavy development workload, but also increases communication cost of the developers, thereby resulting in long development period, low efficiency and waste of manpower.
Disclosure of Invention
The invention provides an interaction and verification method, system and device based on json, and solves the technical problems that the existing interface definition needs a front-end developer and a back-end developer to define, develop and butt joint together, which not only causes heavy development workload, but also increases the communication cost of the developers.
In order to solve the technical problems, the invention provides an interaction and verification method, system and device based on json.
In a first aspect, the present invention provides a json-based interaction and verification method, including the following steps:
defining json general transmission data in advance through business modeling;
receiving a hypertext transfer protocol request, and reading corresponding json general transmission data according to the hypertext transfer protocol request;
analyzing the json general transmission data to obtain a request parameter;
analyzing the request parameters to obtain a reference description;
checking whether the access description is legal or not, if so, executing service logic and returning the obtained request result data; if not, the exception is directly returned.
In a further embodiment, the request parameters include an incoming reference description and an outgoing reference description.
In a further embodiment, the step of checking whether the reference description is legitimate comprises:
checking the maximum length of the input field and the type of the object in the reference description, and if the check is passed, indicating that the input field is legal; if the verification fails, the result is illegal.
In a further embodiment, the request result data includes the in-reference description and the out-reference description.
In further embodiments, the method further comprises: and acquiring corresponding json general transmission data according to the request result data, and filling the acquired json general transmission data into corresponding data configuration controls.
In a further embodiment, the data format of the request result data is identical to the data format of the json general transmission data.
In a second aspect, the present invention provides a json-based interaction and verification system, where the system includes:
the data definition module is used for predefining json general transmission data through business modeling;
the data receiving module is used for receiving a hypertext transfer protocol request and reading corresponding json general transmission data according to the hypertext transfer protocol request;
the data processing module is used for analyzing the json general transmission data to obtain request parameters and analyzing the request parameters to obtain the access description;
the data checking module is used for checking whether the access description is legal or not, if so, executing service logic and returning the obtained request result data; if not, directly returning to the exception.
In a further embodiment, the data checking module specifically includes:
checking the maximum length of the input field and the type of the object in the reference description, and if the check is passed, indicating that the input field is legal; if the verification fails, the result is illegal. .
In a third aspect, the present invention further provides a computer device, including a processor and a memory, where the processor is connected to the memory, the memory is used for storing a computer program, and the processor is used for executing the computer program stored in the memory, so that the computer device executes the steps for implementing the method.
The invention provides a json-based interaction and verification method, a json-based interaction and verification system and json-based interaction and verification equipment, and the technical scheme of freely adding json data definition attribute description to meet different request data is realized through the method. Compared with the prior art, the method provides a unified interface docking method independent of the front-end and back-end development progress through unified json general transmission data, and developers do not need to define each interface independently; by adopting the technical scheme provided by the invention, the verification work can be reduced, and the development of a plurality of and complicated interfaces can be reduced, thereby simplifying the development process.
Drawings
Fig. 1 is a schematic flowchart of an interaction and verification method based on json according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a json-based interaction and verification system according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The embodiments of the present invention will be described in detail below with reference to the accompanying drawings, which are given solely for the purpose of illustration and are not to be construed as limitations of the invention, including the drawings which are incorporated herein by reference and for illustration only and are not to be construed as limitations of the invention, since many variations thereof are possible without departing from the spirit and scope of the invention.
Aiming at the problems that the existing interface definition requires the front-end developer and the back-end developer to jointly define, develop and dock, which not only causes heavy development workload, but also increases communication cost of the developers, the embodiment of the invention provides a json-based interaction and verification method, as shown in fig. 1, which comprises the following steps:
s1, defining json general transmission data in advance through business modeling.
In this embodiment, a user sends a data generation request to a data modeling unit, the data modeling unit obtains a role information table according to the data generation request, and sends the role information table to a service modeling unit, the service modeling unit generates json general transmission data according to data definitions such as the role information table, and sends the json general transmission data to a page modeling unit, the page modeling unit binds the generated json general transmission data with a corresponding data configuration control, which is an example of a defined json general transmission data format:
Figure BDA0003369571410000041
Figure BDA0003369571410000051
and S2, receiving a hypertext transfer protocol request, and reading corresponding json general transmission data according to the hypertext transfer protocol request.
And S3, analyzing the json general transmission data to obtain request parameters.
In an embodiment, the request parameter includes an entry description and an exit description, in this embodiment, communication cost of front-end and back-end developers can be reduced by entry and exit in the request parameter, and different service functions are implemented by different descriptions, for example: the maximum length of the decimal place can be limited by adding the decimal place attribute.
And S4, analyzing the request parameters to obtain the access parameter description.
S5, checking whether the access reference description is legal or not, if so, executing service logic, and returning the obtained request result data; if not, directly returning to the exception.
The request result data comprises the input reference description and the output reference description, and the data format of the request result data is consistent with that of the json general transmission data.
In one embodiment, the step of checking whether the access description is legal includes:
checking the maximum length of the input field and the type of the object in the reference description, and if the check is passed, indicating that the input field is legal; if the verification is not passed, the result is illegal.
In this embodiment, an errorMsg attribute is added, so that when the entry description is verified, if the verification fails, the attribute value is unified, and abnormal information is thrown to the front-end developer.
In one embodiment, the method further comprises: and acquiring corresponding json general transmission data according to the request result data, and filling the acquired json general transmission data into the corresponding data configuration control.
In this embodiment, after receiving a hypertext transfer protocol (http) request, a server reads corresponding json general transmission data, analyzes and verifies the json general transmission data, normally executes service logic after verification is passed, and returns corresponding request result data to a service modeling unit according to a specified transmission protocol, the service modeling unit receives the request result data according to a format of the json general transmission data, and fills the returned request result data into corresponding data configuration controls according to the corresponding json transmission protocol to complete an http request.
According to the json-based interaction and verification method provided by the embodiment, json general transmission data is defined through business modeling, a page binds corresponding data configuration controls according to the defined json general transmission data, meanwhile, a server reads the corresponding json general transmission data after receiving a hypertext transfer protocol request, and verifies and analyzes the read json general transmission data.
It should be noted that, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic of the process, and should not constitute any limitation to the implementation process of the embodiment of the present application.
In an embodiment, as shown in fig. 2, this embodiment provides a json-based interaction and verification system, where the system includes:
the data definition module 101 is used for predefining json general transmission data through business modeling;
the data receiving module 102 is configured to receive a hypertext transfer protocol request, and read corresponding json general transmission data according to the hypertext transfer protocol request;
the data processing module 103 is configured to analyze the json general transmission data to obtain a request parameter, and analyze the request parameter to obtain a reference description;
a data checking module 104, configured to check whether the entry description is legal, and if so, execute a service logic and return the obtained request result data; if not, directly returning to the exception.
In one embodiment, the data verification module specifically includes:
checking the maximum length of the input field and the type of the object in the reference description, and if the check is passed, indicating that the input field is legal; if the verification fails, the verification is illegal;
if the request is legal, executing service logic and returning the obtained request result data; if the operation is illegal, the operation returns to the exception directly.
For a specific limitation of a json-based interaction and verification system, reference may be made to the above-mentioned limitation on a json-based interaction and verification method, which is not described herein again. Those of ordinary skill in the art will appreciate that the various modules and steps described in connection with the embodiments disclosed herein may be implemented as hardware, software, or combinations of both. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
Compared with the prior art, the json general transmission data are uniformly defined through the data definition module, the json general transmission data corresponding to the http request are selected through the data receiving module, the data processing module and the data verification module verify and analyze the json general transmission data, and the corresponding data are returned to the page; the system provided by the embodiment of the invention can reduce a lot of unnecessary errors by defining the uniform transmission format of the front-end and back-end developers, can clearly know the input parameter data, the output parameter data, the data type and the like of the interface through the data format defined by the embodiment of the invention, and reduces the management cost.
FIG. 3 is a computer device including a memory, a processor, and a transceiver connected via a bus according to an embodiment of the present invention; the memory is used to store a set of computer program instructions and data and may transmit the stored data to the processor, which may execute the program instructions stored by the memory to perform the steps of the above-described method.
Wherein the memory may comprise volatile memory or nonvolatile memory, or may comprise both volatile and nonvolatile memory; the processor may be a central processing unit, a microprocessor, an application specific integrated circuit, a programmable logic device, or a combination thereof. By way of example, and not limitation, the programmable logic devices described above may be complex programmable logic devices, field programmable gate arrays, general array logic, or any combination thereof.
In addition, the memory may be a physically separate unit or may be integrated with the processor.
It will be appreciated by those of ordinary skill in the art that the architecture shown in fig. 3 is a block diagram of only a portion of the architecture associated with the present solution and is not intended to limit the computing devices to which the present solution may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have the same arrangement of components.
In the interaction and verification method, system and device based on json provided by the embodiment of the invention, the configuration and verification of different functions are realized by adding the json attribute in the interaction and verification method based on json, the expansibility is stronger, and the legality of data is ensured; meanwhile, the embodiment reduces the time cost and the development cost for communication of front-end and back-end developers and reduces the investment of development resources by unified and standardized processing of the interfaces.
The above-mentioned embodiments only express some preferred embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for those skilled in the art, various modifications and substitutions can be made without departing from the technical principle of the present invention, and these should be construed as the protection scope of the present application. Therefore, the protection scope of the present patent shall be subject to the protection scope of the claims.

Claims (9)

1. A json-based interaction and verification method is characterized by comprising the following steps:
defining json general transmission data in advance through business modeling;
receiving a hypertext transfer protocol request, and reading corresponding json general transmission data according to the hypertext transfer protocol request;
analyzing the json general transmission data to obtain a request parameter;
analyzing the request parameter to obtain a reference description;
checking whether the access description is legal or not, if so, executing service logic and returning the obtained request result data; if not, directly returning to the exception.
2. The json-based interaction and verification method of claim 1, wherein: the request parameters include an entry description and an exit description.
3. The json-based interaction and verification method of claim 1, wherein the step of verifying whether the participation description is legitimate comprises:
checking the maximum length of the input field and the object type in the reference description, and if the check is passed, indicating that the input field is legal; if the verification fails, the result is illegal.
4. The json-based interaction and verification method of claim 2, wherein: the request result data includes the incoming reference description and the outgoing reference description.
5. The json-based interaction and verification method of claim 1, further comprising: and acquiring corresponding json general transmission data according to the request result data, and filling the acquired json general transmission data into the corresponding data configuration control.
6. The json-based interaction and verification method of claim 1, wherein: and the data format of the request result data is consistent with the data format of the json general transmission data.
7. A json-based interaction and verification system, the system comprising:
the data definition module is used for predefining json general transmission data through business modeling;
the data receiving module is used for receiving a hypertext transfer protocol request and reading corresponding json general transmission data according to the hypertext transfer protocol request;
the data processing module is used for analyzing the json general transmission data to obtain a request parameter and analyzing the request parameter to obtain a reference description;
the data checking module is used for checking whether the access description is legal or not, if so, executing service logic and returning the obtained request result data; if not, directly returning to the exception.
8. The json-based interaction and verification system of claim 7, wherein the data verification module is specifically configured to:
checking the maximum length of the input field and the type of the object in the reference description, and if the check is passed, indicating that the input field is legal; if the verification fails, the result is illegal.
9. A computer device, characterized by: comprising a processor coupled to a memory for storing a computer program and a memory for executing the computer program stored in the memory to cause the computer device to perform the method of any of claims 1 to 6.
CN202111394641.6A 2021-11-23 2021-11-23 Json-based interaction and verification method, system and equipment Pending CN114090294A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111394641.6A CN114090294A (en) 2021-11-23 2021-11-23 Json-based interaction and verification method, system and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111394641.6A CN114090294A (en) 2021-11-23 2021-11-23 Json-based interaction and verification method, system and equipment

Publications (1)

Publication Number Publication Date
CN114090294A true CN114090294A (en) 2022-02-25

Family

ID=80303571

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111394641.6A Pending CN114090294A (en) 2021-11-23 2021-11-23 Json-based interaction and verification method, system and equipment

Country Status (1)

Country Link
CN (1) CN114090294A (en)

Similar Documents

Publication Publication Date Title
CN110310205B (en) Block chain data monitoring method, device, equipment and medium
CN111143087B (en) Interface calling method, device, storage medium and server
CN108462760B (en) Electronic device, automatic cluster access domain name generation method and storage medium
CN105302710A (en) Method and apparatus for determining test case in need of regression testing
CN110784450A (en) Single sign-on method and device based on browser
CN111428462A (en) Communication protocol template construction method and terminal equipment
CN111988337B (en) Authority management method and system
CN110601880A (en) Cloud platform, service processing method, command interface and computer equipment
CN109902493B (en) Script issuing method and server
CN110968437A (en) Method, device, equipment and medium for parallel execution of single contract based on Java intelligent contract
CN109739700B (en) Interface testing method and device
CN112579453A (en) Task testing method, device, equipment and storage medium
CN108427639B (en) Automated testing method, application server and computer readable storage medium
CN110213250B (en) Data processing method and terminal equipment
KR101369776B1 (en) Apparatus and system of enterprise management of static analysis tools
CN114157654A (en) Integrated circuit collaborative design system and method
CN113177014A (en) Serial port communication method based on inspection mode and serial port chip
CN113497735B (en) Management method of open interface, electronic device and storage medium
CN111447273B (en) Cloud processing system and data processing method based on cloud processing system
CN114090294A (en) Json-based interaction and verification method, system and equipment
CN102612683A (en) Maintaining data integrity across execution environments
CN109324838B (en) Execution method and execution device of single chip microcomputer program and terminal
CN109800565B (en) Software upgrading method and terminal equipment
US9639636B1 (en) Algorithmically driven selection of parallelization technique for running model simulation
US11057416B2 (en) Analyze code that uses web framework using local parameter model

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