Data type checking method of low-code system and program product
Through the introduction of access agents in the low -code system for data type examination, the type error problem of type error in the low -code platform due to the weak type of JavaScript type is improved, and the reliability of the code and the overall quality of the application are improved.
Patent Information
- Application Number
- CN202411897627.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-01-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the page logic, the existing low-code/no-code development platform cannot determine the data type of the variable at runtime due to the weak type and dynamic type characteristics of JavaScript, which can easily cause type errors and is difficult to debug.
Through the introduction of access agents in the low -code system, obtain the declaration data corresponding to the operation data, and check the data type before running the module to perform the operation data. If the data type is inconsistent, the output type is wrong.
It improves the reliability and robustness of the code, reduces the possibility of runtime errors, and ensures runtime type safety, thus improving the overall quality of the application.
Smart Images

Figure CN119357018A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software engineering, and specifically, to a data type checking method and program product for a low-code system. Background Art
[0002] Low-Code / No-Code Development Platforms are becoming increasingly popular in the software development process. These platforms allow users to build applications through a visual interface and drag-and-drop components without having to write a lot of code. These platforms usually include a logic designer to help users visually design and arrange page logic. In the logic designer, users can define variables or entry and exit parameters, as well as the data flow between them.
[0003] Existing low-code / no-code development platforms generally use custom description languages to build models, and in Web scenarios, the custom description languages are converted into HTML and JavaScript for page display through parsing engines. Due to the weak type and dynamic type characteristics of the JavaScript language itself, the data type of the variables declared in the page logic cannot be determined at design time, and will only be determined at runtime, which means that different types of data can be assigned to the same variable without causing type errors. This dynamic type approach can easily cause type errors and is difficult to debug. Summary of the invention
[0004] The purpose of this application is to provide a data type checking method and program product for a low-code system, which is used to improve the reliability and robustness of the code and reduce the possibility of runtime errors.
[0005] In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows: In a first aspect, an embodiment of the present application provides a data type checking method for a low-code system, including: When the operation data is obtained, obtaining declaration data corresponding to the operation data by accessing the agent; Determining whether the data types of the operation data and the declaration data are consistent; If they are inconsistent, a type error prompt will be output through the interactive interface; If they are consistent, the operation corresponding to the operation data is executed through the running module.
[0006] Optionally, before the step of obtaining declaration data corresponding to the operation data by accessing the proxy, the method further includes: Obtain page logic and variable data through the low-code designer; Configuring the data type of the variable data through the low-code designer; A metadata file of the declaration data is constructed by using the page logic, the variable data and the data type of the variable data.
[0007] Optionally, after constructing the metadata file of the declaration data by using the page logic, the variable data and the data type of the variable data, the method further includes: Parsing the metadata file of the declaration data through a parsing module of a low-code engine to obtain the declaration data; A corresponding access agent is created for the declaration data; the access agent is used to intercept operations on the declaration data when the page logic is running.
[0008] Optionally, the step of obtaining declaration data corresponding to the operation data by accessing the agent includes: Intercepting, by the access proxy, an operation on target declaration data in the page logic; the operation includes target operation data; the target declaration data belongs to the declaration data; obtaining identification information of the target operation data through a target access agent; the target access agent corresponds to the target operation data; the target access agent belongs to the access agent; The target declaration data is determined according to the identification information.
[0009] In a second aspect, an embodiment of the present application provides a data type checking device for a low-code system, including: an access agent, an interactive interface, and an operation module; The access agent is used to obtain declaration data corresponding to the operation data when obtaining the operation data; and to determine whether the data types of the operation data and the declaration data are consistent; The interactive interface is used to output a type error prompt when the data types are inconsistent; The operation module is used to execute the operation corresponding to the operation data when the data types are consistent.
[0010] Optionally, the device further comprises: a low-code designer; The low-code designer is used to obtain page logic and variable data; configure the data type of the variable data; and construct a metadata file of the declaration data through the page logic, the variable data and the data type of the variable data.
[0011] Optionally, the device also includes: the parsing module is also used to parse the metadata file of the declaration data to obtain the declaration data; create a corresponding access agent for the declaration data; the access agent is used to intercept operations on the declaration data when the page logic is running.
[0012] Optionally, the access agent is specifically used to intercept operations on target declaration data in the page logic; the operation contains target operation data; the target declaration data belongs to the declaration data; obtain identification information of the target operation data; the target access agent corresponds to the target operation data; the target access agent belongs to the access agent; and determine the target declaration data based on the identification information.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, including: A memory for storing one or more programs; processor; When the one or more programs are executed by the processor, the method as described in any one of the first aspects above is implemented.
[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method as described in any one of the above-mentioned first aspects.
[0015] In a fifth aspect, an embodiment of the present application provides a program product, which, when executed by a processor, implements a method as described in any one of the above-mentioned first aspects.
[0016] Compared with the prior art, the data type checking method and program product of a low-code system provided in the embodiment of the present application preferentially completes the data type checking of the operation data and the declaration data before the operation module executes the operation data, and prompts the inconsistency of the data type. This improves the reliability and robustness of the code and reduces the possibility of runtime errors. By ensuring the type safety at runtime, the overall quality of the application is improved.
[0017] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 An architectural diagram of a low-code system provided for existing technologies; Figure 2 A schematic diagram of the architecture of a low-code system provided for an embodiment of the present invention; Figure 3 A flowchart of a data type checking method for a low-code system provided in an embodiment of the present invention; Figure 4 A schematic diagram of the architecture of a low-code system provided for an embodiment of the present invention; Figure 5 A flowchart of another method for checking data types in a low-code system provided by an embodiment of the present invention; Figure 6 A schematic diagram of a data type checking device for a low-code system provided by an embodiment of the present invention; Figure 7 A schematic diagram of another data type checking device for a low-code system provided by an embodiment of the present invention; Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0021] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0022] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0023] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0024] In the existing technology, although low-code / no-code development platforms simplify the application development process, it is difficult for the user groups targeted by low-code platforms to make accurate logical judgments on variables through program codes like professional coders. Figure 1 A schematic diagram of the architecture of a low-code system provided for existing technologies, see Figure 1 The system includes: a low-code designer, an interactive interface, and a low-code engine; specifically, the low-code engine also includes a parsing module and an operation module.
[0025] The use of this low-code system includes two stages: the code design stage and the code operation stage.
[0026] For the "Code Design Phase": First, users design or build applications and front-end pages through the low-code designer. At this point, users can enter the "page logic" and the data type of variable data, such as the data type of input and output parameters. The low-code designer persists the above declaration-related metadata files in the form of JSON files.
[0027] For the "Code Running Phase": At runtime, the "declaration-related metadata file" is parsed by the parsing module of the low-code engine to obtain declaration data, such as data type, identifier, and other information.
[0028] The user enters the target operation data (actual parameters) through the interactive interface, that is, declares the actual input value of the corresponding data. The interactive interface obtains the "scheduling-related metadata file" based on the target operation data. Then, the "scheduling-related metadata file" is parsed by the parsing module to obtain the target operation data.
[0029] At this time, the declaration data and target operation data are input into the operation module for operation.
[0030] However, the existing technology does not perform strict data type checking during runtime, resulting in the data type assigned to the variable being inconsistent with the data type declared by the variable, which in turn leads to runtime errors. At this time, the runtime error may not clearly indicate the cause of the error, thereby reducing the stability and reliability of the program.
[0031] For example, when the program parses the declared data, the data type is parsed according to "Type 1" and the instance method a unique to "Type 1" is called. However, during actual operation, the data type of the operation data actually received by the program is "Type 2". "Instance method a" does not exist for "Type 2", so during operation, the program will report an error "Instance method a does not exist"; or, even if "Instance method a" exists, the instance methods of "Type 1" and "Type 2" still have differences in implementation details, resulting in other operation errors.
[0032] In order to solve the above technical problems, the embodiment of the present application introduces an "access agent" to check the data type of the "actual parameter", reduce misjudgment and omission of type errors, and avoid subsequent operation exceptions caused by type errors. Specifically, Figure 2 A schematic diagram of the architecture of a low-code system provided by an embodiment of the present invention, see Figure 2 , where an “access agent” is added to the low-code engine, which is used to check specific “actual parameters” (i.e. Figure 2 The target operation data shown) and the "declared parameters" (i.e. Figure 2 If the data types are not consistent, the user will be prompted with "Type Inconsistency Prompt" through the interactive interface before the module is run.
[0033] Thus, for languages with weak and dynamic types such as JavaScript, Python, Ruby, Lua, ShellScript, and Groovy, the reliability and robustness of the code are greatly improved, and the possibility of runtime errors is reduced. By ensuring type safety at runtime, this technical solution enhances the reliability of the application, reduces problems caused by type mismatch, and improves the overall quality of the application.
[0034] Combine the following Figure 2 The architecture of a low-code system is shown to exemplify the possible execution process of this application. Specifically, Figure 3 A flowchart of a method for checking data types in a low-code system provided by an embodiment of the present invention is shown in FIG. Figure 3 , the method comprising: Step 105: When the operation data is obtained, the declaration data corresponding to the operation data is obtained by accessing the proxy.
[0035] For details, see Figure 2 , the operation data can be input by the user through the interactive interface. Specifically, it can be the user's operation on a certain declared data in a program or application generated by the low-code system. For example, a read and write operation can include specific read and write input values.
[0036] Step 106: Determine whether the data types of the operation data and the declaration data are consistent.
[0037] Optionally, if they are inconsistent, execute step 107; if they are consistent, execute step 108.
[0038] Step 107: Output a type error prompt through an interactive interface.
[0039] Step 108: Execute the operation corresponding to the operation data through the running module.
[0040] The data type check of a low-code system provided in an embodiment of the present application is to first complete the data type check of the operation data and the declaration data before the running module executes the operation data, and prompt the situation of inconsistent data types. The reliability and robustness of the code are improved, and the possibility of runtime errors is reduced. By ensuring the type safety at runtime, the overall quality of the application is improved.
[0041] Optional, in Figure 2 Based on this, the following is a possible implementation of a low-code system. Specifically, Figure 4 A schematic diagram of the architecture of a low-code system provided by an embodiment of the present invention, see Figure 4 For the access agent mentioned above, this example shows a method for implementing a dynamic access agent call.
[0042] Optionally, for different declaration data, proxy objects can be instantiated separately to form corresponding access proxies. Figure 4 As shown, agent 1 is visited, agent 2 is visited, and finally agent N is visited.
[0043] Optionally, by defining access methods (getter methods) and assignment methods (setter methods) for each access proxy, subsequent data type checks for operation data and declaration data are implemented. The following is a pseudo-code example of how to define the "setter method": / / Pseudo code example of page logic function demo(params){ / / Declare the data type / / Generated by user configuration at design time const paramsDesc = { dataType: "String", maxLength: 9, minLength: 3, default: "simple" } / / Instantiate the proxy object for the input parameter const paramsProxy = { setter(val) { / / Get the data type of the operation data (actual parameter) at runtime const valType = typeof val; if (valType !== paramsDesc.dataType) { / / Type inconsistency throw "The data type of the operation data (actual parameter) is not String, which may cause unexpected errors" } / / Use the proxy object to do other more sophisticated verification and processing if (val.length>paramsDesc.maxLength || val.length <paramsDesc.minLength) { / / The maximum and minimum lengths of the String type do not meet the program design expectations} } } / / The subsequent code is the specific logic processing this.$invoke({id: paramsProxy});} Further, combined with Figure 4 ,exist Figure 3 On the basis of Figure 5 A flowchart of another method for checking data types in a low-code system provided by an embodiment of the present invention is shown in FIG. Figure 5 , before step 104, further comprising: Step 100: Obtain page logic and variable data through the low-code designer.
[0044] Step 101: Configure the data type of the variable data through the low-code designer.
[0045] Step 102: Construct a metadata file of the declaration data through the page logic, variable data, and the data type of the variable data.
[0046] Optionally, the metadata file of the declaration data can be persisted in the form of a JSON file.
[0047] Continue to see Figure 5 , after step 102, further comprising: Step 103: Parse the metadata file of the declaration data through the parsing module of the low-code engine to obtain the declaration data.
[0048] Step 104: Create a corresponding access proxy for the declaration data.
[0049] The access proxy is used to intercept operations on declared data when the page logic is running.
[0050] Step 105 specifically includes: Step 105-1: intercept the operation of the target declaration data in the page logic through the access proxy.
[0051] The operation includes the target operation data; the target declaration data belongs to the declaration data. For details, see Figure 4 , because different declaration data can correspond to different access agents. When the user inputs the target operation data, he can give the corresponding actual parameter for a specific declaration data, which is the target declaration data. At this time, the corresponding access agent needs to be called.
[0052] Step 105-2: Obtain identification information of target operation data through the target access agent.
[0053] The target access agent corresponds to the target operation data; the target access agent belongs to the access agent. Figure 4 As shown in the figure, after the low-code engine obtains the target operation data through the parsing module, it determines the corresponding access agent according to its corresponding identification information, such as the name and attributes of the target operation data. Figure 4 As shown, the target operation data corresponds to access agent 2.
[0054] Step 105-3: Determine the target declaration data according to the identification information.
[0055] Continue with Figure 4 For example, it is also possible to determine, based on the identification information, which of the multiple declaration data obtained in the "code design phase" corresponds to the identification information, ie, the target declaration data.
[0056] Then, through the "Setter method" set by the "Access Agent 2", check whether the value of the incoming target operation data is consistent with the data type of the target declaration data. If not, a type inconsistency prompt is output through the interactive interface to prompt the user to troubleshoot and repair the error.
[0057] Furthermore, if the user inputs multiple target operation data, the above process can be executed for each target declaration data until the data types of all target declaration data are checked.
[0058] Optionally, there may be multiple implementations of "determining the corresponding access agent based on the corresponding identification information, such as the name and attributes of the target operation data", for example, one-to-one correspondence between operation data and access agent; or correspondence between operation data and access agent based on data type. In this case, since the data types of different operation data may be the same, in this implementation, multiple operation data may correspond to the same access agent. The implementation of this application is not limited to this.
[0059] Optionally, in each example of the present application, the low-code designer can be an open source graphical programming tool, such as Node-RED. In practical applications, a suitable graphical programming tool can be selected to arrange the page logic according to specific needs.
[0060] Based on the above method example, this application also provides a possible implementation method of a data type checking device of a low-code system, and each step in the above example has been executed to achieve the corresponding technical effect. Specifically, Figure 6 A schematic diagram of a data type checking device for a low-code system provided by an embodiment of the present invention, see Figure 6 , the device 20 includes: an access agent 202, an interactive interface 203 and an operation module 204; The access agent 202 is used to obtain the declaration data corresponding to the operation data when the operation data is obtained; and determine whether the data types of the operation data and the declaration data are consistent; Interactive interface 203, used to output a type error prompt when the data types are inconsistent; The operation module 204 is used to execute the operation corresponding to the operation data when the data types are consistent.
[0061] exist Figure 6 On the basis of Figure 7 A schematic diagram of another data type checking device of a low-code system provided in an embodiment of the present invention, see Figure 6 , the device 20 also includes: a low-code designer 200 and a parsing module 201.
[0062] The low-code designer 200 is used to obtain page logic and variable data; configure the data type of the variable data; and construct a metadata file of the declaration data through the page logic, variable data, and the data type of the variable data.
[0063] The parsing module 201 is also used to parse the metadata file of the declaration data through the parsing module of the low-code engine to obtain the declaration data; create a corresponding access agent for the declaration data; the access agent is used to intercept operations on the declaration data when the page logic is running.
[0064] Optionally, access agent 202 is specifically used to intercept operations on target declaration data in page logic; the operation includes target operation data; the target declaration data belongs to declaration data; identification information of the target operation data is obtained; the target access agent corresponds to the target operation data; the target access agent belongs to the access agent; the target declaration data is determined according to the identification information.
[0065] The embodiment of the invention further provides an electronic device, which can execute all the steps of the above examples of the embodiment of the invention to achieve the corresponding technical effects. Specifically, Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, see Figure 8 , the electronic device 50, comprises: a memory 501, a processor 500; Memory 501, used to store one or more programs; Processor 500; When one or more programs are executed by the processor, when the electronic device 50 is used to execute the steps shown in the above-mentioned method examples, it can achieve each step and the corresponding technical effects.
[0066] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0067] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0068] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a program product, which is stored in a computer-readable storage medium and includes a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0069] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0070] It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above, and that the present application can be implemented in other specific forms without departing from the spirit or essential features of the present application. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims be included in the present application. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
Claims
1. A data type checking method for a low-code system, characterized in that: include: When the operation data is obtained, obtaining declaration data corresponding to the operation data by accessing the agent; Determining whether the data types of the operation data and the declaration data are consistent; If they are inconsistent, a type error prompt will be output through the interactive interface; If they are consistent, the operation corresponding to the operation data is executed through the running module.
2. The method according to claim 1, characterized in that: Before the step of obtaining the declaration data corresponding to the operation data by accessing the agent, the method further includes: Obtain page logic and variable data through the low-code designer; Configuring the data type of the variable data through the low-code designer; A metadata file of the declaration data is constructed by using the page logic, the variable data and the data type of the variable data.
3. The method according to claim 2, characterized in that After constructing the metadata file of the declaration data through the page logic, the variable data and the data type of the variable data, the further step includes: Parsing the metadata file of the declaration data through a parsing module of a low-code engine to obtain the declaration data; A corresponding access agent is created for the declaration data; the access agent is used to intercept operations on the declaration data when the page logic is running.
4. The method according to claim 3, characterized in that The step of obtaining declaration data corresponding to the operation data by accessing the agent comprises: Intercepting, by the access proxy, an operation on target declaration data in the page logic; the operation includes target operation data; the target declaration data belongs to the declaration data; obtaining identification information of the target operation data through a target access agent; the target access agent corresponds to the target operation data; the target access agent belongs to the access agent; The target declaration data is determined according to the identification information.
5. A data type checking device for a low-code system, characterized in that: include: Access agent, interactive interface and operation module; The access agent is used to obtain declaration data corresponding to the operation data when obtaining the operation data; Determining whether the data types of the operation data and the declaration data are consistent; The interactive interface is used to output a type error prompt when the data types are inconsistent; The operation module is used to execute the operation corresponding to the operation data when the data types are consistent.
6. The device according to claim 5, characterized in that include: Low-code designer; The low-code designer is used to obtain page logic and variable data; Configure the data type of the variable data; A metadata file of the declaration data is constructed by using the page logic, the variable data and the data type of the variable data.
7. The device according to claim 6, characterized in that The parsing module is further used to parse the metadata file of the declaration data to obtain the declaration data; create a corresponding access agent for the declaration data; and the access agent is used to intercept operations on the declaration data when the page logic is running.
8. An electronic device, characterized in that: include: A memory for storing one or more programs; processor; When the one or more programs are executed by the processor, the method according to any one of claims 1 to 4 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
10. A program product, characterized in that When the program product is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Cited By
Data verification method and device, storage medium and program product
CN119645423A