Software development method and device

文档序号:7171 发布日期:2021-09-17 浏览:58次 中文

1. A software development method is applied to terminal equipment, and the method comprises the following steps:

sending request information to server equipment, wherein the request information is used for requesting the server equipment to return attribute information of a target data interface;

receiving attribute information of the target data interface sent by the server side equipment, and generating a type definition file of a preset language according to the attribute information;

acquiring a code template corresponding to the target data interface;

and generating an interface method calling code of the target data interface according to the type definition file and the code template.

2. The method of claim 1, wherein after generating the interface method invocation code, the method further comprises:

reading first type information and second type information from the type definition file through the interface method calling code, wherein the first type information is used for representing the type of a request parameter of the target data interface, and the second type information is used for representing the type of a return parameter of the target data interface;

and prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information in the process of writing the code of the target data interface.

3. The method of claim 2, wherein the code template comprises: generating a code template according to the information corresponding to the target data interface in an interface request library of the front end;

in the process of writing the code of the target data interface, prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information, including:

and prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information in the process of writing the code of the front end.

4. The method of claim 2, wherein the code template comprises: generating a code template according to a service framework of a control layer at the rear end;

in the process of writing the code of the target data interface, prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information, including:

and prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information in the process of programming the code of the control layer at the rear end.

5. The method of claim 2, wherein the code template comprises: generating a code template according to a service framework of the routing layer of the back end;

the method further comprises the following steps:

acquiring path information from the type definition file through the interface method calling code, wherein the path information is used for representing a request path of the target data interface;

and prompting the request path of the target data interface according to the path information in the process of programming the code of the routing layer at the rear end.

6. The method of claim 2, further comprising:

after the code of the front end is written, the request parameter of the target data interface is sent to the server-side equipment through the front end;

receiving a simulation return parameter sent by the server side equipment;

and debugging the front end according to the third type information and the fourth type information, wherein the third type information is used for representing the type of the return parameter of the target data interface defined by the code of the front end, and the fourth type information is used for representing the type of the simulation return parameter.

7. The method of claim 2, further comprising:

after the codes of the front end and the front end are written, sending a request parameter of the target data interface to the rear end through the front end, and sending a return parameter of the target data interface to the front end through the rear end;

and jointly debugging the front end and the back end based on the type of the request parameter, the type of the return parameter, the type of the request parameter of the target data interface defined by the code of the back end and the type of the return parameter of the target data interface defined by the code of the front end.

8. The method according to claims 1 to 7, wherein the attribute information is data in JsonSchema format;

the generating of the type definition file of the preset language according to the attribute information includes: converting the attribute information into a type definition file of a TypeScript language based on the abstract syntax tree AST.

9. A software development method is applied to server-side equipment, and comprises the following steps:

acquiring attribute information of a target data interface;

receiving request information sent by terminal equipment, wherein the request information is used for requesting the server equipment to return attribute information of a target data interface;

and sending the attribute information of the target data interface to the terminal equipment.

10. The method of claim 9, further comprising:

receiving a request parameter of the target data interface sent by the terminal equipment through a front end;

and sending the simulation return parameters to the front end of the terminal equipment.

11. The method of claim 9, wherein the obtaining attribute information of the target data interface comprises:

displaying a property configuration interface, the property configuration interface including at least one property configuration form of the target data interface;

receiving user input to the at least one attribute configuration form;

and generating the attribute information of the target data interface according to the input of the user to the at least one attribute configuration form.

12. A terminal device, comprising:

the device comprises a sending unit, a receiving unit and a sending unit, wherein the sending unit is used for sending request information to server equipment, and the request information is used for requesting the server equipment to return attribute information of a target data interface;

a receiving unit, configured to receive attribute information of the target data interface sent by the server device;

the conversion unit is used for generating a type definition file of a preset language according to the attribute information;

the acquisition unit is used for acquiring a code template corresponding to the target data interface;

and the generating unit is used for generating an interface method calling code of the target data interface according to the type definition file and the code template.

13. A server-side device, comprising:

the acquisition unit is used for acquiring the attribute information of the target data interface;

the receiving unit is used for receiving request information sent by terminal equipment, wherein the request information is used for requesting the server-side equipment to return attribute information of a target data interface;

and the sending unit is used for sending the attribute information of the target data interface to the terminal equipment.

14. An electronic device, comprising: a memory for storing a computer program and a processor; the processor is configured to execute the software development method of any one of claims 1-11 when the computer program is invoked.

15. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the software development method of any one of claims 1 to 11.

Background

With the rapid development of Internet Technology (IT), the work of developers becomes more and more important, but writing program code takes much time of the developers, so that how to automate code generation has become one of the research hotspots in the field.

At present, a great number of internet software projects are developed based on TypeScript (an open source programming language, which is constructed by adding static type definitions on the basis of JavaScript). In the process of software Development based on TypeScript, an Integrated Development Environment (IDE) can verify interface attributes defined in a program code written by a user according to a type definition file and an interface method call code, so that a parameter transmission error is avoided when the program code is written, and the Development efficiency of developers is improved. In the prior art, a mode for generating a type definition file and an interface method call code is as follows: an Interface Description Language (IDL) file is manually written, and then the written IDL file is converted into a type definition file and an Interface method calling code. In the prior art, when the type definition file and the interface method calling code are generated, the IDL file needs to be written manually, so that the cost is high and the efficiency is low when software development is performed in the prior art.

Disclosure of Invention

In view of this, the present invention provides a software development method, which is used to solve the problems of high cost and low efficiency in software development in the prior art.

In order to achieve the above object, the embodiments of the present invention provide the following technical solutions:

in a first aspect, an embodiment of the present invention provides a software development method, which is applied to a terminal device, and the method includes:

sending request information to server equipment, wherein the request information is used for requesting the server equipment to return attribute information of a target data interface;

receiving attribute information of the target data interface sent by the server side equipment, and generating a type definition file of a preset language according to the attribute information;

acquiring a code template corresponding to the target data interface;

and generating an interface method calling code of the target data interface according to the type definition file and the code template.

As an optional implementation manner of the embodiment of the present invention, after the interface method invocation code is generated, the method further includes:

reading first type information and second type information from the type definition file through the interface method calling code, wherein the first type information is used for representing the type of a request parameter of the target data interface, and the second type information is used for representing the type of a return parameter of the target data interface;

and prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information in the process of writing the code of the target data interface.

As an optional implementation manner of the embodiment of the present invention, the code template includes: generating a code template according to the information corresponding to the target data interface in an interface request library of the front end;

in the process of writing the code of the target data interface, prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information, including:

and prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information in the process of writing the code of the front end.

As an optional implementation manner of the embodiment of the present invention, the code template includes: generating a code template according to a service framework of a control layer at the rear end;

in the process of writing the code of the target data interface, prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information, including:

and prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information in the process of programming the code of the control layer at the rear end.

As an optional implementation manner of the embodiment of the present invention, the code template includes: generating a code template according to a service framework of the routing layer of the back end;

the method further comprises the following steps:

acquiring path information from the type definition file through the interface method calling code, wherein the path information is used for representing a request path of the target data interface;

and prompting the request path of the target data interface according to the path information in the process of programming the code of the routing layer at the rear end.

As an optional implementation manner of the embodiment of the present invention, the method further includes:

after the code of the front end is written, the request parameter of the target data interface is sent to the server-side equipment through the front end;

receiving a simulation return parameter sent by the server side equipment;

and debugging the front end according to the third type information and the fourth type information, wherein the third type information is used for representing the type of the return parameter of the target data interface defined by the code of the front end, and the fourth type information is used for representing the type of the simulation return parameter.

As an optional implementation manner of the embodiment of the present invention, the method further includes:

after the codes of the front end and the front end are written, sending a request parameter of the target data interface to the rear end through the front end, and sending a return parameter of the target data interface to the front end through the rear end;

and jointly debugging the front end and the back end based on the type of the request parameter, the type of the return parameter, the type of the request parameter of the target data interface defined by the code of the back end and the type of the return parameter of the target data interface defined by the code of the front end.

As an optional implementation manner of the embodiment of the present invention, the attribute information is data in a json schema format;

the generating of the type definition file of the preset language according to the attribute information includes: converting the attribute information into a type definition file of a TypeScript language based on the abstract syntax tree AST.

In a second aspect, an embodiment of the present invention provides a software development method, which is applied to a server device, and the method includes:

acquiring attribute information of a target data interface;

receiving request information sent by terminal equipment, wherein the request information is used for requesting the server equipment to return attribute information of a target data interface;

and sending the attribute information of the target data interface to the terminal equipment.

As an optional implementation manner of the embodiment of the present invention, the method further includes:

receiving a request parameter of the target data interface sent by the terminal equipment through a front end;

and sending the simulation return parameters to the front end of the terminal equipment.

As an optional implementation manner of the embodiment of the present invention, the acquiring attribute information of the target data interface includes:

displaying a property configuration interface, the property configuration interface including at least one property configuration form of the target data interface;

receiving user input to the at least one attribute configuration form;

and generating the attribute information of the target data interface according to the input of the user to the at least one attribute configuration form.

In a third aspect, an embodiment of the present invention provides a terminal device, including:

the device comprises a sending unit, a receiving unit and a sending unit, wherein the sending unit is used for sending request information to server equipment, and the request information is used for requesting the server equipment to return attribute information of a target data interface;

a receiving unit, configured to receive attribute information of the target data interface sent by the server device;

the conversion unit is used for generating a type definition file of a preset language according to the attribute information;

the acquisition unit is used for acquiring a code template corresponding to the target data interface;

and the generating unit is used for generating an interface method calling code of the target data interface according to the type definition file and the code template.

As an optional implementation manner of the embodiment of the present invention, the terminal device further includes:

the processing unit is used for reading first type information and second type information from the type definition file through the interface method calling code after the interface method calling code is generated, and prompting the type of a request parameter of the target data interface and the type of a return parameter of the target data interface according to the first type information and the second type information in the process of programming the code of the target data interface;

the first type information is used for representing the type of a request parameter of the target data interface, and the second type information is used for representing the type of a return parameter of the target data interface.

As an optional implementation manner of the embodiment of the present invention, the code template includes: generating a code template according to the information corresponding to the target data interface in an interface request library of the front end;

the processing unit is specifically configured to prompt a type of a request parameter of the target data interface and a type of a return parameter of the target data interface according to the first type information and the second type information in a process of writing the front-end code.

As an optional implementation manner of the embodiment of the present invention, the code template includes: generating a code template according to a service framework of a control layer at the rear end;

the processing unit is specifically configured to prompt a type of a request parameter of the target data interface and a type of a return parameter of the target data interface according to the first type information and the second type information in a process of programming a code of the control layer at the back end.

As an optional implementation manner of the embodiment of the present invention, the code template includes: generating a code template according to a service framework of the routing layer of the back end;

the processing unit is further configured to obtain path information from the type definition file through the interface method calling code, where the path information is used to characterize a request path of the target data interface; and prompting the request path of the target data interface according to the path information in the process of programming the code of the routing layer at the rear end.

As an optional implementation manner of the embodiment of the present invention, the processing unit is further configured to send, through the front end, a request parameter of the target data interface to the server device after writing of a code of the front end is completed; receiving a simulation return parameter sent by the server side equipment; and debugging the front end according to the third type information and the fourth type information, wherein the third type information is used for representing the type of the return parameter of the target data interface defined by the code of the front end, and the fourth type information is used for representing the type of the simulation return parameter.

As an optional implementation manner of the embodiment of the present invention, the processing unit is further configured to send, after writing of a front-end code and a front-end code is completed, a request parameter of the target data interface to the back-end through the front-end, and send a return parameter of the target data interface to the front-end through the back-end; and jointly debugging the front end and the back end based on the type of the request parameter, the type of the return parameter, the type of the request parameter of the target data interface defined by the code of the back end and the type of the return parameter of the target data interface defined by the code of the front end.

As an optional implementation manner of the embodiment of the present invention, the attribute information is data in a json schema format;

the generating of the type definition file of the preset language according to the attribute information includes: converting the attribute information into a type definition file of a TypeScript language based on the abstract syntax tree AST.

In a fourth aspect, an embodiment of the present invention provides a server device, including:

the acquisition unit is used for acquiring the attribute information of the target data interface;

the receiving unit is used for receiving request information sent by terminal equipment, wherein the request information is used for requesting the server-side equipment to return attribute information of a target data interface;

and the sending unit is used for sending the attribute information of the target data interface to the terminal equipment.

As an alternative implementation of the embodiment of the present invention,

the receiving unit is further configured to receive a request parameter of the target data interface, which is sent by the terminal device through a front end;

the sending unit is further configured to send the simulation return parameter to the front end of the terminal device.

As an optional implementation manner of the embodiment of the present invention, the obtaining unit is specifically configured to display an attribute configuration interface, where the attribute configuration interface includes at least one attribute configuration form of the target data interface; receiving user input to the at least one attribute configuration form; and generating the attribute information of the target data interface according to the input of the user to the at least one attribute configuration form.

In a fifth aspect, an embodiment of the present invention provides an electronic device, including: a memory for storing a computer program and a processor; the processor is configured to cause the electronic device to execute the software development method according to any one of the above embodiments when the computer program is called.

In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a computing device, the computing device is enabled to implement the software development method according to any one of the above-mentioned embodiments.

In a seventh aspect, an embodiment of the present invention provides a computer program product, which when run on a computer, causes the computer to implement the software development method described in any one of the above embodiments.

The software development method provided by the embodiment of the invention comprises the following steps: the method comprises the steps that terminal equipment sends request information for requesting the server equipment to return attribute information of a target data interface to server equipment, receives the attribute information of the target data interface sent by the server equipment, generates a preset language type definition file according to the attribute information, and generates an interface method calling code of the target data interface according to the type definition file and a code template corresponding to the target data interface. Compared with the prior art that the IDL file needs to be written manually during software development, in the software development method provided by the embodiment of the invention, the terminal device can acquire the attribute information of the data interface from the server device and automatically generate the interface method calling code of the data interface according to the attribute information of the interface and the corresponding code template, and the IDL file does not need to be written manually, so that the cost can be reduced and the efficiency can be improved during software development.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.

Fig. 1 is an architecture diagram of a software development method according to an embodiment of the present invention;

FIG. 2 is an interaction flow diagram of a software development method according to an embodiment of the present invention;

FIG. 3 is a second interaction flowchart of the software development method according to the embodiment of the present invention;

FIG. 4 is a third interaction flow chart of the software development method according to the embodiment of the present invention;

FIG. 5 is a fourth interaction flowchart of the software development method according to the embodiment of the present invention;

FIG. 6 is a schematic diagram of a property configuration interface provided by an embodiment of the present invention;

fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present invention;

fig. 8 is a second schematic structural diagram of a terminal device according to an embodiment of the present invention;

fig. 9 is a schematic structural diagram of a server device according to an embodiment of the present invention;

fig. 10 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.

Detailed Description

In order that the above objects, features and advantages of the present invention may be more clearly understood, a solution of the present invention will be further described below. It should be noted that the embodiments of the present invention and features of the embodiments may be combined with each other without conflict.

In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, but the present invention may be practiced in other ways than those described herein; it is to be understood that the embodiments described in this specification are only some embodiments of the invention, and not all embodiments.

In the embodiments of the present invention, words such as "exemplary" or "for example" are used to mean serving as examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "e.g.," an embodiment of the present invention is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion. Further, in the description of the embodiments of the present invention, "a plurality" means two or more unless otherwise specified.

First, a scenario architecture of a software development method provided in an embodiment of the present invention is described below.

Referring to fig. 1, a possible scenario architecture of a software development method provided in an embodiment of the present invention includes: a first terminal device 11, a server device 12 and a second terminal device 13. The server device 12 may receive attribute information, such as a request path (path), a request method (method), a request parameter (reqParam), a return parameter (resParam), and the like, of a data interface input by a user through the user input unit, and both the first terminal device 11 and the second terminal device 13 may perform data transmission with the server device 12.

Software development preparation phase:

the first terminal device 11 and the second terminal device 13 may obtain attribute information of the data interface from the server device 12 through an interface (openApi) that is open to the outside of the server device 12, convert the attribute information of the data interface into a type definition file (type definition file of TypeScript language), and generate an interface method call code of the data interface according to the type definition file and a corresponding code template.

The code writing stage of the software comprises the following steps:

in the process of writing the code of the front end 110, the first terminal device 11 may read the type of the request parameter and the type of the return parameter of the data interface from the type definition file through the corresponding interface method call code, and prompt according to the type of the request parameter and the type of the return parameter.

In the process of writing the code of the backend 130, the second terminal device 13 may read the type of the request parameter and the type of the return parameter of the data interface from the type definition file through a corresponding interface method call code, and prompt according to the type of the request parameter and the type of the return parameter.

In the debugging phase of the software:

after the first terminal device 11 completes the development of the front end 110, the first terminal device 11 may further send a request parameter to the data management device 12 through the front end 110, receive a simulated return parameter (mock data) sent by the data management device 12, and debug the front end according to a type of a return parameter of the data interface defined by a code of the front end and a type of the simulated return parameter sent by the data management device 12.

After the first terminal device 11 completes the development of the front end 110 and the second terminal device 13 completes the development of the back end 130, the first terminal device 11 may further send a request parameter to the back end 130 through the front end 110 and receive a return parameter sent by the back end 130, the first terminal device 11 jointly debugs the front end 110 and the back end 130 according to a return parameter type defined by a code of the front end and a return parameter type sent by the back end 130, and the second terminal device 13 jointly debugs the front end 110 and the back end 130 according to a request parameter type defined by a code of the back end 130 and a request parameter type sent by the front end.

It should be noted that the scenario architecture is only one possible scenario architecture in the embodiment of the present invention, but the embodiment of the present invention is not limited to this, and the scenario architecture in the embodiment of the present invention may further include only one terminal device, where the terminal device may be configured to implement the related function of the first terminal device, may also be configured to implement the related function of the second terminal device, and may also be configured to implement the related functions of the first terminal device and the second terminal device simultaneously.

On the basis of the above, the embodiment of the present invention provides a software development method, and as shown in fig. 2, the software development method provided by the embodiment of the present invention includes the following steps S21 to S25:

s21, the server side equipment acquires the attribute information of the target data interface.

Optionally, the attribute information of the target data interface may include: the method comprises the following steps of obtaining attributes of a target data interface, such as a request path (path), a request method (method), a request parameter (reqParam), a return parameter (resParam), and the like, and corresponding attribute values.

And S22, the terminal equipment sends request information to the server equipment.

Correspondingly, the server side equipment receives the request information sent by the terminal equipment.

The request information is used for requesting the server-side equipment to return the attribute information of the target data interface.

And S23, the server side equipment sends the attribute information of the target data interface to the terminal equipment.

Correspondingly, the terminal equipment receives the attribute information of the target data interface sent by the server equipment.

Illustratively, the terminal device may obtain the attribute information of the target data interface in the form of a HyperText Transfer Protocol (HTTP) interface request through an open api (openApi) that is open to the outside to the server device.

And S24, the terminal equipment generates a type definition file of a preset language according to the attribute information.

Optionally, the attribute information is data in a json schema format;

converting the attribute information into a type definition file of a preset syntax includes: and converting the attribute information in the json schema format into a type definition file of a TypeScript language.

That is, the type definition file in the embodiment of the present invention may be a type definition file in TypeScript format.

And S25, the terminal equipment generates an interface method calling code of the target data interface according to the type definition file and the code template.

Specifically, the developer may write the code template according to the information of the target data interface, and encapsulate the code template in the request library of the terminal device, so that when the terminal device generates the interface method call code, the code template is read from the internally encapsulated request library.

The software development method provided by the embodiment of the invention comprises the following steps: the method comprises the steps that terminal equipment sends request information for requesting the server equipment to return attribute information of a target data interface to server equipment, receives the attribute information of the target data interface sent by the server equipment, generates a preset language type definition file according to the attribute information, and generates an interface method calling code of the target data interface according to the type definition file and a code template corresponding to the target data interface. Compared with the prior art that the IDL file needs to be written manually during software development, in the software development method provided by the embodiment of the invention, the terminal device can acquire the attribute information of the data interface from the server device and automatically generate the interface method calling code of the data interface according to the attribute information of the interface and the corresponding code template, and the IDL file does not need to be written manually, so that the cost can be reduced and the efficiency can be improved during software development.

It should be further noted that, because both the first terminal device and the second terminal device may generate the code template generated according to the service framework of the control layer at the back end according to the attribute information of the data interface acquired from the server device, the software development method provided in the above embodiment may further avoid writing an interface document manually, and avoid that the type definition file used at the front end is different from the type definition file used at the back end.

As an optional implementation manner of this embodiment of the present invention, in a case that the attribute information is data in a json schema format, step S24 (where the first terminal device generates a type definition file according to the attribute information, where the type definition file includes a preset language) includes:

converting the attribute information into a type definition file of a TypeScript Syntax based on an Abstract Syntax Tree (AST).

Wherein, the abstract syntax tree represents an abstract representation of the syntax structure of the source code, which can represent the syntax structure of the programming language in a tree form, and each node on the tree represents a structure in the source code. The method for converting the attribute information into the type definition file of the TypeScript language based on the AST may be implemented as follows: generating an abstract syntax tree according to each parameter of a target data interface, traversing the abstract syntax tree, obtaining the parameter and the type of the parameter corresponding to each node of the abstract syntax tree, and converting the attribute information into a type definition file of a TypeScript language according to the parameter and the type of the parameter corresponding to each node of the abstract syntax tree.

As an alternative implementation manner of the embodiment of the present invention, referring to fig. 3, after the step S25 (generating the interface method calling code of the target data interface), the method further includes the following steps S31 and S32:

and S31, reading the first type information and the second type information from the type definition file through the interface method calling code.

The first type information is used for representing the type of a request parameter of the target data interface, and the second type information is used for representing the type of a return parameter of the target data interface.

S32, in the process of writing the code of the target data interface, prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information.

That is, in the process of writing the code of the target data interface, the terminal device may read, from the type definition file, the first type information for characterizing the type of the request parameter of the target data interface and the second type information for the type of the return parameter of the target data interface by calling the code through the interface method, and prompt the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information.

Further, the application scenarios of the software development method provided by the above embodiment may include the following two types:

application scenarios I,

The code template includes: and generating a code template according to the information corresponding to the target data interface in the interface request library of the front end.

The step S32 (in the process of writing the code of the target data interface, prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information) includes:

and prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information in the process of writing the code of the front end.

The embodiment can reduce or avoid the parameter transmission type error in the process of writing the code of the front end, thereby improving the development efficiency of the front end.

Application scenarios II,

The code template includes: and generating a code template according to a service framework of a control layer at the back end.

The step S32 (in the process of writing the code of the target data interface, prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information) includes:

and prompting the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information in the process of programming the code of the control layer at the rear end.

The embodiment can reduce or avoid the parameter transmission type error in the process of writing the code of the control layer at the back end, thereby improving the development efficiency of the back end.

As an optional implementation manner of the embodiment of the present invention, the code template includes: and generating a code template according to the service framework of the routing layer of the back end. Referring to fig. 4, after the step S25 (generating the interface method call code of the target data interface), the software development method according to the embodiment of the present invention further includes the following steps S41 and S42:

and S41, acquiring path information from the type definition file through the interface method calling code.

Wherein the path information is used to characterize a request path of the target data interface.

And S42, prompting the request path of the target data interface according to the path information in the process of writing the code of the rear-end routing layer.

The software development method provided by the above embodiment may further generate an interface method call code of the target data interface according to the type definition file and a code template generated according to the service framework of the routing layer at the back end, and in the process of writing the code of the routing layer at the back end, obtain path information from the type definition file through the interface method call code, and prompt a request path of the target data interface according to the path information, so the above embodiment may further reduce or avoid a transmission path error in the process of writing the code at the back end, thereby further improving the development efficiency at the back end.

Further, referring to fig. 5, after the terminal device completes the front-end development, the method provided in the embodiment of the present invention further includes:

s501, the terminal device sends the request parameter of the target data interface to the server device through the front end.

Correspondingly, the server device receives the request parameter of the target data interface sent by the terminal device.

S502, the server side equipment sends simulation return parameters (mock data) to the terminal equipment.

Correspondingly, the terminal equipment receives the simulation return parameters sent by the server-side equipment.

And S503, the terminal device debugs the front end according to the third type information and the fourth type information.

The third type information is used for representing the type of the return parameter of the target data interface defined by the code of the front end, and the fourth type information is used for representing the type of the simulation return parameter.

After receiving the simulated return parameter sent by the server device, the terminal device compares whether the type of the simulated return parameter (fourth type information) is the same as the type of the return parameter (third type information) of the target data interface defined by the code of the front end; and if the third type information is the same as the fourth type information, determining that the type of the return parameter of the target data interface is correct, and if the third type information is different from the fourth type information, determining that the type of the return parameter of the target data interface is wrong.

Specifically, the service command of the data interface layer code generation tool (ug-cli) comprises: and an ug service mock start command can control the front end to send the request parameter of the target data interface to the server device and receive the simulated return parameter sent by the server device by executing the ug service mock start command of the ug-cli.

The terminal device can acquire the simulation return parameters from the server device through the front end, and debug the front end according to the type of the simulation return parameters and the type of the return parameters of the target data interface defined by the code of the front end, so that the software development method provided by the embodiment can avoid the mutual dependence of the front end development progress and the dependence on the back end development progress, and further improve the development efficiency of the front end.

As an optional implementation manner of the present invention, after the terminal device completes the development of the front end and the back end, the software development method provided in the embodiment of the present invention further includes:

after the codes of the front end and the front end are written, sending a request parameter of the target data interface to the rear end through the front end, and sending a return parameter of the target data interface to the front end through the rear end;

and jointly debugging the front end and the back end based on the type of the request parameter, the type of the return parameter, the type of the request parameter of the target data interface defined by the code of the back end and the type of the return parameter of the target data interface defined by the code of the front end.

That is, after the terminal device completes the development of the front end and the back end, the terminal device may not use the simulation response parameters, but obtain the real response parameters generated by the back end, thereby implementing the joint debugging of the front end and the back end.

Specifically, the service command of the data interface layer code generation tool (ug-cli) further includes: and simulating a data closing (ug service mock end) command, and sending a request parameter of the target data interface to an interface rear end and receiving a real return parameter sent by the rear end by executing the ug service mock end command of the ug-cli.

Further, the following describes an implementation manner of the server device acquiring the attribute information of the target data interface, where the implementation manner of the server device acquiring the attribute information of the target data interface may include the following steps:

and step I, displaying an attribute configuration interface.

Wherein the property configuration interface comprises at least one property configuration form of the target data interface.

Illustratively, referring to FIG. 6, configuring the interface with attributes in FIG. 6 includes: three tabs of basic information set 61, request parameter set 62, and return parameter set 63 are shown for example. Wherein the basic information setting may include: a form for setting a name of the data interface, a form for setting a classification of the data interface, a form for setting a request path of the data interface, a form for setting a state of the data interface, and a form for setting an identification of the data interface, the request parameter setting may include: a form for setting a value of the request parameter, a request header field for setting the request parameter, and a form for setting a type of the request parameter, and the returning the parameter setting may include: a form for setting the value of the return parameter, a request header field for setting the return parameter, and a form for setting the type of the return parameter.

And step II, receiving the input of the user to the at least one attribute configuration form.

And III, generating the attribute information of the target data interface according to the input of the user to the at least one attribute configuration form.

Compared with writing type definition files, filling the attribute information of the data interface in the attribute configuration interface has lower requirements on the professional skills of developers, and the attribute of the data interface can be visually configured.

Based on the same inventive concept, as an implementation of the foregoing method, an embodiment of the present invention further provides a terminal device and a server device, where the terminal device and the server device correspond to the foregoing method embodiments, and for convenience of reading, details in the foregoing method embodiments are not repeated one by one in the device embodiment, but it should be clear that the terminal device and the server device in this embodiment can correspondingly implement all the contents in the foregoing method embodiments.

Fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present invention, and as shown in fig. 7, a terminal device 700 according to this embodiment includes:

a sending unit 71, configured to send request information to a server device, where the request information is used to request the server device to return attribute information of a target data interface;

a receiving unit 72, configured to receive attribute information of the target data interface sent by the server device;

a conversion unit 73, configured to generate a type definition file of a preset language according to the attribute information;

an obtaining unit 74, configured to obtain a code template corresponding to the target data interface;

a generating unit 75, configured to generate an interface method invocation code of the target data interface according to the type definition file and the code template;

as an optional implementation manner of the embodiment of the present invention, referring to fig. 8, the terminal device 700 further includes:

a processing unit 76, configured to, after the interface method calling code is generated, read first type information and second type information from the type definition file through the interface method calling code, and prompt, according to the first type information and the second type information, a type of a request parameter of the target data interface and a type of a return parameter of the target data interface in a process of programming a code of the target data interface;

the first type information is used for representing the type of a request parameter of the target data interface, and the second type information is used for representing the type of a return parameter of the target data interface.

As an optional implementation manner of the embodiment of the present invention, the code template includes: generating a code template according to the information corresponding to the target data interface in an interface request library of the front end;

the processing unit 76 is specifically configured to prompt the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information in the process of writing the code of the front end.

As an optional implementation manner of the embodiment of the present invention, the code template includes: generating a code template according to a service framework of a control layer at the rear end;

the processing unit 76 is specifically configured to prompt the type of the request parameter of the target data interface and the type of the return parameter of the target data interface according to the first type information and the second type information in the process of programming the code of the control layer at the back end.

As an optional implementation manner of the embodiment of the present invention, the code template includes: generating a code template according to a service framework of the routing layer of the back end;

the processing unit 76 is further configured to obtain path information from the type definition file through the interface method invocation code, where the path information is used to characterize a request path of the target data interface; and prompting the request path of the target data interface according to the path information in the process of programming the code of the routing layer at the rear end.

As an optional implementation manner of the embodiment of the present invention, the processing unit 76 is further configured to send, through the front end, a request parameter of the target data interface to the server device after writing a code of the front end is completed; receiving a simulation return parameter sent by the server side equipment; and debugging the front end according to the third type information and the fourth type information, wherein the third type information is used for representing the type of the return parameter of the target data interface defined by the code of the front end, and the fourth type information is used for representing the type of the simulation return parameter.

As an optional implementation manner of the embodiment of the present invention, the processing unit 76 is further configured to send, after writing of a front-end code and a front-end code is completed, a request parameter of the target data interface to the back-end through the front-end, and send a return parameter of the target data interface to the front-end through the back-end; and jointly debugging the front end and the back end based on the type of the request parameter, the type of the return parameter, the type of the request parameter of the target data interface defined by the code of the back end and the type of the return parameter of the target data interface defined by the code of the front end.

As an optional implementation manner of the embodiment of the present invention, the attribute information is data in a json schema format;

the generating of the type definition file of the preset language according to the attribute information includes: converting the attribute information into a type definition file of a TypeScript language based on the abstract syntax tree AST.

Fig. 9 is a schematic structural diagram of a server device according to an embodiment of the present invention, and as shown in fig. 9, the server device 900 according to the embodiment includes:

an obtaining unit 91, configured to obtain attribute information of a target data interface;

a receiving unit 92, configured to receive request information sent by a terminal device, where the request information is used to request the server device to return attribute information of a target data interface;

a sending unit 93, configured to send the attribute information of the target data interface to the terminal device.

As an alternative implementation of the embodiment of the present invention,

the receiving unit 92 is further configured to receive a request parameter of the target data interface sent by a front end;

the sending unit 93 is further configured to send the simulation return parameter to the front end.

As an alternative implementation of the embodiment of the present invention,

the obtaining unit 91 is specifically configured to display an attribute configuration interface, where the attribute configuration interface includes at least one attribute configuration form of the target data interface; receiving user input to the at least one attribute configuration form; and generating the attribute information of the target data interface according to the input of the user to the at least one attribute configuration form.

The terminal device and the server device provided in this embodiment may execute the software development method provided in the above embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.

Based on the same inventive concept, the embodiment of the invention also provides electronic equipment. Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 10, the electronic device according to the embodiment includes: a memory 101 and a processor 102, the memory 101 being for storing a computer program; the processor 102 is configured to, when the computer program is called, cause the electronic device to perform the steps in the software development method provided by the above method embodiment.

In particular, the memory 101 may be used to store software programs as well as various data. The memory 101 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 101 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.

The processor 102 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 101 and calling data stored in the memory 101, thereby performing overall monitoring of the electronic device. Processor 102 may include one or more processing units.

In addition, it should be understood that the electronic device provided by the embodiment of the present invention may further include: the device comprises a radio frequency unit, a network module, an audio output unit, a sensor, a signal receiving unit, a display, a user receiving unit, an interface unit, a power supply and the like. It will be appreciated by those skilled in the art that the above-described configuration of the electronic device does not constitute a limitation of the electronic device, and that the electronic device may include more or fewer components, or some components may be combined, or a different arrangement of components. In the embodiment of the present invention, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted terminal, a wearable device, a pedometer, and the like.

The radio frequency unit may be configured to receive and transmit signals during information transmission and reception or during a call, and specifically, receive downlink data from a base station and then process the received downlink data to the processor 102; in addition, the uplink data is transmitted to the base station. Typically, the radio frequency units include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. In addition, the radio frequency unit can also communicate with a network and other devices through a wireless communication system.

The electronic device provides wireless broadband internet access for the user through the network module, such as helping the user send and receive e-mails, browse webpages, access streaming media and the like.

The audio output unit may convert audio data received by the radio frequency unit or the network module or stored in the memory 101 into an audio signal and output as sound. Also, the audio output unit may also provide audio output related to a specific function performed by the electronic device (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit comprises a loudspeaker, a buzzer, a receiver and the like.

The signal receiving unit is used for receiving audio or video signals. The receiving Unit may include a Graphics Processing Unit (GPU) that processes image data of still pictures or video obtained by an image capturing device (such as a camera) in a video capturing mode or an image capturing mode, and a microphone. The processed image frames may be displayed on a display unit. The image frames processed by the graphic processor may be stored in a memory (or other storage medium) or transmitted via a radio frequency unit or a network module. The microphone may receive sound and be capable of processing such sound into audio data. The processed audio data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit in case of the phone call mode.

The electronic device also includes at least one sensor, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor that adjusts the brightness of the display panel according to the brightness of ambient light, and a proximity sensor that turns off the display panel and/or the backlight when the electronic device is moved to the ear. As one type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of an electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), and vibration identification related functions (such as pedometer, tapping); the sensors may also include fingerprint sensors, pressure sensors, iris sensors, molecular sensors, gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., and will not be described herein.

The display unit is used for displaying information input by a user or information provided to the user. The Display unit may include a Display panel, and the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.

The user receiving unit may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device. Specifically, the user receiving unit includes a touch panel and other input devices. A touch panel, also referred to as a touch screen, may collect touch operations by a user on or near the touch panel (e.g., operations by a user on or near the touch panel using a finger, a stylus, or any other suitable object or attachment). The touch panel may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 102, receives a command from the processor 102, and executes the command. In addition, the touch panel may be implemented in various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the touch panel, the user receiving unit may include other input devices. Specifically, the other input devices may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein.

Further, the touch panel may be overlaid on the display panel, and when the touch panel detects a touch operation thereon or nearby, the touch panel transmits the touch operation to the processor 102 to determine the type of the touch event, and then the processor 102 provides a corresponding visual output on the display panel according to the type of the touch event. Generally, the touch panel and the display panel are two independent components to implement the input and output functions of the electronic device, but in some embodiments, the touch panel and the display panel may be integrated to implement the input and output functions of the electronic device, and the implementation is not limited herein.

The interface unit is an interface for connecting an external device and the electronic equipment. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements in the electronic equipment or may be used to transmit data between the electronic equipment and the external device.

The electronic device may also include a power source (e.g., a battery) for powering the various components, and optionally, the power source may be logically connected to the processor 102 via a power management system, such that functions of managing charging, discharging, and power consumption are performed via the power management system.

An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a computing device, the computing device is enabled to implement the software development method provided by the foregoing method embodiment.

The embodiment of the present invention further provides a computer program product, when the computer program product runs on a computer, the computer is enabled to implement the software development method provided by the above method embodiment.

As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media having computer-usable program code embodied in the medium.

Computer readable media include both permanent and non-permanent, removable and non-removable storage media. Storage media may implement information storage by any method or technology, and the information may be computer-readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include transitory computer readable media (transmyedia) such as modulated data signals and carrier waves.

It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:一种可视化建站系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!