Interface publishing method, system, computer device and storage medium

By generating and managing the description files and code of the API interface, establishing mapping relationships and marking the online status, the problem of poor API interface status and version management is solved, and accurate transmission and efficient management are achieved.

CN114416165BActive Publication Date: 2025-03-28DOUYIN VISION CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111641090.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-03-28
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

The definition, development and release process of API interfaces lacks management, which makes it impossible for API users to accurately know the interface status of the API interface and the version of the API interface used.

Method used

By generating interface description files and sending them to the target client, generating interface codes and recording version numbers, packaging, compiling and publishing interface codes, establishing a mapping relationship between identification numbers before and after processing, determining the interface description file version number based on the file version number to be published and marking the online status.

Benefits of technology

It realizes the accurate transmission of status and version information of the API interface, reduces the cost of verbal communication, and improves the management efficiency of the API interface.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114416165B_ABST
    Figure CN114416165B_ABST
Patent Text Reader

Abstract

The present disclosure provides an interface publishing method, system, computer device and storage medium, wherein the method comprises: generating an interface description file of a target interface, and sending the interface description file to a target client; after receiving confirmation information of the target client for the interface description file, generating an interface code corresponding to the interface description file, and recording a version number of the interface description file; after packaging, compiling and publishing the interface code in sequence, generating a mapping relationship between a post-processing identification number and a pre-processing identification number; after obtaining a publishing message carrying a version number of a file to be published, determining the interface description file version number corresponding to the version number of the file to be published based on the version number of the file to be published and the generated mapping relationship, and marking the interface description file version number as an online state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Internet technology, and in particular to an interface publishing method, system, computer device and storage medium. Background Art

[0002] Application Programming Interface (API) is used in programming. Applications can access resources and services in the service system by calling API interfaces. When a new API version needs to be launched, the provider of the API interface will publish the API to the public, and the user of the API will obtain the new version of the API for use.

[0003] Currently, the definition, development, and release of API interfaces are decentralized processes. The API interface R&D plan lacks management of the above processes, resulting in the API users being unable to accurately know the API interface status and the API interface version being used. Summary of the invention

[0004] The embodiments of the present disclosure at least provide an interface publishing method, system, computer device and storage medium.

[0005] In a first aspect, an embodiment of the present disclosure further provides an interface publishing method, including:

[0006] Generate an interface description file of the target interface, and send the interface description file to the target client;

[0007] After receiving confirmation information from the target client regarding the interface description file, generating an interface code corresponding to the interface description file and recording a version number of the interface description file;

[0008] After the interface code is packaged, compiled and released in sequence, a mapping relationship between the identification number after processing and the identification number before processing is generated;

[0009] After obtaining the release message carrying the version number of the file to be released, based on the version number of the file to be released and the generated mapping relationship, determine the interface description file version number corresponding to the version number of the file to be released, and mark the interface description file version number as online.

[0010] In a possible implementation manner, determining the interface description file version number corresponding to the to-be-published file version number based on the to-be-published file version number and the generated mapping relationship includes:

[0011] Determine the submission identifier based on the version number of the file to be published and the generated third mapping relationship; determine the code package version number based on the submission identifier and the generated second mapping relationship; determine the interface description file version number based on the code package version number and the generated first mapping relationship;

[0012] Among them, the first mapping relationship is the mapping relationship between the code package version number of the code package generated when the interface code is packaged and the version number of the interface description file; the second mapping relationship is the mapping relationship between the submission identifier generated for the received business logic code and the code package version number; the business logic code is generated for the code package; the third mapping relationship is the mapping relationship between the to-be-published file version number of the binary API interface file generated when the business logic code is compiled and the submission identifier.

[0013] In a possible implementation manner, sending the interface description file to the target client includes:

[0014] Get the target interface description file corresponding to the most recently released target interface description file version number;

[0015] Compare the field information in the target interface description file with the field information in the interface description file defined this time, and determine whether the interface description file defined this time is compatible;

[0016] When compatibility is determined, the interface description file is sent to the target client.

[0017] In a possible implementation manner, after receiving a release message carrying a version number of a file to be released, based on the version number of the file to be released and each generated mapping relationship, determining the interface description file version number corresponding to the version number of the file to be released, and marking the interface description file version number as an online state, the method includes:

[0018] A publishing message of the binary API interface file is sent to the target client, so that the target client publishes an application program matching the target interface.

[0019] In a possible implementation manner, the method further includes:

[0020] Based on the interface description file version number corresponding to the binary API interface file, obtaining an interface description file matching the interface description file version number;

[0021] Perform traffic analysis on the interface description file to determine field feature information in the interface description file.

[0022] In a second aspect, an embodiment of the present disclosure provides an interface publishing system, including an application programming interface API management module and a code processing module, wherein:

[0023] The API management module is used to generate an interface description file of the target interface and send the interface description file to the target client; after receiving the confirmation information of the target client for the interface description file, generate the interface code corresponding to the interface description file and record the interface description file version number; send the interface code and the interface description file version number to the code processing module, and the code processing module implements the packaging, compilation and release of the interface code, and respectively obtains the mapping relationship between the post-processing identification number and the pre-processing identification number generated by the code processing module after executing different stages of processing; after obtaining the release message sent by the code processing module carrying the version number of the file to be released, determine the interface description file version number corresponding to the version number of the file to be released based on the version number of the file to be released and the various mapping relationships obtained, and mark the interface description file version number as online;

[0024] The code processing module is used to generate a mapping relationship between the post-processing identification number and the pre-processing identification number after executing different stages of processing, send the mapping relationship to the API management module, and after implementing code release, send a release message carrying the version number of the file to be released to the API management module.

[0025] In a possible implementation, the code processing module includes a package management module, a code repository, a software configuration management SCM module, and a platform as a service PaaS module; wherein:

[0026] The package management module is used to package the interface code received from the API management module to obtain a code package; generate a first mapping relationship between the code package version number of the code package and the interface description file version number, and send the first mapping relationship to the API management module; send the code package carrying the code package version number to the code repository;

[0027] The code repository is used to receive the business logic code generated for the code package, generate a submission identifier for the business logic code; and send the submission identifier to the SCM module;

[0028] The SCM module is used to download the business logic code from the code repository based on the submission identifier; generate a second mapping relationship between the submission identifier and the code package version number; send the second mapping relationship to the API management module; compile the business logic code to generate a binary API interface file to be released, and record the version number of the binary API interface file to be released; generate a third mapping relationship between the version number of the file to be released and the submission identifier, and send the third mapping relationship to the API management module; and send the binary API interface file carrying the version number of the file to be released to the PaaS module for release;

[0029] The PaaS module is used to publish the binary API interface file and send a publishing message carrying the version number of the to-be-published file of the binary API interface file to the API management module;

[0030] The API management module is specifically used to send the interface code to the package management module; after receiving the release message of the PaaS module, determine the submission identifier based on the version number of the file to be published carried in the release message and the obtained third mapping relationship; determine the code package version number based on the submission identifier and the obtained second mapping relationship; determine the interface description file version number based on the code package version number and the obtained first mapping relationship.

[0031] In a possible implementation manner, the API management module is further used to:

[0032] Get the target interface description file corresponding to the most recently released target interface description file version number;

[0033] Compare the field information in the target interface description file with the field information in the interface description file defined this time, and determine whether the interface description file defined this time is compatible;

[0034] When compatibility is determined, the interface description file is sent to the target client.

[0035] In a possible implementation manner, the API management module is further used to:

[0036] A publishing message of the binary API interface file is sent to the target client, so that the target client publishes an application program matching the target interface.

[0037] In a possible implementation manner, the API management module is further used to:

[0038] Based on the interface description file version number corresponding to the binary API interface file, obtaining an interface description file matching the interface description file version number;

[0039] Perform traffic analysis on the interface description file to determine field feature information in the interface description file.

[0040] In a third aspect, an embodiment of the present disclosure further provides a computer device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are performed.

[0041] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are executed.

[0042] An interface publishing method, system, computer device and storage medium provided by the embodiments of the present disclosure generate a mapping relationship between a post-processing identification number and a pre-processing identification number by packaging, compiling and publishing the interface code. After the code is published, the interface description file version number corresponding to the file version number to be published can be determined based on the file version number to be published and the various mapping relationships generated. The online status can be marked based on the interface description file version number, so that the target client can accurately know the interface status of the API interface and the version of the API interface used. Moreover, the process of obtaining the interface status of the API interface and the version of the API interface used is completed online, reducing the communication cost of verbal communication confirmation.

[0043] Furthermore, by using the interface publishing method provided by the embodiment of the present disclosure, the online status of the target interface can be marked according to the interface description file version number during the historical publishing process of the target interface. Therefore, the target interface description file corresponding to the target interface description file version number released most recently can be obtained, and then the need for compatibility testing of the interface description file defined this time can be met according to the most recently released target interface description file.

[0044] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.

[0046] Figure 1 A schematic diagram of an interface publishing method provided by an embodiment of the present disclosure is shown;

[0047] Figure 2 A schematic diagram of the structure of an interface publishing system provided by an embodiment of the present disclosure is shown;

[0048] Figure 3 A schematic diagram showing the structure of another interface publishing system provided by an embodiment of the present disclosure is shown;

[0049] Figure 4 A workflow diagram of an interface publishing system provided by an embodiment of the present disclosure is shown;

[0050] Figure 5 A schematic diagram of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.

[0052] Currently, the definition, development, and release of API interfaces are decentralized processes. The API interface R&D plan lacks management of the above processes, resulting in the API users being unable to accurately know the API interface status and the API interface version being used.

[0053] Based on this, an interface publishing method, system, computer device and storage medium provided by the embodiments of the present disclosure generate a mapping relationship between a post-processing identification number and a pre-processing identification number by packaging, compiling and publishing the interface code. After the code is released, the interface description file version number corresponding to the file version number to be released can be determined based on the file version number to be released and the various mapping relationships obtained. The online status can be marked based on the interface description file version number, so that the target client can accurately know the interface status of the API interface and the version of the API interface used. Moreover, the process of obtaining the interface status of the API interface and the version of the API interface used is completed online, reducing the communication cost due to verbal communication and confirmation.

[0054] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.

[0055] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0056] First of all, it should be noted that an interface publishing method provided in an embodiment of the present disclosure is mainly applied to an interface publishing system. The interface publishing system may include an application programming interface API management module and a code processing module, wherein the code processing module may also include a package management module, a code repository, a software configuration management SCM module, and a platform as a service PaaS module.

[0057] To facilitate understanding of this embodiment, a method for publishing an interface disclosed in the embodiment of the present disclosure is first introduced in detail. The working principle of the interface publishing system provided in the embodiment of the present disclosure will be described in detail later.

[0058] Reference Figure 1 FIG. 1 is a flow chart of an interface publishing method provided by an embodiment of the present disclosure, wherein the method includes:

[0059] S101: Generate an interface description file of a target interface, and send the interface description file to a target client.

[0060] In the disclosed embodiment, the interface description file can be used to define the target interface, and the interface description file may include information such as the interface name, interface function description information, request method, input parameters, return value, and Uniform Resource Locator (URL). In a specific implementation, the interface description file of the target interface is sent to the target client so that the developer corresponding to the target client confirms the interface description file of the target interface. In a specific implementation, the API management module may send the interface description file to the client. If the developer corresponding to the target client confirms that the interface description file is correct, confirmation information for the interface description file will be returned.

[0061] In one implementation, the most recently released version number of the target interface description file can be obtained, and then the corresponding target interface description file can be obtained based on the target interface description file version number. The field information in the target interface description file is compared with the field information in the interface description file defined this time to determine whether the interface description file defined this time is compatible; if it is determined to be compatible, the interface description file can be sent to the target client so that the target client can confirm the interface description file defined this time. If it is determined to be incompatible, the interface description file defined this time cannot generate interface code and complete compilation and online.

[0062] S102: After receiving confirmation information from the target client regarding the interface description file, generate an interface code corresponding to the interface description file and record a version number of the interface description file.

[0063] Here, the API management module 201 may generate an interface code corresponding to the interface description file according to the interface description file, and record the interface description file version number corresponding to the interface code, and the interface description file version number may be recorded as API version.

[0064] S103: After the interface code is packaged, compiled and released in sequence, a mapping relationship between the identification number after processing and the identification number before processing is generated.

[0065] Here, the interface code can be packaged first to obtain a code package, and a first mapping relationship between the code package version number and the interface description file version number of the code package can be generated. Here, the package management module can be used to package the interface code. Next, the code package can also generate business logic code and a submission identifier for the business logic code. Here, a corresponding submission identifier can be generated for each submitted business logic code, and the submission identifier can be recorded as Commit ID. In a specific implementation, each business logic code can be managed according to the submission identifier. The generated submission identifier can be sent to the SCM module. The submission identifier can generate a second mapping relationship with the code package version number. In a specific implementation, the second mapping relationship can be completed in the SCM module. The SCM module can download the business logic code from the code repository based on the submission identifier.

[0066] Next, the business logic code may be compiled, and a mapping relationship between the identification number after compilation (the version number of the file to be released in the following text) and the identification number before compilation (submission identification) is generated, that is, the third mapping relationship.

[0067] S104: After obtaining the release message carrying the version number of the file to be released, based on the version number of the file to be released and the generated mapping relationship, determine the interface description file version number corresponding to the version number of the file to be released, and mark the interface description file version number as online.

[0068] In one method, the submission identifier can be determined based on the version number of the file to be released and the generated third mapping relationship; the code package version number can be determined based on the submission identifier and the generated second mapping relationship; the interface description file version number can be determined based on the code package version number and the generated first mapping relationship; wherein the first mapping relationship is the mapping relationship between the code package version number and the interface description file version number of the code package generated when the interface code is packaged in the package management module; the second mapping relationship is the mapping relationship between the submission identifier generated by the code repository for the received business logic code and the code package version number; the business logic code is generated for the code package; the third mapping relationship is the mapping relationship between the version number of the file to be released and the submission identifier of the binary API interface file generated when the business logic code is compiled in the SCM module.

[0069] Finally, the interface description file version number API version is marked as the online status, that is, the interface description file version number API version is the online version, and the online version is notified to the target client.

[0070] In one implementation, after marking the version number of the interface description file as being in an online state, a publishing message of the binary API interface file may be sent to the target client so that the target client publishes an application matching the target interface.

[0071] In the disclosed embodiment, it is also possible to obtain an interface description file that matches the interface description file version number based on the interface description file version number corresponding to the binary API interface file; then perform traffic parsing on the interface description file to determine the field feature information in the interface description file. Through the obtained field feature information, the request parameters and response results in the interface are tested to determine whether the product functions meet expectations, etc. Among them, the above implementation method can be applied to the process of capturing packets of interfaces transmitted using binary protocols such as Protocol Buffers (abbreviated as ProtoBuf) and Thrift, which will not be described in detail here.

[0072] Based on the same inventive concept, an interface publishing system corresponding to the interface publishing method is also provided in an embodiment of the present disclosure.

[0073] See also Figure 2 FIG. 2 is a schematic diagram of the structure of an interface publishing system provided in an embodiment of the present disclosure. The interface publishing system 200 includes an application programming interface API management module 201 and a code processing module 202, wherein:

[0074] The API management module 201 is used to generate an interface description file of the target interface and send the interface description file to the target client; after receiving the confirmation information of the target client for the interface description file, generate the interface code corresponding to the interface description file and record the interface description file version number; send the interface code and the interface description file version number to the code processing module 202, and the code processing module 202 implements the packaging, compilation and release of the interface code, and obtains the mapping relationship between the post-processing identification number and the pre-processing identification number generated by the code processing module after executing different stages of processing; after obtaining the release message sent by the code processing module 202 carrying the version number of the file to be released, determine the interface description file version number corresponding to the version number of the file to be released based on the version number of the file to be released and the obtained mapping relationships, and mark the interface description file version number as online.

[0075] The code processing module 202 is used to generate a mapping relationship between the post-processing identification number and the pre-processing identification number after executing different stages of processing, send the mapping relationship to the API management module 201, and after implementing code release, send a release message carrying the version number of the file to be released to the API management module 201.

[0076] Here, the API management module 201 is mainly responsible for managing the life cycle of the interface code and version corresponding to the API interface. The life cycle of the API interface may include three stages: interface definition, interface development and interface release.

[0077] like Figure 4 In the workflow diagram of the interface publishing system shown, in the interface definition stage, the API management module 201 is used to generate an interface description file of the target interface and send the interface description file to the target client; after receiving the confirmation information of the target client for the interface description file, the interface code corresponding to the interface description file is generated, and the interface description file version number is recorded; the interface code and the interface description file version number are sent to the code processing module 202, and the code processing module 202 implements the packaging of the interface code, and the code processing module 202 generates a mapping relationship (hereinafter referred to as the first mapping relationship) between the identification number after packaging processing (hereinafter referred to as the code package version number) and the identification number before packaging processing (hereinafter referred to as the interface description file version number).

[0078] The interface description file is used to define the target interface, and may include information such as the interface name, interface function description information, request method, input parameters, return value, and Uniform Resource Locator (URL).

[0079] The API management module 201 sends the interface description file of the target interface to the target client, with the aim of enabling the developer corresponding to the target client to confirm the interface description file of the target interface and determine whether the definition of the target interface in the interface description file meets its own usage requirements, such as determining whether the interface functions, request methods, etc. meet the usage requirements of the target client.

[0080] If the developer corresponding to the target client confirms that the interface description file is correct, confirmation information for the interface description file will be returned. After receiving the confirmation information for the interface description file returned by the target client, the API management module 201 will execute subsequent processes such as generating interface code corresponding to the interface description file.

[0081] If the developer corresponding to the target client believes that the interface description file is incorrect, incorrect information can be returned. At this time, the API management module 201 will not be able to execute subsequent processes such as generating interface code corresponding to the interface description file, but will need to modify the interface description file until confirmation information for the interface description file is received from the target client.

[0082] The API management module 201 will generate the interface code corresponding to the interface description file based on the interface description file, and record the interface description file version number corresponding to the interface code, which is recorded as API version. Then, the API management module 201 sends the interface code and the interface description file version number to the code processing module 202, and the code processing module 202 packages the interface code to generate a code package corresponding to the interface code. At this time, the code processing module 202 can generate a code package version number corresponding to the code package, recorded as Codegen version; and generate a first mapping relationship between the code package version number and the interface description file version number, recorded as Codegen version=>API version. Finally, the code processing module 202 returns the first mapping relationship to the API management module 201.

[0083] In one embodiment, Figure 3 As shown, the code processing module 202 may include a package management module 2021, a code repository 2022, a software configuration management SCM module 2023, and a platform as a service PaaS module 2024. The API management module 201 is also used to send the interface code to the package management module 201.

[0084] The package management platform 2021 in the code processing module 202 can be used to package the interface code received from the API management module 201 to obtain a code package; generate a first mapping relationship between the code package version number and the interface description file version number of the code package, and send the first mapping relationship to the API management module 201. Common package management platforms 2021 may include NPM (Node Package Manager) package manager, maven package manager, and gomod package manager.

[0085] During the interface development phase, the code repository 2022 in the code processing module 202 may include an open source distributed version control system GIT, an open source version control system SVN (i.e., Subversion), etc. The code repository 2022 may be used to manage code packages.

[0086] Specifically, the code repository 2022 is used to receive the business logic code generated for the code package, generate a submission identifier for the business logic code, and send the submission identifier to the SCM module 2023.

[0087] Here, a corresponding submission identifier can be generated for each submitted business logic code, and the submission identifier can be recorded as Commit ID. In the code warehouse 2022, each business logic code is managed according to the submission identifier. In a specific implementation, the code warehouse 2022 can send a message queue MQ (Message Queue) carrying the submission identifier to the SCM module 203.

[0088] Next, the code processing module 202 compiles the business logic code and generates a mapping relationship (the third mapping relationship in the following text) between the identification number after compilation (the version number of the file to be released in the following text) and the identification number before compilation (the submission identification in the following text).

[0089] Before compiling the business logic code, the code processing module 202 needs to download the business logic code from the code repository 2022 .

[0090] Therefore, in one embodiment, the SCM module 2023 in the code processing module 202 can be used to download the business logic code from the code repository 2022 and compile the business logic code. Specifically, the SCM module 2023 is used to download the business logic code from the code repository based on the submission identifier; generate a second mapping relationship between the submission identifier and the code package version number; send the second mapping relationship to the API management module 201; compile the business logic code to generate a binary API interface file to be released, and record the version number of the binary API interface file to be released; generate a third mapping relationship between the version number of the file to be released and the submission identifier, and send the third mapping relationship to the API management module 201; and send the binary API interface file carrying the version number of the file to be released to the PaaS module 204 for release.

[0091] Here, after receiving the MQ message sent by the code repository 2022, the SCM module 2023 can download the corresponding business logic code from the code repository based on the commit identifier in the MQ message. And generate a second mapping relationship between the commit identifier and the code package version number, recorded as Commit ID=>Codegen version. The SCM module 2023 sends the second mapping relationship to the API management module 201.

[0092] Then, the SCM module 2023 can compile the business logic code to generate a binary API interface file to be released, and record the version number of the binary API interface file to be released, which is recorded as SCM version, that is, the image package version.

[0093] At this time, the SCM module 2023 is also used to generate a third mapping relationship between the version number of the file to be released and the commit ID, recorded as SCM version=>Commit ID. The SCM module 2023 is also used to send the binary API interface file carrying the version number of the file to be released to the PaaS module 2024 for release.

[0094] In the interface publishing stage, the PaaS module 2024 is used to publish the binary API interface file and send a publishing message carrying the version number of the binary API interface file to be published to the API management module 201.

[0095] At this time, the API management module 201 monitors the release message of the PaaS module 2024. The API management module 201 is used to determine the interface description file version number corresponding to the to-be-released file version number based on the to-be-released file version number and the generated mapping relationship after obtaining the release message carrying the to-be-released file version number sent by the code processing module 202, and mark the interface description file version number as online.

[0096] Specifically, after receiving the release message of the PaaS module 2024, the API management module 201 is used to determine the submission identifier based on the version number of the file to be published carried in the release message and the obtained third mapping relationship; determine the code package version number based on the submission identifier and the obtained second mapping relationship; determine the interface description file version number based on the code package version number and the obtained first mapping relationship.

[0097] That is, the API management module 201 can determine the commit identifier Commit ID based on the version number of the file to be released SCM version and the third mapping relationship SCM version=>Commit ID; then determine the code package version number Codegenversion based on the commit identifier Commit ID and the second mapping relationship Commit ID=>Codegen version; then determine the interface description file version number API version based on the code package version number Codegen version and the first mapping relationship Codegen version=>API version.

[0098] Finally, the API management module 201 is used to mark the interface description file version number API version as an online state, that is, the interface description file version number API version is an online version, and notify the target client of the online version.

[0099] Therefore, in one embodiment, the API management module 201 is also used to: send a release message of the binary API interface file to the target client, so that the target client releases an application that matches the target interface. Based on the interface description file version number API version of the online status, the target client can accurately know the online status of the target interface, and then can release an application (Application, APP) that matches the target interface on the target client. When a new client wants to use the API interface, it can know that the API interface corresponding to the interface description file version number has been online and can be used through the marked interface description file version number.

[0100] By using the interface publishing system provided by the embodiment of the present disclosure, the compatibility test of the interface can be implemented by marking the online status of the target interface based on the interface description file version number during the interface publishing stage. Specifically, in one embodiment, the API management module 201 is also used to: obtain the target interface description file corresponding to the target interface description file version number released most recently; compare the field information in the target interface description file with the field information in the interface description file defined this time to determine whether the interface description file defined this time is compatible; if it is determined to be compatible, send the interface description file to the target client.

[0101] By using the interface publishing system provided by the embodiment of the present disclosure, the online status of the target interface can be marked according to the interface description file version number during the historical publishing process of the target interface. Therefore, the version number of the target interface description file released most recently can be obtained, and then the corresponding target interface description file can be obtained according to the target interface description file version number.

[0102] Then, in the interface definition stage, the interface description file defined this time is obtained, and then a compatibility test can be performed based on the target interface description file and the interface description file defined this time. In the specific implementation process, the field information in the target interface description file is compared with the field information in the interface description file defined this time to determine whether the interface description file defined this time is compatible. If it is determined that there is compatibility, the interface description file can be sent to the target client so that the target client can confirm the interface description file defined this time. If it is determined that there is no compatibility, the interface description file defined this time cannot generate interface code and complete the compilation and online.

[0103] The interface publishing system provided by the embodiment of the present disclosure can also realize traffic analysis. Specifically, in one embodiment, the API management module 201 is also used to: obtain the interface description file matching the interface description file version number based on the interface description file version number corresponding to the binary API interface file; perform traffic analysis on the interface description file to determine the field feature information in the interface description file. Through the obtained field feature information, the request parameters and response results in the interface are tested to determine whether the product functions meet expectations.

[0104] The above implementation can be applied to the process of capturing packets of interfaces using binary protocols such as Protocol Buffers (ProtoBuf for short) and Thrift, and will not be described in detail here.

[0105] Since the principle of solving the problem by the interface publishing system in the embodiment of the present disclosure is similar to the above-mentioned interface publishing method in the embodiment of the present disclosure, the implementation of the system can refer to the implementation of the method, and the repeated parts will not be repeated.

[0106] Based on the same technical concept, the embodiment of the present disclosure also provides a computer device. Figure 5 As shown, it is a schematic diagram of the structure of a computer device 500 provided in an embodiment of the present disclosure, including a processor 501, a memory 502, and a bus 503. Among them, the memory 502 is used to store execution instructions, including a memory 5021 and an external memory 5022; the memory 5021 here is also called an internal memory, which is used to temporarily store the operation data in the processor 501, and the data exchanged with the external memory 5022 such as a hard disk. The processor 501 exchanges data with the external memory 5022 through the memory 5021. When the computer device 500 is running, the processor 501 communicates with the memory 502 through the bus 503, so that the processor 501 executes the following instructions:

[0107] Generate an interface description file of the target interface, and send the interface description file to the target client;

[0108] After receiving confirmation information from the target client regarding the interface description file, generating an interface code corresponding to the interface description file and recording a version number of the interface description file;

[0109] After the interface code is packaged, compiled and released in sequence, a mapping relationship between the identification number after processing and the identification number before processing is generated;

[0110] After obtaining the release message carrying the version number of the file to be released, based on the version number of the file to be released and the generated mapping relationship, determine the interface description file version number corresponding to the version number of the file to be released, and mark the interface description file version number as online.

[0111] The embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the interface publishing method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0112] The present disclosure also provides a computer program product that carries a program code. The program code includes instructions that can be used to execute the steps of the interface publishing method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.

[0113] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).

[0114] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.

[0115] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0116] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0117] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0118] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be based on the protection scope of the claims.

Claims

1. An interface publishing method, characterized in that: The method comprises: Generate an interface description file of the target interface, and send the interface description file to the target client; After receiving confirmation information from the target client regarding the interface description file, generating an interface code corresponding to the interface description file and recording a version number of the interface description file; After the interface code is packaged, compiled and released in sequence, a mapping relationship between the identification number after processing and the identification number before processing is generated; After obtaining the release message carrying the version number of the file to be released, based on the version number of the file to be released and the generated mapping relationship, determine the interface description file version number corresponding to the version number of the file to be released, and mark the interface description file version number as online; Wherein, determining the interface description file version number corresponding to the file version number to be released based on the file version number to be released and the generated mapping relationship includes: Determine the submission identifier based on the version number of the file to be released and the generated third mapping relationship; determine the code package version number based on the submission identifier and the generated second mapping relationship; determine the interface description file version number based on the code package version number and the generated first mapping relationship, Among them, the first mapping relationship is the mapping relationship between the code package version number of the code package generated when the interface code is packaged and the version number of the interface description file; the second mapping relationship is the mapping relationship between the submission identifier generated for the received business logic code and the code package version number; the business logic code is generated for the code package; the third mapping relationship is the mapping relationship between the to-be-published file version number of the binary API interface file generated when the business logic code is compiled and the submission identifier.

2. The interface publishing method according to claim 1, characterized in that: The step of sending the interface description file to the target client comprises: Get the target interface description file corresponding to the most recently released target interface description file version number; Compare the field information in the target interface description file with the field information in the interface description file defined this time, and determine whether the interface description file defined this time is compatible; When compatibility is determined, the interface description file is sent to the target client.

3. The interface publishing method according to claim 2, characterized in that: After receiving a release message carrying a version number of a file to be released, based on the version number of the file to be released and each generated mapping relationship, determining the interface description file version number corresponding to the version number of the file to be released, and marking the interface description file version number as an online state, the method includes: A publishing message of a binary API interface file is sent to the target client, so that the target client publishes an application program matching the target interface.

4. The interface publishing method according to claim 2, characterized in that: The method further comprises: Based on the interface description file version number corresponding to the binary API interface file, obtaining an interface description file matching the interface description file version number; Perform traffic analysis on the interface description file to determine field feature information in the interface description file.

5. An interface publishing system, characterized in that: It includes an application programming interface (API) management module and a code processing module, including: The API management module is used to generate an interface description file of the target interface and send the interface description file to the target client; after receiving the confirmation information of the target client for the interface description file, generate the interface code corresponding to the interface description file and record the interface description file version number; send the interface code and the interface description file version number to the code processing module, and the code processing module implements the packaging, compilation and release of the interface code, and respectively obtains the mapping relationship between the post-processing identification number and the pre-processing identification number generated by the code processing module after executing different stages of processing; after obtaining the release message sent by the code processing module carrying the version number of the file to be released, determine the interface description file version number corresponding to the version number of the file to be released based on the version number of the file to be released and the various mapping relationships obtained, and mark the interface description file version number as online; The code processing module is used to generate a mapping relationship between a post-processing identification number and a pre-processing identification number after executing processing at different stages, send the mapping relationship to the API management module, and after implementing code release, send a release message carrying a version number of a file to be released to the API management module; Wherein, determining the interface description file version number corresponding to the file version number to be released based on the file version number to be released and the generated mapping relationship includes: Determine the submission identifier based on the version number of the file to be released and the generated third mapping relationship; determine the code package version number based on the submission identifier and the generated second mapping relationship; determine the interface description file version number based on the code package version number and the generated first mapping relationship, Among them, the first mapping relationship is the mapping relationship between the code package version number of the code package generated when the interface code is packaged and the version number of the interface description file; the second mapping relationship is the mapping relationship between the submission identifier generated for the received business logic code and the code package version number; the business logic code is generated for the code package; the third mapping relationship is the mapping relationship between the to-be-published file version number of the binary API interface file generated when the business logic code is compiled and the submission identifier.

6. The interface publishing system according to claim 5, characterized in that: The code processing module includes: a package management module, a code repository, a software configuration management SCM module, and a platform as a service PaaS module; wherein: The package management module is used to package the interface code received from the API management module to obtain a code package; generate a first mapping relationship between the code package version number of the code package and the interface description file version number, and send the first mapping relationship to the API management module; The code repository is used to receive the business logic code generated for the code package, generate a submission identifier for the logic processing code; and send the submission identifier to the SCM module; The SCM module is used to download the business logic code from the code repository based on the submission identifier; generate a second mapping relationship between the submission identifier and the code package version number; send the second mapping relationship to the API management module; compile the business logic code to generate a binary API interface file to be released, and record the version number of the binary API interface file to be released; generate a third mapping relationship between the version number of the file to be released and the submission identifier, and send the third mapping relationship to the API management module; and send the binary API interface file carrying the version number of the file to be released to the PaaS module for release; The PaaS module is used to publish the binary API interface file and send a publishing message carrying the version number of the to-be-published file of the binary API interface file to the API management module; The API management module is specifically used to send the interface code to the package management module; after receiving the release message of the PaaS module, determine the submission identifier based on the version number of the file to be published carried in the release message and the obtained third mapping relationship; determine the code package version number based on the submission identifier and the obtained second mapping relationship; determine the interface description file version number based on the code package version number and the obtained first mapping relationship.

7. The system according to claim 5, characterized in that The API management module is also used to: Get the target interface description file corresponding to the most recently released target interface description file version number; Compare the field information in the target interface description file with the field information in the interface description file defined this time, and determine whether the interface description file defined this time is compatible; When compatibility is determined, the interface description file is sent to the target client.

8. The system according to claim 5, characterized in that The API management module is also used to: A publishing message of a binary API interface file is sent to the target client, so that the target client publishes an application program matching the target interface.

9. The system according to claim 5, characterized in that The API management module is also used to: Based on the interface description file version number corresponding to the binary API interface file, obtaining an interface description file matching the interface description file version number; Perform traffic analysis on the interface description file to determine field feature information in the interface description file.

10. A computer device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the interface publishing method as described in any one of claims 1 to 4 are performed.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the interface publishing method according to any one of claims 1 to 4 are executed.

Citation Information

Patent Citations

  • Open type configuration method and system for IO parameters of field device

    CN101634833A

  • Method for releasing application installation package, terminal device and medium

    CN109542461A

  • Compiling method, device and equipment and storage medium

    CN111752572A