CN111767035A - Application interface docking method and device based on OpenAPI - Google Patents
Application interface docking method and device based on OpenAPI Download PDFInfo
- Publication number
- CN111767035A CN111767035A CN202010576147.0A CN202010576147A CN111767035A CN 111767035 A CN111767035 A CN 111767035A CN 202010576147 A CN202010576147 A CN 202010576147A CN 111767035 A CN111767035 A CN 111767035A
- Authority
- CN
- China
- Prior art keywords
- application
- openapi
- sdk
- interface
- docking
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 55
- 238000003032 molecular docking Methods 0.000 title claims abstract description 54
- 239000007787 solid Substances 0.000 claims description 3
- 238000011161 development Methods 0.000 description 27
- 210000001503 joint Anatomy 0.000 description 27
- 238000010586 diagram Methods 0.000 description 14
- 238000005516 engineering process Methods 0.000 description 4
- 238000004904 shortening Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000012827 research and development Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000005034 decoration Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/73—Program documentation
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Library & Information Science (AREA)
- Computing Systems (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses an application interface docking method and device based on OpenAPI. Wherein, the method comprises the following steps: generating a specification file of an open application programming interface OpenAPI through an application back end; generating a Software Development Kit (SDK) which can be embedded and used at the front end of the application through a standard file; and butting the application front end and the application back end according to the SDK. The invention solves the technical problems of low docking efficiency and long docking time of the API-based application interface docking method in the related art.
Description
Technical Field
The invention relates to the field of webpage development, in particular to an application interface docking method and device based on OpenAPI.
Background
In the development process of the Web application, front-end and back-end API interfacing is often a very important but time-consuming and labor-consuming process. There are generally two solutions in the industry: the first is that a back-end research and development personnel deploys a developed RESTful interface in a development environment, and a front-end research and development personnel uses the interface environment to debug continuously. The second is that front-end and back-end research and development personnel appoint in advance and write API interface documents, then develop in parallel according to the written documents, and finally carry out real data debugging work on a development environment.
The biggest problem of the first scheme is that the efficiency is low, a back-end developer needs to complete or partially complete the development of an application interface first and deploy an environment, and a front-end developer can perform interface joint debugging. This greatly reduces the time of parallel development, greatly affects the overall development efficiency. Fig. 1 is a schematic diagram of the operation sequence of the first scheme of the prior art of the present application, as shown in fig. 1, which can reach 4 months or more in practical use. In addition, since the docking relies on the API interface service of the real deployment, the interface modification in the joint debugging process needs to be recompiled and deployed, which additionally increases the time and labor cost of the docking.
The second solution has the problem of adding the API document, and the front-end development needs to be developed based on the API document. Firstly, extra labor cost is needed for writing a document, secondly, the problem that the document is not updated timely or written wrongly is not matched with an actual API and the like easily occurs, unnecessary docking cost is caused, and finally, the API document can not avoid the problem that parameters are wrong and the like possibly existing in the process that front-end personnel actually call an interface, or a large amount of joint debugging in the later period is needed to expose and solve similar problems. Fig. 2 is a schematic diagram of the operation sequence of the second scheme of the prior art of the present application, as shown in fig. 2, which can reach approximately 5 months in practical use.
The two existing solutions mainly have the following disadvantages: the front end can be butted only by waiting for the development of the back end and deploying a real API environment, so that the development efficiency is low; separate API documents need to be written, causing additional time cost and increasing the chance of errors; the correctness of the API docking code written by the front end cannot be guaranteed, and a large amount of time is needed to be jointly adjusted and confirmed in the real environment in the later period.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides an application interface docking method and device based on an OpenAPI (open application program interface), and aims to at least solve the technical problems of low docking efficiency and long docking time of the application interface docking method based on the API in the related art.
According to an aspect of the embodiments of the present invention, an OpenAPI-based application interface docking method is provided, including: generating a specification file of an open application programming interface OpenAPI through an application back end; generating a Software Development Kit (SDK) which can be embedded and used by an application front end through the standard file; and butting the application front end and the application back end according to the SDK.
Optionally, the generating, by the application backend, the specification file of the OpenAPI includes: writing a definition part code of the OpenAPI through the application back end; analyzing the definition part code through a tool kit of the OpenAPI, and extracting annotation information of the definition part code; and generating the specification file according to the annotation information.
Optionally, the specification file is an interface description file of the open application programming interface OpenAPI.
Optionally, generating the SDK that can be embedded and used by the application front end through the specification file includes: creating a data structure according to the specification file through a tool kit of the OpenAPI; and applying the data structure to a template file of a preset assembly language available to the application front end to generate the SDK of the preset assembly language, wherein the SDK of the preset assembly language is used for being embedded and used by the application front end.
Optionally, the data structure includes: the application backend comprises a first part and a second part, wherein the first part is used for describing an interface endpoint contained in the application backend and an operation method supported by the interface endpoint; the second portion is for describing entities of the application and attributes of the entities.
Optionally, the preset assembly language is TypeScript language; the first part is an interface part, and the second part is a solid part; the interface part corresponds to a path part of the open application programming interface OpenAPI, and the entity part corresponds to a component part of the open application programming interface OpenAPI.
Optionally, the interfacing the application front end and the application back end according to the SDK includes: introducing the SDK into code of the application front end; and directly carrying out interface docking on the application back end through the application front end according to the code.
Optionally, the SDK is further configured to perform at least one of the following operations on data docked by the application front end and the application back end: parameter checking, type checking and automatic completion.
According to another aspect of the embodiments of the present invention, there is also provided an OpenAPI-based application interface docking apparatus, including: the system comprises a first generation module, a second generation module and a third generation module, wherein the first generation module is used for generating a specification file of an open application programming interface OpenAPI through an application back end; the second generation module is used for generating a Software Development Kit (SDK) which can be embedded and used by the application front end through the standard file; and the docking module is used for docking the application front end and the application back end according to the SDK.
According to another aspect of the embodiments of the present invention, a computer storage medium is further provided, where the computer storage medium includes a stored program, and when the program runs, a device where the computer storage medium is located is controlled to execute any one of the above application interface docking methods based on an OpenAPI.
According to another aspect of the embodiments of the present invention, a processor is further provided, where the processor is configured to execute a program, where the program executes the OpenAPI-based application interface interfacing method described in any one of the foregoing embodiments.
In the embodiment of the invention, the specification file of the open application programming interface OpenAPI is generated by an application back end; generating a Software Development Kit (SDK) which can be embedded and used at the front end of the application through a standard file; according to the mode that the application front end and the application rear end are in butt joint according to the SDK, after the specification file of the OpenAPI is generated, the SDK which can be embedded and used by the application front end is generated according to the specification file, so that the application front end is in butt joint according to the SDK and is in butt joint with the application rear end in an early parallel development mode, the aim of completing the butt joint of the application front end and the application rear end in a short time is fulfilled, the technical effects of greatly improving the butt joint efficiency and shortening the butt joint time are achieved, and the technical problems of low butt joint efficiency and long butt joint time of an application interface butt joint method based on the API in the related technology are solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a schematic diagram of the operational timing sequence of a first prior art solution of the present application;
FIG. 2 is a schematic diagram of the operational timing sequence of a second prior art solution of the present application;
FIG. 3 is a flowchart of an OpenAPI-based application interface docking method according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of the operation timing sequence of an application interface docking method according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of code of an interface definition section according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of code to generate an OpenAPI Spec file, according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of code to generate an SDK according to an embodiment of the present invention;
FIG. 8 is a flow chart of the overall process according to an embodiment of the present invention;
fig. 9 is a schematic diagram of an OpenAPI-based application interface interfacing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The present embodiment will be explained below in terms of terms in the art.
OpenAPI: OpenAPI defines a standard, language-independent RESTful API interface description specification
TypeScript: TypeScript is an open source, cross-platform programming language developed by Microsoft. It is a superset of JavaScript and will eventually be compiled into JavaScript code.
And (3) SDK: a software development kit is generally a collection of development tools used by some software engineers to build application software for a particular software package, software framework, hardware platform, operating system, and the like.
In accordance with an embodiment of the present invention, there is provided a method embodiment of an OpenAPI-based application interface interfacing method, it should be noted that the steps illustrated in the flowchart of the accompanying drawings may be executed in a computer system such as a set of computer-executable instructions, and that while a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be executed in an order different than that illustrated herein.
Fig. 3 is a flowchart of an OpenAPI-based application interface docking method according to an embodiment of the present invention, and as shown in fig. 3, the method includes the following steps:
step S302, generating a specification file of an open application programming interface OpenAPI through an application back end;
step S304, generating a Software Development Kit (SDK) which can be embedded and used at the front end of the application through the standard file;
and S306, butting the application front end and the application back end according to the SDK.
Through the steps, a specification file of an open application programming interface OpenAPI is generated through an application back end; generating a Software Development Kit (SDK) which can be embedded and used at the front end of the application through a standard file; according to the mode that the application front end and the application rear end are in butt joint according to the SDK, after the specification file of the OpenAPI is generated, the SDK which can be embedded and used by the application front end is generated according to the specification file, so that the application front end is in butt joint according to the SDK and is in butt joint with the application rear end in an early parallel development mode, the aim of completing the butt joint of the application front end and the application rear end in a short time is fulfilled, the technical effects of greatly improving the butt joint efficiency and shortening the butt joint time are achieved, and the technical problems of low butt joint efficiency and long butt joint time of an application interface butt joint method based on the API in the related technology are solved.
The generation of the specification file of the OpenAPI by the application back end is performed at the application back end, and the specification file of the OpenAPI is a smaller part of an OpenAPI protocol, so the steps are completed in a shorter time by the application back end, usually the time consumption can be about 10 days, and the specification file can be a Spec file of the OpenAPI. Front-end developers can carry out data docking work according to Spec files without waiting for real API development and deployment, and the efficiency of parallel development is guaranteed.
When the front end uses the standard file to carry out data butt joint work, the front end cannot directly operate the standard file, generates a Software Development Kit (SDK) which can be embedded and used by the application front end through the standard file, and carries out data butt joint work according to the SDK. Therefore, the application front end and the application back end can be developed in parallel in the early development stage, the development time of the OpenAPI is greatly shortened, and the technical problems of low docking efficiency and long docking time of an API-based application interface docking method in the related technology are solved.
Optionally, the generating, by the application backend, the specification file of the OpenAPI includes: writing a definition part code of OpenAPI through an application back end; analyzing the defined part of codes through a tool kit of OpenAPI, and extracting annotation information of the defined part of codes; and generating a specification file according to the annotation information.
Since OpenAPI defines a standard, language-independent RESTful API interface description specification, API-related definitions can be written directly using language native annotation syntax, and after successfully writing the code of the interface definition part of the OpenAPI at the application back end, the code of the definition part is analyzed through an OpenAPI toolkit, such as OpenAPI-tools, to extract annotation information of the definition part code; and combining the Spec files which are in accordance with the OpenAPI specification, namely specification files according to the annotation information. Since the code or annotation generating the OpenAPI Spec is itself part of the backend program code, the problems of time cost and error susceptibility of writing API documents separately are avoided.
Optionally, the specification file is an interface specification file of an open application programming interface OpenAPI. Namely the Spec document described above.
Optionally, generating the SDK that can be embedded and used by the application front end through the specification file includes: creating a data structure according to the specification file through a tool kit of the OpenAPI; and applying the data structure to a template file of a preset assembly language available to the application front end to generate the SDK of the preset assembly language, wherein the SDK of the preset assembly language is used for embedding the application front end.
Because the specification file cannot be directly used by the application front end, the specification file is generated into the SDK of the preset assembly language through the preset assembly language available to the application front end, and the SDK can be directly used by the application front end. Specifically, a data structure is created according to the specification file through a toolkit of the OpenAPI; and applying the data structure to a template file of a preset assembly language available at the application front end to generate the SDK of the preset assembly language.
Optionally, the data structure of the specification file includes: the application backend comprises a first part and a second part, wherein the first part is used for describing an interface endpoint contained in the application backend and an operation method supported by the interface endpoint; the second section is used to describe entities and attributes of entities of the application.
The preset assembly language is a TypeScript language which can be directly used by an application front end; the first part is an interface part, namely an api part, and the second part is a solid part, namely a model part; the interface part corresponds to a path part of an open application programming interface OpenAPI, and the entity part corresponds to a component part of the open application programming interface OpenAPI. The path portion of the OpenAPI is a paths portion, and describes an interface endpoint (endpoint) included in a backend program and an operation method (method) supported by the endpoint. The component part of the OpenAPI is the components part, which describes the entities of the application and its attributes. Therefore, the specification file is successfully converted into the SDK available for the application front end, the application front end can implement the execution of the specification file according to the SDK, and the parallel development of the application front end and the application back end is ensured.
Optionally, the docking the application front end and the application back end according to the SDK includes: introducing the SDK into the code of the application front end; and directly carrying out interface docking on the application back end through the application front end according to the codes.
The SDK can be directly connected with the interface of the back end only by introducing the SDK into the code of the front end application, so that the parallel development of the application front end and the application back end is realized.
Optionally, the SDK is further configured to perform at least one of the following operations on data docked by the application front end and the application back end: parameter checking, type checking and automatic completion.
By means of the characteristics of type checking, automatic completion and the like of the TypeScript SDK, the front-end development can efficiently and accurately call the back-end API interface, the time required by joint debugging can be greatly shortened, the butt joint of the application front end and the application back end in the later development period is realized, and the butt joint efficiency and accuracy are effectively improved. Therefore, the butt joint efficiency of the application front end and the application rear end is improved, and the butt joint time is shortened. Further, the technical problems of low docking efficiency and long docking time of the API-based application interface docking method in the related art are solved.
It should be noted that this embodiment also provides an alternative implementation, which is described in detail below.
The core of the embodiment is that a standard OpenAPI Spec file is generated based on codes or comments at the back end of an application program, the OpenAPI Spec is converted into a TypeScript SDK available at the front end in an automatic mode, and then the characteristics of the TypeScript such as strong type checking are utilized to carry out API docking efficiently and accurately.
Fig. 4 is a schematic diagram of an operation timing sequence of an application interface docking method according to an embodiment of the present invention, and as shown in fig. 4, the steps of the embodiment are as follows:
first, a back-end developer need only write a small amount of OpenAPI-related code or annotation at an early stage to generate an OpenAPI Spec file. Front-end developers can carry out data docking work without waiting for real API development and deployment, and the efficiency of parallel development is guaranteed.
Secondly, since the code or annotation generating the OpenAPI Spec is itself part of the backend program code, the problems of time cost and error susceptibility of writing API documents separately are avoided.
Finally, the TypeScript SDK generated using the OpenAPI Spec file can be referenced directly by the front-end code. By means of the characteristics of type checking, automatic completion and the like of the TypeScript, a front-end development can efficiently and accurately call a rear-end API (application program interface), and the time required by joint debugging can be greatly shortened.
The scheme of the embodiment describes an application interface docking method based on OpenAPI, and provides a toolkit OpenAPI-tools for executing the corresponding method.
The embodiment comprises the following main butt joint steps:
generating an OpenAPI Spec based on the back-end code;
generating a TypeScript SDK based on OpenAPI Spec;
the front-end code embeds and uses the TypeScript SDK.
The OpenAPI defines a standard, language independent RESTful API interface description specification. When the program back-end code is written by using languages such as node. js, PHP, Go, etc., the definition related to the API, for example, the code shown in fig. 5, can be written directly by using the native annotation syntax of the language, and fig. 5 is a schematic diagram of the code of the interface definition part according to the embodiment of the present invention.
When the code of the interface definition part is written in a back-end program, the source code can be analyzed by using OpenAPI-tools, the annotation information is extracted, and the annotation information is combined into a Spec file which accords with the OpenAPI specification. Specific code is, for example, the code shown in fig. 6, and fig. 6 is a schematic diagram of code for generating an OpenAPI Spec file according to an embodiment of the present invention. This step is analogous to what many mainstream programming languages, framework-corresponding swagger-php, swagger-express, goswagger, etc. tools do.
After the OpenAPI Spec file is generated, the second step is to use it to generate the SDK of the TypeScript syntax. The OpenAPI-tools automatically create a data structure according to the OpenAPI Spec file, where the data structure includes two parts, namely api and model. The api portion corresponds to the pages portion of the OpenAPI, which describes the interface end point (endpoint) included in the backend program and the operation method (method) supported by the endpoint. The Model section corresponds to the components section of the OpenAPI, describing the entities of the application and its attributes. Then, the data structure is applied to a template file of the TypeScript grammar, and finally, a front-end SDK corresponding to the OpenAPI Spec is obtained. Specific code as shown in fig. 7, fig. 7 is a schematic diagram of a code for generating an SDK according to an embodiment of the present invention.
Finally, the SDK can be directly connected with the interface of the back end only by introducing the SDK into the code of the front end application, and the scheme also provides the functions of intelligent parameter completion, automatic verification and the like, thereby improving the efficiency and the accuracy of connection.
The overall process is shown in fig. 8, and fig. 8 is a flowchart of the overall process according to the embodiment of the present invention, which is as follows:
1. defining a rear-end interface;
2. an OpenAPI Spec file;
3. a front-end SDK;
4. SDK was used.
The embodiment automatically realizes the conversion and generation work from the definition of the rear-end interface to the SDK of the front end based on the same set of device; the generated SDK has the functions of parameter verification, type inspection, automatic completion and the like.
The implementation mode enables the butt joint work of the application interfaces to be decoupled better, optimizes the time of parallel development, improves the efficiency of overall application development and is beneficial to shortening the overall delivery time of a project.
The embodiment is adopted and verified in actual projects, and the result proves that the efficiency and the accuracy of the butt joint work of the front-end interface and the rear-end interface can be greatly improved.
Fig. 9 is a schematic diagram of an OpenAPI-based application interface interfacing device according to an embodiment of the present invention, and as shown in fig. 9, according to another aspect of the embodiment of the present invention, there is further provided an OpenAPI-based application interface interfacing device, including: a first generation module 92, a second generation module 94 and a docking module 96, the apparatus of which is described in detail below.
A first generating module 92, configured to generate a specification file of an open application programming interface OpenAPI through an application backend; a second generation module 94, connected to the first generation module 92, for generating a software development kit SDK that can be embedded and used at the application front end through a specification file; and a docking module 96, connected to the second generating module 94, for docking the application front end and the application back end according to the SDK.
By the device, a first generation module 92 is adopted to generate a specification file of an open application programming interface OpenAPI through an application back end; the second generation module 94 generates a software development kit SDK which can be embedded and used by the application front end through the specification file; the docking module 96 generates an OpenAPI specification file according to the SDK to generate an SDK that can be embedded and used by the application front end according to the specification file after generating the specification file of the OpenAPI, so that the application front end is docked according to the SDK and is docked with earlier parallel development of the application back end, thereby achieving the purpose of completing docking of the application front end and the application back end in a shorter time, and achieving the technical effects of greatly improving docking efficiency and shortening docking time, thereby solving the technical problems of low docking efficiency and long docking time of an API-based application interface docking method in the related art.
According to another aspect of the embodiments of the present invention, a computer storage medium is further provided, where the computer storage medium includes a stored program, and when the program runs, a device in which the computer storage medium is located is controlled to execute any one of the above-mentioned OpenAPI-based application interface docking methods.
According to another aspect of the embodiments of the present invention, a processor is further provided, where the processor is configured to execute a program, where the program executes the OpenAPI-based application interface interfacing method described in any one of the foregoing.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.
Claims (10)
1. An OpenAPI-based application interface docking method is characterized by comprising the following steps:
generating a specification file of an open application programming interface OpenAPI through an application back end;
generating a Software Development Kit (SDK) which can be embedded and used by an application front end through the standard file;
and butting the application front end and the application back end according to the SDK.
2. The method of claim 1, wherein generating, by the application backend, the specification file for the OpenAPI comprises:
writing a definition part code of the OpenAPI through the application back end;
analyzing the definition part code through a tool kit of the OpenAPI, and extracting annotation information of the definition part code;
and generating the specification file according to the annotation information.
3. The method according to claim 2, wherein the specification file is an interface specification file of the open application programming interface, OpenAPI.
4. The method of claim 1, wherein generating the SDK embeddable by the application front-end via the specification file comprises:
creating a data structure according to the specification file through a tool kit of the OpenAPI;
and applying the data structure to a template file of a preset assembly language available to the application front end to generate the SDK of the preset assembly language, wherein the SDK of the preset assembly language is used for being embedded and used by the application front end.
5. The method of claim 4, wherein the data structure comprises: a first portion and a second portion, wherein,
the first part is used for describing an interface endpoint contained in the application back end and an operation method supported by the interface endpoint;
the second portion is for describing entities of the application and attributes of the entities.
6. The method according to claim 5, wherein the predetermined assembly language is a TypeScript language;
the first part is an interface part, and the second part is a solid part;
the interface part corresponds to a path part of the open application programming interface OpenAPI, and the entity part corresponds to a component part of the open application programming interface OpenAPI.
7. The method of claim 1, wherein interfacing the application front-end and the application back-end according to the SDK comprises:
introducing the SDK into code of the application front end;
and directly carrying out interface docking on the application back end through the application front end according to the code.
8. The method of claim 7, wherein the SDK is further configured to at least one of: parameter checking, type checking and automatic completion.
9. An OpenAPI-based application interface docking device, comprising:
the system comprises a first generation module, a second generation module and a third generation module, wherein the first generation module is used for generating a specification file of an open application programming interface OpenAPI through an application back end;
the second generation module is used for generating a Software Development Kit (SDK) which can be embedded and used by the application front end through the standard file;
and the docking module is used for docking the application front end and the application back end according to the SDK.
10. A computer storage medium, comprising a stored program, wherein when the program runs, the computer storage medium controls a device to execute the OpenAPI-based application interface docking method according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010576147.0A CN111767035A (en) | 2020-06-22 | 2020-06-22 | Application interface docking method and device based on OpenAPI |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010576147.0A CN111767035A (en) | 2020-06-22 | 2020-06-22 | Application interface docking method and device based on OpenAPI |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111767035A true CN111767035A (en) | 2020-10-13 |
Family
ID=72721506
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010576147.0A Pending CN111767035A (en) | 2020-06-22 | 2020-06-22 | Application interface docking method and device based on OpenAPI |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111767035A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112395346A (en) * | 2020-12-10 | 2021-02-23 | 四川长虹电器股份有限公司 | Method for collecting data of multi-terminal user |
CN112965705A (en) * | 2021-03-10 | 2021-06-15 | 中国民航信息网络股份有限公司 | Publishing method and device of micro-service interface, electronic equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110162296A (en) * | 2019-04-15 | 2019-08-23 | 平安科技(深圳)有限公司 | Generation method, device and the terminal device of application programming interface document |
CN110244940A (en) * | 2019-06-12 | 2019-09-17 | 四川长虹电器股份有限公司 | Optimize the method and web front-end project structure of web application system development |
CN110457144A (en) * | 2019-08-05 | 2019-11-15 | 北京字节跳动网络技术有限公司 | A kind of method, apparatus that realizing front end applications, medium and equipment |
US20190362077A1 (en) * | 2017-08-11 | 2019-11-28 | Jpmorgan Chase Bank, N.A. | Typescript security scanner |
-
2020
- 2020-06-22 CN CN202010576147.0A patent/CN111767035A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20190362077A1 (en) * | 2017-08-11 | 2019-11-28 | Jpmorgan Chase Bank, N.A. | Typescript security scanner |
CN110162296A (en) * | 2019-04-15 | 2019-08-23 | 平安科技(深圳)有限公司 | Generation method, device and the terminal device of application programming interface document |
CN110244940A (en) * | 2019-06-12 | 2019-09-17 | 四川长虹电器股份有限公司 | Optimize the method and web front-end project structure of web application system development |
CN110457144A (en) * | 2019-08-05 | 2019-11-15 | 北京字节跳动网络技术有限公司 | A kind of method, apparatus that realizing front end applications, medium and equipment |
Non-Patent Citations (2)
Title |
---|
CUBA-CHINA: ""TypeScript SDK 和 REST API"", pages 2, Retrieved from the Internet <URL:《https://www.cnblogs.com/cubacn/p/cuba_spring.html》> * |
SDK.CN: ""Lyft的TypeScript实践"", pages 5, Retrieved from the Internet <URL:《https://www.juhe.cn/news/index/id/2257》> * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112395346A (en) * | 2020-12-10 | 2021-02-23 | 四川长虹电器股份有限公司 | Method for collecting data of multi-terminal user |
CN112965705A (en) * | 2021-03-10 | 2021-06-15 | 中国民航信息网络股份有限公司 | Publishing method and device of micro-service interface, electronic equipment and storage medium |
CN112965705B (en) * | 2021-03-10 | 2024-06-04 | 中国民航信息网络股份有限公司 | Method and device for issuing micro-service interface, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104156314B (en) | A kind of Code Reusing in Building being applied to test system | |
CN109739766B (en) | System and method for rapidly building FPGA digital simulation model | |
US8924937B1 (en) | Method and system for generating verification information and tests for software | |
US10540262B2 (en) | Using edit and continue to dynamically set and unset optimizations in source code while debugging | |
US8407667B2 (en) | Inferring missing type information for reflection | |
CN109117131A (en) | Code generating method and device, storage medium and electric terminal | |
US9223570B2 (en) | Migration assistance using compiler metadata | |
KR101770292B1 (en) | Computer-executable model reverse engineering method and apparatus performing the same | |
US20110302564A1 (en) | Library Conformity Checker | |
CN108647147B (en) | Automatic testing robot implemented by using atlas analysis and use method thereof | |
WO2007001108A1 (en) | System for providing feature-oriented software product line engineering environment | |
CN111767035A (en) | Application interface docking method and device based on OpenAPI | |
US20090112554A1 (en) | Test Bench, Method, and Computer Program Product for Performing a Test Case on an Integrated Circuit | |
CN115858336A (en) | Test vector generation method and device, computing equipment and storage medium | |
Kurita et al. | The Application of VDM to the Industrial Development of Firmware for a Smart Card IC Chip. | |
CN102629213A (en) | Analysis method and monitoring method for C language simulation model | |
US11573787B1 (en) | Hot reloading a running application with an unsaved source code change | |
CN114816419A (en) | Engineering compiling method and device | |
JP2008140263A (en) | Unit test support device | |
CN115328769A (en) | A PDK Development Method Based on Aether Tool | |
CN113110998A (en) | Interface test report generation method and generation device | |
CN113448874A (en) | Method and device for generating unit test script | |
CN117874393B (en) | Method and system for constructing SCA model engineering through XML file | |
CN118779242A (en) | A method and device for generating test code | |
CN118860857A (en) | A testing method for automatic execution system of self-selected use cases |
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 | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 100094 101, floors 1-5, building 7, courtyard 3, fengxiu Middle Road, Haidian District, Beijing Applicant after: Beijing Xingchen Tianhe Technology Co.,Ltd. Address before: 100097 room 806-1, block B, zone 2, Jinyuan times shopping center, indigo factory, Haidian District, Beijing Applicant before: XSKY BEIJING DATA TECHNOLOGY Corp.,Ltd. |
|
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20201013 |