CN113918150A - Method for automatically configuring interface front-end code - Google Patents

Method for automatically configuring interface front-end code Download PDF

Info

Publication number
CN113918150A
CN113918150A CN202111186745.8A CN202111186745A CN113918150A CN 113918150 A CN113918150 A CN 113918150A CN 202111186745 A CN202111186745 A CN 202111186745A CN 113918150 A CN113918150 A CN 113918150A
Authority
CN
China
Prior art keywords
end code
request
code
file
interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111186745.8A
Other languages
Chinese (zh)
Inventor
黄娟
雷雨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Zhongtongji Network Technology Co Ltd
Original Assignee
Shanghai Zhongtongji Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Zhongtongji Network Technology Co Ltd filed Critical Shanghai Zhongtongji Network Technology Co Ltd
Priority to CN202111186745.8A priority Critical patent/CN113918150A/en
Publication of CN113918150A publication Critical patent/CN113918150A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to a method for automatically configuring interface front-end codes, which comprises the following steps: and detecting the state of the back-end code in real time, analyzing the back-end code after the back-end code is updated, and identifying the current request path, request method and request parameter type of the back-end service. And acquiring a front-end code, analyzing the front-end code, and identifying a current configuration file in the front-end code. And replacing the current request path, request method and request parameter type of the back-end service with the corresponding part of the current configuration file in the front-end code to generate a front-end interface file. According to the method and the device, the key part in the back-end code is extracted, and finally, the front-end interface file is automatically generated according to the configuration file of the front end, so that the development efficiency is improved.

Description

Method for automatically configuring interface front-end code
Technical Field
The application relates to the technical field of front-end development, in particular to a method for automatically configuring interface front-end codes.
Background
With the development of IT technology, a visual interface is generally generated by a back-end code on a service administration platform and random/fixed data is simulated for front-end calling. Based on this, the interface file of the front end can be generated through the back end code, and the working efficiency of the front end development is improved. Specifically, in the prior art, a request path and a request method required by a front end are identified through a code provided by a back end, and are extracted to generate a corresponding interface file. Meanwhile, the API file can also be configured, the name of the request method is unified with the name of the request path under the default condition, and the name of the request method can also be modified through configuration. And the customized content can be realized by configuring and modifying the fixed content in the method. However, after the code is updated at the back end, only document parameters can be checked through the service administration platform, or mock data can be generated for simulation, so that corresponding front-end interface files cannot be automatically generated, and the automation of the front-end interface cannot be comprehensively realized.
Disclosure of Invention
In order to overcome the problem that a corresponding front-end interface file cannot be automatically generated after a back end updates a code in the related technology at least to a certain extent, the application provides a method for automatically configuring a front-end code of an interface.
The scheme of the application is as follows:
a method of automatically configuring interface front-end code, comprising:
detecting the state of the back-end code in real time;
after the back-end code is updated, analyzing the back-end code, and identifying the current request path, request method and request parameter type of the back-end service;
acquiring a front-end code, analyzing the front-end code, and identifying a current configuration file in the front-end code;
replacing the current request path, request method and request parameter type of the back-end service to the corresponding part of the current configuration file in the front-end code;
and generating a front-end interface file.
Preferably, in an implementable manner of the present application, the parsing the front-end code includes:
converting the front-end code into an abstract syntax tree.
Preferably, in an implementation manner of the present application, the replacing the types of the current request path, the request method, and the request parameter of the backend service to the corresponding portion of the current configuration file in the front-end code includes:
and replacing the current request path, the request method and the type of the request parameter of the back-end service in the abstract syntax tree.
Preferably, in an implementable manner of the present application, the generating a front-end interface file includes:
and converting the replaced abstract syntax tree into JS language or TS language to generate a front-end API.js file or a front-end API.ts file.
Preferably, in an implementation manner of the present application, the method further includes:
and previewing the front-end interface file on a front-end interface.
Preferably, in an implementation manner of the present application, the method further includes:
and pre-running the front-end interface file on a front-end interface.
Preferably, in an implementation manner of the present application, the method further includes:
and updating and saving the back-end configuration based on the interaction adjustment of the front end.
The technical scheme provided by the application can comprise the following beneficial effects: according to the method for automatically configuring the interface front-end code, the state of the back-end code is detected in real time, the back-end code is analyzed after the back-end code is updated, and the current request path, the request method and the type of the request parameter of the back-end service are identified. And acquiring a front-end code, analyzing the front-end code, and identifying a current configuration file in the front-end code. And replacing the current request path, request method and request parameter type of the back-end service with the corresponding part of the current configuration file in the front-end code to generate a front-end interface file. According to the method and the device, the key part in the back-end code is extracted, and finally, the front-end interface file is automatically generated according to the configuration file of the front end, so that the development efficiency is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
Fig. 1 is a flowchart illustrating a method for automatically configuring interface front-end code according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
A method for automatically configuring interface front-end code, referring to fig. 1, comprising:
s11: detecting the state of the back-end code in real time;
in this embodiment, the state of the backend code is detected in real time, so that the front-end interface is guaranteed to be updated in real time.
S12: after the back-end code is updated, analyzing the back-end code, and identifying the current request path, request method and request parameter type of the back-end service;
in this embodiment, after the backend code is updated, the updated backend code is analyzed and identified, so as to obtain the key parameters to be called by the backend service for generating the front-end interface file, such as the current request path, the request method, and the type of the request parameter.
S13: acquiring a front-end code, analyzing the front-end code, and identifying a current configuration file in the front-end code;
preferably, the parsing the front-end code includes: the front-end code is converted into an abstract syntax tree.
In other embodiments, the front-end code may also be converted into a regular expression.
S14: replacing the current request path, request method and request parameter type of the back-end service to the corresponding part of the current configuration file in the front-end code;
the method comprises the following steps: and replacing the current request path, the request method and the type of the request parameter of the back-end service in the abstract syntax tree.
Preferably, in this embodiment, the current request path, request method, and type of the request parameter of the backend service are replaced in the abstract syntax tree in the Apollo distributed configuration center.
In other embodiments, the Apollo distributed configuration center may be replaced by other configuration centers such as Nacos and Config.
S15: and generating a front-end interface file.
Generating a front-end interface file, comprising: and converting the replaced abstract syntax tree into JS language or TS language to generate a front-end API.js file or a front-end API.ts file.
In this embodiment, because the front-end code is generally programmed by the JS language or the TS language, the replaced abstract syntax tree is finally converted into the JS language or the TS language, and the front-end api. JS file or the front-end api.ts file is generated.
In the method for automatically configuring the front-end code of the interface in this embodiment, the state of the back-end code is detected in real time, and after the back-end code is updated, the back-end code is analyzed to identify the current request path, the request method and the type of the request parameter of the back-end service. And acquiring a front-end code, analyzing the front-end code, and identifying a current configuration file in the front-end code. And replacing the current request path, request method and request parameter type of the back-end service with the corresponding part of the current configuration file in the front-end code to generate a front-end interface file. According to the method and the device, the key part in the back-end code is extracted, and finally, the front-end interface file is automatically generated according to the configuration file of the front end, so that the development efficiency is improved.
The method for automatically configuring interface front-end code in some embodiments, further comprising:
the method comprises the steps of previewing and pre-running a front-end interface file on a front-end interface.
In this embodiment, the front-end interface file is also previewed and pre-run on the front-end interface to test whether the generated front-end interface file is feasible.
The method for automatically configuring interface front-end code in some embodiments, further comprising:
and updating and saving the back-end configuration based on the interaction adjustment of the front end.
In this embodiment, update and saving of the back-end configuration are also achieved based on the interaction adjustment of the front-end.
An apparatus for automatically configuring interface front-end code, comprising:
a processor and a memory;
the processor and the memory are connected through a communication bus:
the processor is used for calling and executing the program stored in the memory;
the memory for storing a program for at least a method of automatically configuring interface front end code as claimed in any one of the above.
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar parts in other embodiments may be referred to for the content which is not described in detail in some embodiments.
It should be noted that, in the description of the present application, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present application, the meaning of "a plurality" means at least two unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and the scope of the preferred embodiments of the present application includes other implementations in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present application.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.

Claims (7)

1. A method for automatically configuring interface front-end code, comprising:
detecting the state of the back-end code in real time;
after the back-end code is updated, analyzing the back-end code, and identifying the current request path, request method and request parameter type of the back-end service;
acquiring a front-end code, analyzing the front-end code, and identifying a current configuration file in the front-end code;
replacing the current request path, request method and request parameter type of the back-end service to the corresponding part of the current configuration file in the front-end code;
and generating a front-end interface file.
2. The method of claim 1, wherein the parsing the front-end code comprises:
converting the front-end code into an abstract syntax tree.
3. The method of claim 2, wherein the replacing the type of the current request path, request method and request parameters of the back-end service to the corresponding part of the current configuration file in the front-end code comprises:
and replacing the current request path, the request method and the type of the request parameter of the back-end service in the abstract syntax tree.
4. The method of claim 3, wherein generating a front-end interface file comprises:
and converting the replaced abstract syntax tree into JS language or TS language to generate a front-end API.js file or a front-end API.ts file.
5. The method of claim 1, further comprising:
and previewing the front-end interface file on a front-end interface.
6. The method of claim 1, further comprising:
and pre-running the front-end interface file on a front-end interface.
7. The method of claim 1, further comprising:
and updating and saving the back-end configuration based on the interaction adjustment of the front end.
CN202111186745.8A 2021-10-12 2021-10-12 Method for automatically configuring interface front-end code Pending CN113918150A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111186745.8A CN113918150A (en) 2021-10-12 2021-10-12 Method for automatically configuring interface front-end code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111186745.8A CN113918150A (en) 2021-10-12 2021-10-12 Method for automatically configuring interface front-end code

Publications (1)

Publication Number Publication Date
CN113918150A true CN113918150A (en) 2022-01-11

Family

ID=79239480

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111186745.8A Pending CN113918150A (en) 2021-10-12 2021-10-12 Method for automatically configuring interface front-end code

Country Status (1)

Country Link
CN (1) CN113918150A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115640045A (en) * 2022-12-26 2023-01-24 卓望数码技术(深圳)有限公司 Low-code development platform based on domain-driven design and business system creation method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115640045A (en) * 2022-12-26 2023-01-24 卓望数码技术(深圳)有限公司 Low-code development platform based on domain-driven design and business system creation method

Similar Documents

Publication Publication Date Title
US8495572B2 (en) Apparatus and method for identifying contextual changes in source code
CN111061643B (en) SDK cluster compatibility detection method and device, electronic equipment and storage medium
US20140075242A1 (en) Testing rest api applications
US20130227519A1 (en) Methods and systems for parsing data objects
CN107562556B (en) Failure recovery method, recovery device and storage medium
CN110765018B (en) Automatic interface testing method and equipment
CN111142899B (en) Database script execution method and device, storage medium and electronic equipment
US11385898B2 (en) Task orchestration method for data processing, orchestrator, device and readable storage medium
CN111949520A (en) Automatic interface test method and equipment
US20210026756A1 (en) Deriving software application dependency trees for white-box testing
US9201897B1 (en) Global data storage combining multiple back-end storage devices
CN113918150A (en) Method for automatically configuring interface front-end code
CN111581183A (en) Data migration method and device based on data model
CN109446047B (en) Performance test platform script storage method, device, equipment and storage medium
CA3065729A1 (en) Business rules processing framework
CN112486546A (en) SQLITE database upgrading method, device, terminal and system
CN111159207B (en) Information processing method and device
CN112379944A (en) Resource file loading method and device, storage medium and terminal equipment
US20190294418A1 (en) Multi-platform interface framework
CN115268861B (en) Introduction method, system, equipment and storage medium of custom component
CN116010287A (en) Method for automatically generating interface test case
CN110765196A (en) Method and equipment for generating and executing ETL task
CN113590297A (en) Method and equipment for transmitting process parameters back and forth
CN114489674A (en) Data verification method and device of dynamic data model
WO2022214200A1 (en) Method and network element for pre-upgrade use case validation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination