CN114416165A - Interface publishing method, system, computer equipment and storage medium - Google Patents

Interface publishing method, system, computer equipment and storage medium Download PDF

Info

Publication number
CN114416165A
CN114416165A CN202111641090.9A CN202111641090A CN114416165A CN 114416165 A CN114416165 A CN 114416165A CN 202111641090 A CN202111641090 A CN 202111641090A CN 114416165 A CN114416165 A CN 114416165A
Authority
CN
China
Prior art keywords
interface
version number
file
description file
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111641090.9A
Other languages
Chinese (zh)
Inventor
董千里
张子岳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202111641090.9A priority Critical patent/CN114416165A/en
Publication of CN114416165A publication Critical patent/CN114416165A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

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

Abstract

The present disclosure provides an interface issuing method, system, computer device and storage medium, wherein the method includes: generating an interface description file of a target interface, and sending the interface description file to a target client; after receiving the confirmation information of the target client aiming at the interface description file, generating an interface code corresponding to the interface description file, and recording the version number of the interface description file; after the interface codes are sequentially subjected to packaging, compiling and releasing processing, generating a mapping relation between the processed identification numbers and the identification numbers before processing; after a release message carrying the version number of the file to be released is acquired, the version number of the interface description file corresponding to the version number of the file to be released is determined based on the version number of the file to be released and the generated mapping relation, and the version number of the interface description file is marked as an online state.

Description

Interface publishing method, system, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to an interface publishing method, system, computer device, and storage medium.
Background
An Application Programming Interface (API) is used in Programming, and an Application program can access resources and services in a service system by calling the API. When a new API version needs to be online, a provider of the API interface releases the API to the outside, and a user of the API acquires the new version of the API for use.
At present, the definition, development and release processes of the API interface are dispersed processes, and the development scheme of the API interface lacks management on the processes, so that a user of the API cannot accurately know the interface state of the API interface and the version of the used API interface.
Disclosure of Invention
The embodiment of the disclosure at least provides an interface issuing method, an interface issuing system, computer equipment and a storage medium.
In a first aspect, an embodiment of the present disclosure further provides an interface publishing method, including:
generating an interface description file of a target interface, and sending the interface description file to a target client;
after receiving the confirmation information of the target client aiming at the interface description file, generating an interface code corresponding to the interface description file, and recording the version number of the interface description file;
after the interface codes are sequentially subjected to packaging, compiling and releasing processing, generating a mapping relation between the processed identification numbers and the identification numbers before processing;
after a release message carrying the version number of the file to be released is acquired, the version number of the interface description file corresponding to the version number of the file to be released is determined based on the version number of the file to be released and the generated mapping relation, and the version number of the interface description file is marked as an online state.
In a possible implementation manner, the determining, based on the version number of the file to be published and the generated mapping relationship, the version number of the interface description file corresponding to the version number of the file to be published includes:
determining a submission identifier based on the version number of the file to be issued and the generated third mapping relation; determining the version number of the code packet based on the submission identifier and the generated second mapping relation; determining the version number of the interface description file based on the version number of the code packet and the generated first mapping relation;
the first mapping relation is a mapping relation between a code package version number of a generated code package and the interface description file version number when the interface code is packaged; the second mapping relation is a mapping relation between a submission identifier generated aiming at the received service logic code and the code packet version number; the business logic code is generated for the code package; the third mapping relationship is a mapping relationship between the version number of the file to be issued of the binary API interface file generated when the service logic code is compiled and the commit identifier.
In a possible embodiment, the sending the interface description file to the target client includes:
acquiring a target interface description file corresponding to the latest published target interface description file version number;
comparing the field information in the target interface description file with the field information in the interface description file defined this time, and judging whether the interface description file defined this time has compatibility;
and under the condition that the compatibility is determined, the interface description file is sent to the target client.
In a possible implementation manner, after receiving a publishing message carrying a version number of a file to be published, determining, based on the version number of the file to be published and each generated mapping relationship, a version number of an interface description file corresponding to the version number of the file to be published, and marking the version number of the interface description file as an online state, the method includes:
and sending a publishing message of the binary API interface file to the target client so that the target client publishes the application program matched with the target interface.
In a possible embodiment, the method further comprises:
acquiring an interface description file matched with the version number of the interface description file based on the version number of the interface description file corresponding to the binary API interface file;
and carrying out flow analysis on the interface description file, and determining field characteristic information in the interface description file.
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, where:
the API management module is used for generating an interface description file of a target interface and sending the interface description file to a target client; after receiving the confirmation information of the target client aiming at the interface description file, generating an interface code corresponding to the interface description file, and recording the version number of the interface description file; sending the interface code and the interface description file version number to the code processing module, realizing the packaging, compiling and publishing of the interface code by the code processing module, and respectively obtaining the mapping relation between the processed identification number and the identification number before processing which are respectively generated after the code processing module executes the processing of different stages; after a release message carrying the version number of the file to be released and sent by the code processing module is acquired, determining the version number of an interface description file corresponding to the version number of the file to be released based on the version number of the file to be released and the acquired mapping relations, and marking the version number of the interface description file as an online state;
the code processing module is used for respectively generating mapping relations between the identification numbers after processing and the identification numbers before processing after executing the processing of different stages, sending the mapping relations to the API management module, and sending a release message carrying the version number of the file to be released to the API management module after realizing the release of the code.
In one possible implementation, the code processing module comprises a package management module, a code warehouse, a software configuration management SCM module, and a platform as a service PaaS module; wherein:
the package management module is used for packaging the received interface codes from the API management module to obtain a code package; generating a first mapping relation between the code package version number of the code package and the interface description file version number, and sending the first mapping relation to the API management module; sending the code packet carrying the version number of the code packet to the code warehouse;
the code warehouse is used for receiving the business logic codes generated aiming at the code packet and generating submission identifications of the business logic codes; and sending the submission identifier to the SCM module;
the SCM module is used for downloading the business logic code from the code warehouse based on the submission identification; generating a second mapping relation between the submission identifier and the code packet version number; sending the second mapping relation to the API management module; compiling the service logic code to generate a binary API interface file to be issued, and recording the version number of the file to be issued of the binary API interface file; generating a third mapping relation between the version number of the file to be issued and the submission identifier, and sending the third mapping relation to the API management module; sending the binary API interface file carrying the version number of the file to be issued to the PaaS module for issuing;
the PaaS module is used for publishing the binary API interface file and sending a publishing message carrying the version number of the file to be published of the binary API interface file to the API management module;
the API management module is specifically configured to send the interface code to the package management module; after the release message of the PaaS module is received, determining the submission identifier based on the version number of the file to be released carried in the release message and the acquired third mapping relation; determining the code packet version number based on the submission identifier and the acquired second mapping relation; and determining the version number of the interface description file based on the version number of the code packet and the acquired first mapping relation.
In a possible implementation manner, the API management module is further configured to:
acquiring a target interface description file corresponding to the latest published target interface description file version number;
comparing the field information in the target interface description file with the field information in the interface description file defined this time, and judging whether the interface description file defined this time has compatibility;
and in the case of determining that the compatibility exists, sending the interface description file to a target client.
In a possible implementation manner, the API management module is further configured to:
and sending a publishing message of the binary API interface file to the target client so that the target client publishes the application program matched with the target interface.
In a possible implementation manner, the API management module is further configured to:
acquiring an interface description file matched with the version number of the interface description file based on the version number of the interface description file corresponding to the binary API interface file;
and carrying out flow analysis on the interface description file, and determining field characteristic information in the interface description file.
In a third aspect, an embodiment of the present disclosure further provides a computer device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect described above, or any possible implementation of the first aspect.
In a fourth aspect, this disclosed embodiment also provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps in the first aspect or any one of the possible implementation manners of the first aspect.
According to the interface release method, the interface release system, the computer equipment and the storage medium, the mapping relation between the processed identification number and the identification number before processing is generated by packaging, compiling and releasing the interface code, after the code is released, the interface description file version number corresponding to the to-be-released file version number can be determined based on the to-be-released file version number and each generated mapping relation, and the marking of the online state is realized based on the interface description file version number, so that a target client can accurately know the interface state of the API interface and the version of the used API interface, the process of acquiring the interface state of the API interface and the version of the used API interface is completed online, and the communication cost of the oral ditch confirmation is reduced.
Further, by using the interface publishing method provided by the embodiment of the disclosure, in the history publishing process of the target interface, the online state of the target interface can be labeled according to the version number of the interface description file. Therefore, the target interface description file corresponding to the version number of the target interface description file which is released last time can be obtained, and the requirement for performing compatibility test on the interface description file which is defined at this time can be met according to the target interface description file which is released last time.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly described below, and the drawings herein incorporated in and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It is appreciated that the following drawings depict only certain embodiments of the disclosure and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty.
Fig. 1 is a schematic diagram illustrating an interface publishing method provided by an embodiment of the present disclosure;
fig. 2 is a schematic structural diagram illustrating an interface publishing system according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of another interface publishing system provided by the embodiment of the present disclosure;
FIG. 4 is a flowchart illustrating the operation of an interface publishing system provided by an embodiment of the present disclosure;
fig. 5 shows a schematic diagram of a computer device provided by an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure, presented in the figures, is not intended to limit the scope of the claimed disclosure, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the disclosure without making creative efforts, shall fall within the protection scope of the disclosure.
At present, the definition, development and release processes of the API interface are dispersed processes, and the development scheme of the API interface lacks management on the processes, so that a user of the API cannot accurately know the interface state of the API interface and the version of the used API interface.
Based on this, according to the interface publishing method, system, computer device and storage medium provided by the embodiments of the present disclosure, a mapping relationship between the post-processing identification number and the pre-processing identification number is generated by packaging, compiling and publishing the interface code, after the code is published, the version number of the interface description file corresponding to the version number of the file to be published can be determined based on the version number of the file to be published and each obtained mapping relationship, and the label of the online state is realized based on the version number of the interface description file, so that the target client can accurately know the interface state of the API interface and the version of the API interface used, and the process of obtaining the interface state of the API interface and the version of the API interface used is completed online, thereby reducing the communication cost due to the confirmation of the oral sulcus.
The above-mentioned drawbacks are the results of the inventor after practical and careful study, and therefore, the discovery process of the above-mentioned problems and the solutions proposed by the present disclosure to the above-mentioned problems should be the contribution of the inventor in the process of the present disclosure.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
First, it is explained that an interface publishing method provided by the embodiment of the present disclosure is mainly applied to an interface publishing system, and the interface publishing system may include an application programming interface API management module and a code processing module, where the code processing module may further include a package management module, a code warehouse, a software configuration management SCM module, and a platform as a service PaaS module.
To facilitate understanding of the present embodiment, a detailed description is first given of an interface publishing method disclosed in the embodiments of the present disclosure. The working principle of the interface issuing system provided by the embodiment of the disclosure will be described in detail later.
Referring to fig. 1, a schematic flow chart of an interface issuing method provided in the embodiment of the present disclosure is shown, where the method includes:
s101: and generating an interface description file of the target interface, and sending the interface description file to the target client.
In the embodiment of the present disclosure, the interface description file may be used to define a target interface, and the interface description file may include information such as an interface name, interface function description information, a request mode, an incoming parameter, a return value, and a Uniform Resource Locator (URL). In specific implementation, the interface description file of the target interface is sent to the target client, so that a developer corresponding to the target client confirms the interface description file of the target interface. In particular implementations, the API management module may send the interface description file to the client. And if the developer corresponding to the target client confirms the interface description file without errors, returning confirmation information aiming at the interface description file.
In an embodiment, the version number of the target interface description file that is released last time may be obtained, and then the corresponding target interface description file may be obtained according to the version number of the target interface description file. Comparing the field information in the target interface description file with the field information in the interface description file defined this time, and judging whether the interface description file defined this time has compatibility; and under the condition that the compatibility is determined, the interface description file can be sent to the target client so that the target client confirms the interface description file defined at this time. And under the condition that the interface description file defined at this time is determined to have no compatibility, the interface description file defined at this time cannot generate an interface code, and compiling and online are completed.
S102: and after receiving the confirmation information of the target client aiming at the interface description file, generating an interface code corresponding to the interface description file, and recording the version number of the interface description file.
Here, the API management module 201 may generate an interface code corresponding to the interface description file according to the interface description file, record an interface description file version number corresponding to the interface code, and record the interface description file version number as the API versein.
S103: and after the interface codes are sequentially subjected to packaging, compiling and releasing processing, generating a mapping relation between the processed identification numbers and the identification numbers before processing.
Here, the interface code may be first packaged to obtain a code packet, and a first mapping relationship between a code packet version number of the code packet and an interface description file version number may be generated. Here, the interface code may be packaged by the package management module. Next, the code package may also be generated into business logic codes, and submission identifications of the business logic codes. Here, for each submitted business logic code, a corresponding submission identification may be generated, which may be denoted as Commit ID. In particular implementation, each business logic code can be managed according to the submission identifier. The generated submission identification may be sent to the SCM module. The commit marker may generate a second mapping relationship with the code package version number. In particular implementations, the second mapping may be done in the SCM module. The SCM module may download the business logic code from the code repository based on the submission identification.
Next, the service logic code may be compiled, and a mapping relationship between the identifier (later version number of the file to be issued) after the compiling process and the identifier (submission identifier) before the compiling process, that is, a third mapping relationship, may be generated.
S104: after a release message carrying the version number of the file to be released is acquired, the version number of the interface description file corresponding to the version number of the file to be released is determined based on the version number of the file to be released and the generated mapping relation, and the version number of the interface description file is marked as an online state.
In one mode, the submission identifier may be determined based on the version number of the file to be issued and the generated third mapping relationship; determining the version number of the code packet based on the submission identifier and the generated second mapping relation; determining the version number of the interface description file based on the version number of the code packet and the generated first mapping relation; the first mapping relation is the mapping relation between the code package version number of the generated code package and the interface description file version number when the interface code is packaged by the package management module; the second mapping relation is the mapping relation between the submission identifier generated by the code warehouse aiming at the received service logic code and the code package version number; the business logic code is generated for the code packet; and the third mapping relation is the mapping relation between the version number of the file to be issued of the binary API interface file and the submission identifier generated when the business logic code is compiled in the SCM module.
And finally, marking the API version of the version number of the interface description file as an online state, namely, the API version of the version number of the interface description file is an online version, and informing the online version to a target client.
In one embodiment, after the version number of the interface description file is marked as 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 the application program matching with the target interface.
In the embodiment of the present disclosure, an interface description file matching with the version number of the interface description file may also be obtained based on the version number of the interface description file corresponding to the binary API interface file; and then, carrying out flow analysis on the interface description file, and determining field characteristic information in the interface description file. And testing the request parameters and the response results in the interface according to the obtained field characteristic information, and judging whether the product functions meet expectations or not. The above embodiment may be applied to a process of packet capture for an interface that uses binary Protocol transmission such as Protocol Buffers (abbreviated as Protocol buf) and swift, and details are not described here.
Based on the same inventive concept, the embodiment of the present disclosure further provides an interface publishing system corresponding to the interface publishing method.
Referring to fig. 2, a schematic structural diagram of an interface publishing system provided in the embodiment of the present disclosure is shown, where the interface publishing system 200 includes an application programming interface API management module 201 and a code processing module 202, where:
the API management module 201 is configured to generate an interface description file of a target interface, and send the interface description file to a target client; after receiving the confirmation information of the target client aiming at the interface description file, generating an interface code corresponding to the interface description file, and recording the version number of the interface description file; sending the interface code and the version number of the interface description file to a code processing module 202, realizing the packaging, compiling and publishing of the interface code by the code processing module 202, and respectively obtaining the mapping relation between the processed identification numbers and the identification numbers before processing which are respectively generated after the code processing module executes the processing of different stages; after a release message carrying the version number of the file to be released and sent by the code processing module 202 is acquired, based on the version number of the file to be released and each acquired mapping relationship, the version number of the interface description file corresponding to the version number of the file to be released is determined, and the version number of the interface description file is marked as an online state.
The code processing module 202 is configured to generate mapping relationships between the post-processing identification numbers and the pre-processing identification numbers after performing processing at different stages, send the mapping relationships to the API management module 201, and send a release message carrying a version number of a file to be released to the API management module 201 after releasing a code.
Here, the API management module 201 is mainly responsible for managing the lifecycle of the interface code and version corresponding to the API interface. The life cycle of the API interface may include: interface definition, interface development and interface publishing.
As shown in the work flow diagram of the interface publishing system shown in fig. 4, in the interface definition phase, the API management module 201 is configured to generate an interface description file of a target interface and send the interface description file to a target client; after receiving the confirmation information of the target client aiming at the interface description file, generating an interface code corresponding to the interface description file, and recording the version number of the interface description file; the interface code and the interface description file version number are sent to the code processing module 202, the code processing module 202 packages the interface code, and the code processing module 202 generates a mapping relationship (a first mapping relationship in the following) between the identifier (code package version number in the following) after the packaging processing and the identifier (interface description file version number in the following) before the packaging processing.
The interface description file is used to define a target interface, and may include information such as an interface name, interface function description information, a request mode, an incoming parameter, a return value, and a Uniform Resource Locator (URL).
The API management module 201 sends the interface description file of the target interface to the target client, so that a developer corresponding to the target client confirms the interface description file of the target interface, and determines whether the definition of the target interface in the interface description file meets its own use requirement, for example, whether the interface function, the request mode, and the like meet the use requirement of the target client.
If the developer corresponding to the target client confirms the interface description file without error, the confirmation information for the interface description file is returned, and after receiving the confirmation information for the interface description file returned by the target client, the API management module 201 executes the subsequent processes of generating an interface code corresponding to the interface description file, and the like.
If the developer corresponding to the target client considers that the interface description file is incorrect, the information with the error can be returned, and at this time, the API management module 201 cannot execute the subsequent processes of generating the interface code corresponding to the interface description file, and the like, but needs to modify the interface description file until receiving the confirmation information for the interface description file returned by the target client.
The API management module 201 generates an interface code corresponding to the interface description file according to the interface description file, and records an interface description file version number corresponding to the interface code, which is recorded as API versoin. Then, the API management module 201 sends the interface code and the version number of the interface description file to the code processing module 202, and the code processing module 202 packages the interface code to generate a code packet corresponding to the interface code. At this time, the code processing module 202 may generate a code packet version number corresponding to the code packet, and record the code packet version number as Codegen version; and generating a first mapping relation between the version number of the code packet and the version number of the interface description file, and recording as Codegen version > API version. Finally, the code processing module 202 returns the first mapping relationship to the API management module 201.
In one embodiment, as shown in fig. 3, the code processing module 202 may include a package management module 2021, a code repository 2022, a software configuration management SCM module 2023, a platform as a service PaaS module 2024. The API management module 201 is further configured to send the interface code to the package management module 201.
The package management platform 2021 in the code processing module 202 may be configured to package the received interface code from the API management module 201 to obtain a code package; a first mapping relationship between the code package version number of the code package and the interface description file version number is generated, and the first mapping relationship is sent to the API management module 201. The common Package management platform 2021 may include an npm (node Package manager), a maven Package manager, and a gomod Package manager.
In 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), and the like, and the management of the code package may be implemented by using the code repository 2022.
Specifically, the code repository 2022 is configured to receive a business logic code generated for the code package, and generate a submission identifier of the business logic code; and sends the commit marker to the SCM module 2023.
Here, for each submitted business logic code, a corresponding submission identification may be generated, which may be denoted as Commit ID. In the code repository 2022, the business logic codes are managed according to the submission identifier. In particular implementations, the code repository 2022 may send a message queue mq (message queue) carrying the submission identifier to the SCM module 203.
Next, the code processing module 202 compiles the business logic code, and generates a mapping relationship (hereinafter, a third mapping relationship) between the post-compilation identification number (hereinafter, the version number of the file to be issued) and the pre-compilation identification number (hereinafter, the submission identification).
The code processing module 202 needs to download the business logic code from the code repository 2022 before compiling the business logic code.
Thus, in one embodiment, downloading and compiling business logic code from the code repository 2022 may be implemented by the SCM module 2023 in the code processing module 202. Specifically, SCM module 2023, for downloading business logic code from the code repository based on the submission identifier; generating a second mapping relation between the submission identifier and the code packet version number; sending the second mapping relationship to the API management module 201; compiling the service logic code to generate a binary API interface file to be issued, and recording the version number of the file to be issued of the binary API interface file; generating a third mapping relation between the version number of the file to be issued and the submission identifier, and sending the third mapping relation to the API management module 201; and sends the binary API interface file carrying the version number of the file to be published to the PaaS module 204 for publication.
Here, upon receipt of the MQ message, which may be transmitted by the code repository 2022, the SCM module 2023 may download the corresponding business logic code from the code repository based on the submission identification in the MQ message. And generating a second mapping relation between the submission identifier and the version number of the code packet, and recording as Commit ID ═ Codegen version. The SCM module 2023 sends the second mapping relationship to the API management module 201.
Then, the SCM module 2023 may compile the service logic code, generate a binary API interface file to be published, and record a version number of the file to be published of the binary API interface file, which is recorded as SCM version, that is, a version of the mirror package.
At this time, the SCM module 2023 is further configured to generate a third mapping relationship between the version number of the file to be published and the Commit identifier, which is recorded as SCM version > Commit ID. The SCM module 2023 is further configured to send the binary API interface file carrying the version number of the file to be published to the PaaS module 2024 for publication.
In the interface publishing stage, the PaaS module 2024 is configured to publish the binary API interface file, and send a publishing message carrying the version number of the file to be published of the binary API interface file to the API management module 201.
At this time, the API management module 201 listens to the release message of the PaaS module 2024. The API management module 201 is configured to, after obtaining a release message which is sent by the code processing module 202 and carries a version number of the file to be released, determine, based on the version number of the file to be released and the generated mapping relationship, a version number of the interface description file corresponding to the version number of the file to be released, and mark the version number of the interface description file as an online state.
Specifically, the API management module 201 is configured to, after receiving a publishing message of the PaaS module 2024, determine a submission identifier based on the version number of the file to be published carried in the publishing message and the acquired third mapping relationship; determining the version number of the code packet based on the submission identifier and the acquired second mapping relation; and determining the version number of the interface description file based on the version number of the code packet and the acquired first mapping relation.
That is, the API management module 201 may determine the Commit ID based on the version number SCM version of the file to be published and the third mapping relationship SCM version > Commit ID; then determining the code packet version number Codegen version based on the submission identifier Commit ID and the second mapping relation Commit ID ═ Codegen version; and then determining the API version of the version number of the interface description file based on the code package version number Codegen version and the first mapping relation Codegen version ═ API version.
Finally, the API management module 201 is configured to mark the API version of the interface description file as an online state, that is, the API version of the interface description file is an online version, and notify the target client of the online version.
Therefore, in one embodiment, the API management module 201 is further configured to: and sending a publishing message of the binary API interface file to the target client so that the target client publishes the application program matched with the target interface. The target client side can accurately know the online state of the target interface based on the API version of the interface description file version number of the online state, and further can issue an Application program (APP) matched with the target interface at the target client side. When a new client wants to use the API, the marked version number of the interface description file can know that the API corresponding to the version number of the interface description file is online and can be used.
By using the interface release system provided by the embodiment of the disclosure, the online state of the target interface is marked based on the version number of the interface description file in the interface release stage, so that the compatibility test of the interface can be realized. Specifically, in one embodiment, the API management module 201 is further configured to: acquiring a target interface description file corresponding to the latest published target interface description file version number; comparing the field information in the target interface description file with the field information in the interface description file defined this time, and judging whether the interface description file defined this time has compatibility; and in the case that the compatibility is determined, sending the interface description file to the target client.
By using the interface publishing system provided by the embodiment of the disclosure, the online state of the target interface can be marked according to the version number of the interface description file in the historical publishing process of the target interface. Therefore, the version number of the target interface description file which is released last time can be acquired, and then the corresponding target interface description file can be acquired according to the version number of the target interface description file.
Then, in the interface definition stage, the interface description file defined this time is obtained, and further, a compatibility test can be performed on the basis of 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, and whether the interface description file defined this time has compatibility is judged. And under the condition that the compatibility is determined, the interface description file can be sent to the target client so that the target client confirms the interface description file defined at this time. And under the condition that the interface description file defined at this time is determined to have no compatibility, the interface description file defined at this time cannot generate an interface code, and compiling and online are completed.
The interface issuing system provided by the embodiment of the present disclosure may further implement flow analysis, and specifically, in an implementation manner, the API management module 201 is further configured to: acquiring an interface description file matched with the version number of the interface description file based on the version number of the interface description file corresponding to the binary API interface file; and carrying out flow analysis on the interface description file, and determining field characteristic information in the interface description file. And testing the request parameters and the response results in the interface according to the obtained field characteristic information, and judging whether the product functions meet expectations or not.
The above embodiment may be applied to a process of packet capture for an interface that uses binary Protocol transmission such as Protocol Buffers (abbreviated as Protocol buf) and swift, and details are not described here.
Because the principle of the interface publishing system in the embodiment of the present disclosure for solving the problem is similar to the interface publishing method in the embodiment of the present disclosure, the implementation of the system may refer to the implementation of the method, and repeated details are not described again.
Based on the same technical concept, the embodiment of the disclosure also provides computer equipment. Referring to fig. 5, a schematic structural diagram of a computer device 500 provided in the embodiment of the present disclosure includes a processor 501, a memory 502, and a bus 503. The memory 502 is used for storing execution instructions and includes a memory 5021 and an external memory 5022; the memory 5021 is also referred to as an internal memory, and is used for temporarily storing operation data in the processor 501 and data exchanged with an external storage 5022 such as a hard disk, the processor 501 exchanges data with the external storage 5022 through the memory 5021, and when the computer device 500 operates, the processor 501 communicates with the storage 502 through the bus 503, so that the processor 501 executes the following instructions:
generating an interface description file of a target interface, and sending the interface description file to a target client;
after receiving the confirmation information of the target client aiming at the interface description file, generating an interface code corresponding to the interface description file, and recording the version number of the interface description file;
after the interface codes are sequentially subjected to packaging, compiling and releasing processing, generating a mapping relation between the processed identification numbers and the identification numbers before processing;
after a release message carrying the version number of the file to be released is acquired, the version number of the interface description file corresponding to the version number of the file to be released is determined based on the version number of the file to be released and the generated mapping relation, and the version number of the interface description file is marked as an online state.
The embodiments of the present disclosure also provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the interface issuing method in the foregoing method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The embodiments of the present disclosure also provide a computer program product, where the computer program product carries a program code, and instructions included in the program code may be used to execute the steps of the interface issuing method in the foregoing method embodiments, which may be referred to specifically in the foregoing method embodiments, and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of 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 of devices or units through some communication interfaces, and may be in an electrical, mechanical 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 network 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 disclosure 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 functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several 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 disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used for illustrating the technical solutions of the present disclosure and not for limiting the same, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (12)

1. An interface issuing method, characterized in that the method comprises:
generating an interface description file of a target interface, and sending the interface description file to a target client;
after receiving the confirmation information of the target client aiming at the interface description file, generating an interface code corresponding to the interface description file, and recording the version number of the interface description file;
after the interface codes are sequentially subjected to packaging, compiling and releasing processing, generating a mapping relation between the processed identification numbers and the identification numbers before processing;
after a release message carrying the version number of the file to be released is acquired, the version number of the interface description file corresponding to the version number of the file to be released is determined based on the version number of the file to be released and the generated mapping relation, and the version number of the interface description file is marked as an online state.
2. The interface issuing method according to claim 1, wherein the determining, based on the version number of the file to be issued and the generated mapping relationship, the version number of the interface description file corresponding to the version number of the file to be issued includes:
determining a submission identifier based on the version number of the file to be issued and the generated third mapping relation; determining the version number of the code packet based on the submission identifier and the generated second mapping relation; determining the version number of the interface description file based on the version number of the code packet and the generated first mapping relation;
the first mapping relation is a mapping relation between a code package version number of a generated code package and the interface description file version number when the interface code is packaged; the second mapping relation is a mapping relation between a submission identifier generated aiming at the received service logic code and the code packet version number; the business logic code is generated for the code package; the third mapping relationship is a mapping relationship between the version number of the file to be issued of the binary API interface file generated when the service logic code is compiled and the commit identifier.
3. The interface publishing method according to claim 1, wherein sending the interface description file to a target client comprises:
acquiring a target interface description file corresponding to the latest published target interface description file version number;
comparing the field information in the target interface description file with the field information in the interface description file defined this time, and judging whether the interface description file defined this time has compatibility;
and under the condition that the compatibility is determined, the interface description file is sent to the target client.
4. The interface publishing method according to claim 3, wherein after receiving a publishing message carrying a version number of a file to be published, determining a version number of an interface description file corresponding to the version number of the file to be published based on the version number of the file to be published and each generated mapping relationship, and marking the version number of the interface description file as an online state, the method comprises:
and sending a publishing message of the binary API interface file to the target client so that the target client publishes the application program matched with the target interface.
5. The interface publishing method of claim 3, wherein the method further comprises:
acquiring an interface description file matched with the version number of the interface description file based on the version number of the interface description file corresponding to the binary API interface file;
and carrying out flow analysis on the interface description file, and determining field characteristic information in the interface description file.
6. An interface issuing system, comprising an Application Programming Interface (API) management module and a code processing module, wherein:
the API management module is used for generating an interface description file of a target interface and sending the interface description file to a target client; after receiving the confirmation information of the target client aiming at the interface description file, generating an interface code corresponding to the interface description file, and recording the version number of the interface description file; sending the interface code and the interface description file version number to the code processing module, realizing the packaging, compiling and publishing of the interface code by the code processing module, and respectively obtaining the mapping relation between the processed identification number and the identification number before processing which are respectively generated after the code processing module executes the processing of different stages; after a release message carrying the version number of the file to be released and sent by the code processing module is acquired, determining the version number of an interface description file corresponding to the version number of the file to be released based on the version number of the file to be released and the acquired mapping relations, and marking the version number of the interface description file as an online state;
the code processing module is used for respectively generating mapping relations between the identification numbers after processing and the identification numbers before processing after executing the processing of different stages, sending the mapping relations to the API management module, and sending a release message carrying the version number of the file to be released to the API management module after realizing the release of the code.
7. The interface publishing system of claim 6, wherein the code processing module comprises: the system comprises a package management module, a code warehouse, a software configuration management SCM module and a platform as a service (PaaS) module; wherein:
the package management module is used for packaging the received interface codes from the API management module to obtain a code package; generating a first mapping relation between the code package version number of the code package and the interface description file version number, and sending the first mapping relation to the API management module;
the code warehouse is used for receiving the business logic codes generated aiming at the code packet and generating submission identifications of the logic processing codes; and sending the submission identifier to the SCM module;
the SCM module is used for downloading the business logic code from the code warehouse based on the submission identification; generating a second mapping relation between the submission identifier and the code packet version number; sending the second mapping relation to the API management module; compiling the service logic code to generate a binary API interface file to be issued, and recording the version number of the file to be issued of the binary API interface file; generating a third mapping relation between the version number of the file to be issued and the submission identifier, and sending the third mapping relation to the API management module; sending the binary API interface file carrying the version number of the file to be issued to the PaaS module for issuing;
the PaaS module is used for publishing the binary API interface file and sending a publishing message carrying the version number of the file to be published of the binary API interface file to the API management module;
the API management module is specifically configured to send the interface code to the package management module; after the release message of the PaaS module is received, determining the submission identifier based on the version number of the file to be released carried in the release message and the acquired third mapping relation; determining the code packet version number based on the submission identifier and the acquired second mapping relation; and determining the version number of the interface description file based on the version number of the code packet and the acquired first mapping relation.
8. The system of claim 6, wherein the API management module is further configured to:
acquiring a target interface description file corresponding to the latest published target interface description file version number;
comparing the field information in the target interface description file with the field information in the interface description file defined this time, and judging whether the interface description file defined this time has compatibility;
and under the condition that the compatibility is determined, the interface description file is sent to the target client.
9. The system of claim 6, wherein the API management module is further configured to:
and sending a publishing message of the binary API interface file to the target client so that the target client publishes the application program matched with the target interface.
10. The system of claim 6, wherein the API management module is further configured to:
acquiring an interface description file matched with the version number of the interface description file based on the version number of the interface description file corresponding to the binary API interface file;
and carrying out flow analysis on the interface description file, and determining field characteristic information in the interface description file.
11. A computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when a computer device is running, the machine-readable instructions when executed by the processor performing the steps of the interface issuing method according to any one of claims 1 to 5.
12. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, performs the steps of the interface issuing method according to any one of claims 1 to 5.
CN202111641090.9A 2021-12-29 2021-12-29 Interface publishing method, system, computer equipment and storage medium Pending CN114416165A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111641090.9A CN114416165A (en) 2021-12-29 2021-12-29 Interface publishing method, system, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111641090.9A CN114416165A (en) 2021-12-29 2021-12-29 Interface publishing method, system, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114416165A true CN114416165A (en) 2022-04-29

Family

ID=81270460

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111641090.9A Pending CN114416165A (en) 2021-12-29 2021-12-29 Interface publishing method, system, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114416165A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115695555A (en) * 2022-09-06 2023-02-03 恒生电子股份有限公司 Interface calling method, system, processing equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115695555A (en) * 2022-09-06 2023-02-03 恒生电子股份有限公司 Interface calling method, system, processing equipment and storage medium
CN115695555B (en) * 2022-09-06 2023-09-12 恒生电子股份有限公司 Interface calling method, system, processing device and storage medium

Similar Documents

Publication Publication Date Title
JP6856749B2 (en) Systems and methods for implementing native contracts on the blockchain
US20210289024A1 (en) Dynamic execution resource selection for customized workflow tasks
US20140053146A1 (en) Network hardware and software upgrade recommender
CN112769706B (en) Componentized routing method and system
US10956142B2 (en) Distributing a composite application
US10740080B2 (en) Preview and publishing of mobile applications
CN111258772A (en) Service calling information processing method, device and system
CN114416165A (en) Interface publishing method, system, computer equipment and storage medium
TWI462015B (en) Device management methods and systems, and related apparatus
CN110716786A (en) Page display method, system and storage medium
CN111443918A (en) Channel access method and device for business object installation package
CN109828784B (en) Task grabbing method and device
CN112559124A (en) Model management system and target operation instruction processing method and device
CN113342353B (en) Mock data generation method and device
CN113821303A (en) Method and device for deploying hardor cluster and readable storage medium
CN112988225A (en) Annotation configuration method, device, equipment and storage medium
CN116501414B (en) Resource control method, device, medium and computing equipment based on cloud platform
CN106354620B (en) Resource monitoring method and system
CN115686676B (en) Dynamic calling method and device for object and electronic equipment
CN113626007B (en) Application method and device of connector model and server
CN110442392B (en) Packet isolation method and device, electronic equipment and storage medium
CN113656110B (en) Page loading method and device for front-end updating free cache
CN116700784A (en) Task processing method, device, equipment and storage medium
CN113672309A (en) Business service method, device, electronic equipment and readable storage medium
CN115576574A (en) Code packaging method, device, medium and equipment

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: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.