API metadata determination method, device and system

By filtering and generating compatible metadata definition files, the problems of low efficiency and poor compatibility of API interface generation in the prior art are solved, and more efficient and accurate API interface generation is achieved.

CN113742094BActive Publication Date: 2025-02-25HUAWEI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010481466.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-31
Publication Date
2025-02-25
Estimated Expiration
2040-05-31

AI Technical Summary

Technical Problem

In the prior art, the metadata definition files obtained by Business One from Business Two are often unable to adapt to the needs of Business One, and have poor compatibility, and are manually generated by developers and are prone to errors and have poor reusability, resulting in low API interface generation efficiency.

Method used

By receiving request information sent by service one, filter out the running environment message messages, generate metadata definition files based on these message messages, and perform validity verification to ensure that the generated metadata definition files are compatible with the operating environment of service one, and improve the Accuracy and efficiency of API interface generation.

Benefits of technology

It improves the compatibility and accuracy of API interface generation, reduces the number of requests to Service 2, saves system overhead, and improves the efficiency of API interface generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113742094B_ABST
    Figure CN113742094B_ABST
Patent Text Reader

Abstract

The present application provides an API metadata determination method, device and system. The method includes: receiving a first message sent by a first business, the first message being used to request a metadata definition file; screening out at least one operating environment message message from the operating environment message of the first business contained in the first message; generating a metadata definition file based on at least one screened operating environment message message; and sending the metadata definition file to the first business, for the first business to generate an API interface for service calls with a second business based on the metadata definition file. The method will obtain the metadata definition file based on the operating environment message message of the first business, thereby making the generated metadata definition file more compatible with the first business, and enabling the first business to establish the API interface more quickly and efficiently based on the metadata definition file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device and system for determining API metadata. Background Art

[0002] Currently, when service 1 wants to call the service of service 2, it needs to establish an application programming interface (API) in advance to communicate with service 2. Service 1 establishes the API interface through the definition file of the metadata sent by service 2.

[0003] The existing service 1 mainly establishes the API interface with the service 2 in the following manner: the service 2 generates a metadata definition file in advance, and when the service 1 sends a request to obtain the metadata definition file to the service 2, the service 2 sends the previously generated metadata definition file to the service 1 after receiving the request, so that the service 1 generates the API interface according to the metadata definition file after receiving the metadata definition file sent by the service 2.

[0004] However, the metadata definition file obtained by the service 1 from the service 2 often cannot meet the needs of the service 1 itself and cannot be compatible with the service 1. In addition, the metadata definition file sent by the service 2 is currently manually generated by the developers of the service 2. Therefore, the obtained metadata definition file is extremely prone to errors and has poor reusability.

[0005] In summary, there is currently no efficient and accurate method for determining API metadata. Summary of the invention

[0006] The present application provides an API metadata determination method, device and system, which are used to provide an efficient, accurate and highly reusable API metadata determination method.

[0007] In a first aspect, an embodiment of the present application provides a method for determining API metadata, including:

[0008] Receive first information sent by a first business, where the first information is used to request a metadata definition file; filter out at least one operating environment message message from the operating environment messages of the first business contained in the first information; generate a metadata definition file based on the at least one filtered operating environment message message; send the metadata definition file to the first business, so that the first business generates an API interface for service call with a second business based on the metadata definition file.

[0009] Based on this solution, when the second business in the embodiment of the present invention provides the metadata definition file to the first business, the metadata definition file will be obtained according to the operating environment message packet of the first business sent by the first business, so that the generated metadata definition file is more compatible with the first business, avoiding the situation where the first business repeatedly requests the metadata definition file from the second business for the metadata definition file after receiving the metadata definition file because the metadata definition file is not applicable to its own business, saving system overhead and being able to establish the API interface more quickly and more efficiently.

[0010] In a possible implementation, before sending the metadata definition file to the first service, at least two operating environment message messages are selected from the operating environment message messages included in the first information as at least two verification message messages; based on the at least two verification message messages, the generated metadata definition file is verified for validity; and it is determined that the metadata definition file passes the validity verification.

[0011] Based on this solution, after generating the metadata definition file, the second business in the embodiment of the present invention selects at least two operating environment message messages from the operating environment message messages included in the first information as verification message messages to verify the metadata definition file in order to better ensure the accuracy and validity of the metadata definition file. After determining that the metadata definition file is valid, the metadata definition file is sent to the first business, thereby better improving the accuracy of the sent metadata definition file, so that the first business has a higher success rate in establishing the API interface according to the metadata definition file after receiving the metadata definition file.

[0012] In a possible implementation, each of the at least two verification message messages is used to verify the validity of the generated metadata definition file; and it is determined that the ratio of the number of verification message messages corresponding to the metadata definition file that pass the validity verification to the number of the at least two verification message messages is not less than a first threshold; wherein, when all fields in a verification message message include all fields in the metadata definition file, it is determined that the metadata definition file passes the validity verification of the verification message message.

[0013] Based on this solution, the embodiment of the present invention provides a method for determining whether the metadata definition file is valid, which has stronger applicability.

[0014] In a possible implementation, after determining that the metadata definition file has not successfully passed the validity verification, the metadata definition file is calibrated according to the at least two verification message packets to obtain a metadata definition file that satisfies the validity verification.

[0015] Based on this solution, after the second service of the embodiment of the present invention performs validity verification on the generated metadata definition file, if the metadata definition file fails to pass the validity verification, the second service needs to readjust the metadata definition file, so that the metadata definition file sent to the first service is more accurate. To this end, after determining that the metadata definition file fails to pass the validity verification, the embodiment of the present application adjusts and calibrates the metadata definition file according to the verification message, so as to better ensure the accuracy and validity of the metadata definition file.

[0016] In a possible implementation, a target field is determined, any one of the at least two verification message messages includes the target field, and the metadata definition file does not include the target field; and the target field is added to the metadata definition file.

[0017] Based on this solution, the embodiment of the present invention provides a method for calibrating the metadata definition file, which has stronger applicability.

[0018] In a possible implementation, before generating a metadata definition file based on at least one of the screened operating environment message messages, the operating environment message messages are preprocessed to filter out unrecognizable character information in the operating environment message messages to obtain a filtered operating environment message message.

[0019] Based on this solution, the embodiment of the present invention filters the unrecognizable character information in the operating environment message message before generating the metadata definition file through the operating environment message message, thereby improving the effectiveness of the operating environment message message.

[0020] In a possible implementation, when the number of screened operating environment message messages includes at least two, at least two operating environment message messages are integrated to generate a first operating environment message message; and a metadata definition file is generated according to the first operating environment message.

[0021] Based on this solution, an embodiment of the present invention provides a method for generating a metadata definition file according to multiple operating environment message packets.

[0022] In one possible implementation, a field whose appearance number in the at least two operating environment message messages is not less than a second threshold is determined; based on the field whose number is not less than the second threshold, a first operating environment message message is generated, and the first operating environment message message includes the field whose number is not less than the second threshold.

[0023] Based on this solution, an embodiment of the present invention provides a method for generating a first operating environment message packet.

[0024] In a second aspect, an embodiment of the present invention provides an API metadata determination device, the device comprising: at least one processing unit and at least one storage unit, wherein the storage unit stores a program code, and when the program code is executed by the processing unit, the processing unit performs the following process:

[0025] Used to receive a first message sent by a first business, the first message is used to request a metadata definition file; filter out at least one operating environment message message from the operating environment message messages of the first business contained in the first message; generate a metadata definition file based on the at least one filtered operating environment message message; send the metadata definition file to the first business, for the first business to generate an application programming interface API for service call with a second business based on the metadata definition file.

[0026] In a possible implementation manner, the processing unit is further configured to:

[0027] Select at least two operating environment message messages from the operating environment message messages included in the first information as at least two verification message messages; verify the validity of the generated metadata definition file based on the at least two verification message messages; and determine that the metadata definition file passes the validity verification.

[0028] In a possible implementation manner, the processing unit is specifically configured to:

[0029] Use each of the at least two verification message messages to verify the validity of the generated metadata definition file; and determine that the ratio of the number of verification message messages corresponding to the metadata definition file that pass the validity verification to the number of the at least two verification message messages is not less than a first threshold; wherein, when all fields in a verification message message include all fields in the metadata definition file, it is determined that the metadata definition file passes the validity verification of the verification message message.

[0030] In a possible implementation manner, the processing unit is further configured to:

[0031] After determining that the metadata definition file has not successfully passed the validity verification, the metadata definition file is calibrated according to the at least two verification message packets to obtain a metadata definition file that meets the validity verification.

[0032] In a possible implementation manner, the processing unit is specifically configured to:

[0033] Determine a target field, any one of the at least two verification message messages includes the target field, and the metadata definition file does not include the target field; add the target field to the metadata definition file.

[0034] In a possible implementation manner, the processing unit is further configured to:

[0035] The operating environment message message is preprocessed, and unrecognizable character information in the operating environment message message is filtered to obtain a filtered operating environment message message.

[0036] In a possible implementation manner, the processing unit is further configured to:

[0037] When the number of the screened operating environment message messages includes at least two, the at least two operating environment message messages are integrated to generate a first operating environment message message; and a metadata definition file is generated according to the first operating environment message.

[0038] In a possible implementation manner, the processing unit is specifically configured to:

[0039] Determine a field whose number of appearances in the at least two operating environment message messages is not less than a second threshold; generate a first operating environment message message based on the field that is not less than the second threshold, wherein the first operating environment message message includes the field that is not less than the second threshold.

[0040] In a third aspect, an embodiment of the present application provides an API metadata determination system, the system comprising: a data processing device and a data proofreading device;

[0041] The data processing device is used to process the acquired operating environment message to generate a metadata definition file; the data proofreading device is used to proofread the generated metadata definition file.

[0042] Based on this solution, an embodiment of the present invention provides a system for automatically generating a metadata definition file based on a message message, which effectively improves the efficiency of generating the metadata definition file. At the same time, the API metadata determination system provided by the present application is also used to proofread the generated metadata definition file during the process of generating the metadata definition file, so that the generated metadata definition file is more accurate and the accuracy rate is improved.

[0043] In one possible implementation, the data processing device includes a data preprocessing module, a data mapping module and a data generation module; the data preprocessing module is used to filter unrecognizable character information in the message message; the data mapping module is used to determine the data structure corresponding to the preprocessed message message; the data generation module is used to generate a metadata definition file according to the data structure.

[0044] Based on this solution, the embodiment of the present invention introduces in detail the specific composition of the data processing device in the API metadata determination system.

[0045] In one possible implementation, the data proofreading device includes a proofreading file library and a data proofreading module; the data proofreading module is used to proofread the metadata definition file generated by the data processing device; wherein the proofreading file library stores at least one real metadata definition file for proofreading and / or at least one received operating environment message message.

[0046] Based on this solution, the embodiment of the present invention introduces in detail the specific composition of the data proofreading device in the API metadata determination system.

[0047] In a fourth aspect, an embodiment of the present invention provides an API metadata determination device, which has any method for implementing the first aspect of the above embodiment or any possible implementation method in the first aspect.

[0048] In a possible implementation, the apparatus may be a terminal device, or a component that can be used for the terminal device, such as a chip or a chip system or a circuit, and the apparatus may include: a transceiver and a processor. The processor may be configured to support the apparatus to perform the corresponding functions of the terminal device described above, and the transceiver is used to support communication between the apparatus and other devices.

[0049] Optionally, the device may further include a memory, which may be coupled to the processor and store necessary program instructions and data for the device. The transceiver may be an independent receiver, an independent transmitter, a transceiver with integrated transceiver functions, or an interface circuit.

[0050] In the fifth aspect, an embodiment of the present application provides a chip system, including a processor and optionally a memory; wherein the memory is used to store computer programs, and the processor is used to call and run computer programs from the memory, so that a device equipped with the chip system executes any method in the above-mentioned first aspect or any possible implementation method of the first aspect.

[0051] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes: a computer program code, when the computer program code is executed by a communication unit, a processing unit or a transceiver, or a processor of an API metadata determination device, the device executes any method in the above-mentioned first aspect or any possible implementation method of the first aspect.

[0052] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a program, and the program enables an API metadata determination device to execute any method in the above-mentioned first aspect or any possible implementation method in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 A flowchart of a method for determining API metadata provided in an embodiment of the present application;

[0054] Figure 2 A schematic diagram of a system architecture provided for an embodiment of the present application;

[0055] Figure 3 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application;

[0056] Figure 4 A schematic diagram of the structure of a data proofreading device provided in an embodiment of the present application;

[0057] Figure 5 A schematic diagram of the first API metadata determination method provided in an embodiment of the present application;

[0058] Figure 6 A schematic diagram of a data structure provided for an embodiment of the present application;

[0059] Figure 7 A schematic diagram of the first API metadata determination device provided in this application;

[0060] Figure 8 A schematic diagram of the second API metadata determination device provided in this application. DETAILED DESCRIPTION

[0061] The present application will be described in detail below with reference to the accompanying drawings.

[0062] At present, when service 1 wants to call the service of service 2, it needs to establish a service point for communication with service 2 in advance. When connecting upstream and downstream, it can usually only obtain message packets, not application programming interfaces (APIs). Among them, service 1 establishes the API interface through the definition file of the metadata sent by service 2. However, the API interface used for upstream and downstream communication needs to be compiled and generated according to the definition file of the metadata. Therefore, it is necessary to convert the obtained message packets into API metadata.

[0063] At present, the service one mainly establishes the API interface with the service two in the following manner: the service two generates a metadata definition file in advance, and when the service one sends a request to obtain the metadata definition file to the service two, the service two sends the previously generated metadata definition file to the service one after receiving the request, so that the service one generates the API interface according to the metadata definition file after receiving the metadata definition file sent by the service two.

[0064] However, the metadata definition file obtained by the service 1 from the service 2 often cannot meet the needs of the service 1 itself and cannot be compatible with the service 1. In addition, the metadata definition file sent by the service 2 is currently manually generated by the developers of the service 2. Therefore, the obtained metadata definition file is extremely prone to errors and has poor reusability.

[0065] To solve the above problems, an embodiment of the present application provides an API metadata determination method, so that the metadata definition file sent by the second business and received by the first business has better compatibility and higher accuracy, effectively improving the efficiency of establishing an API interface based on the metadata definition file, making it more efficient and simple.

[0066] Among them, the technical solutions of the embodiments of the present application can be applied to various computer systems and are not limited here.

[0067] Some of the terms used in the embodiments of the present application are explained below for easier understanding.

[0068] 1) In the embodiments of this application, "API" refers to some predefined functions, or to the agreement for connecting different components of a software system. It is mainly used to provide a set of routines that can be accessed based on certain software or hardware without accessing the original code.

[0069] 2) In the embodiments of the present application, "API orchestration" refers to the process of implementing calls between services, combining and deploying them into a new service or application on the cloud platform through configuration, mapping and other methods without programming.

[0070] Among them, the term "at least one" in the embodiments of the present application refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. The following at least one item (items) or similar expressions refer to any combination of these items, including any combination of single items (items) or plural items (items). For example, at least one item (items) of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0071] Unless otherwise specified, ordinal numbers such as "first" and "second" in the embodiments of the present application are used to distinguish multiple objects and are not used to limit the order, timing, priority or importance of multiple objects.

[0072] In addition, the terms "including" and "having" in the embodiments, claims and drawings of the present application are not exclusive. For example, a process, method, system, product or device including a series of steps or modules is not limited to the listed steps or modules, and may also include steps or modules that are not listed.

[0073] Furthermore, the present application embodiment provides a method for determining API metadata, which can be specifically referred to as Figure 1 Steps shown.

[0074] S100, receiving first information sent by a first service, where the first information is used to request a metadata definition file.

[0075] S101: Filter out at least one operating environment message message from the operating environment message messages of the first service contained in the first information.

[0076] Among them, in the embodiment of the present application, there are multiple ways to filter out at least one operating environment message message from the operating environment message message of the first service contained in the first information, which are specifically not limited to the following ways:

[0077] Screening method 1: the second service randomly selects at least one operating environment message message from the received operating environment message messages.

[0078] Exemplarily, assuming that the first information includes operating environment message messages 1 to 100, and the second service needs to select an operating environment message message, the second service randomly selects from the operating environment message messages 1 to 100, for example, selects operating environment message message 5.

[0079] Screening method 2: the second service selects the operating environment message message with the largest data volume from the received operating environment message messages.

[0080] Exemplarily, it is assumed that the first information includes operating environment message packets 1 to 3. The size of the operating environment message packet 1 is 20 bits, the size of the operating environment message packet is 30 bits, and the size of the operating environment message packet 3 is 5 bits. The second service selects the operating environment message packet 3 from the operating environment message packets 1 to 3.

[0081] In an optional method in an embodiment of the present application, if the number of operating environment message messages screened out by the second business is at least two, the second business integrates the at least two operating environment message messages into one operating environment message message, for example, the integrated operating environment message message is the first operating environment message message, and then generates a metadata definition file based on the integrated operating environment message message (i.e., the first operating environment message message).

[0082] Among them, when the embodiment of the present application integrates and generates the first operating environment message, there may be multiple integration methods, which are not limited to the following:

[0083] Integration method 1: The second business determines a field whose number of appearances in the at least two operating environment message messages is not less than a second threshold, and then extracts the field whose number of appearances is not less than the second threshold from the at least two operating environment message messages, and generates a first operating environment message message based on the field whose number of appearances is not less than the second threshold.

[0084] That is to say, the first operating environment message includes the field that is not less than the second threshold.

[0085] Exemplarily, assuming that the second threshold is 80%, 5 operating environment message messages are selected for integration, if a field in one of the operating environment message messages (for example, field a) appears in 4 of the 5 operating environment message messages, the appearance ratio is equal to 80%, and the field a is determined to be the first field. If a field in one of the operating environment message messages (for example, field b) appears in only one of the 5 operating environment message messages, the appearance ratio is less than 80%, and the field b is determined to be the second field.

[0086] Among them, the first field is a mandatory field, and the second field is an optional field. Therefore, in the embodiment of the present application, the first operating environment message message is generated according to the first field.

[0087] It should be noted that, because the second field is an optional field, in the embodiment of the present application, the first operating environment message message can be generated based on the first field and the second field together.

[0088] Integration method 2: taking the union of the fields in the two message messages as the fields included in the first operating environment message message.

[0089] Integration method 3: using the intersection of the fields in the two message messages as the fields included in the first operating environment message message.

[0090] Integration method 4: The intersection of the fields in the two message messages is used as the mandatory field in the first operating environment message message, and the remaining fields are optional fields.

[0091] Exemplarily, it is assumed that operating environment message message 1 and operating environment message message 2 are selected, wherein the operating environment message message 1 contains fields a, b, c, d, h; the operating environment message message 2 contains fields c, d, e, f, h.

[0092] For example, after integrating the operating environment message message 1 with the operating environment message message 2, the first operating environment message message obtained contains fields a, b, c, d, e, h, and f; after integrating the operating environment message message 1 with the operating environment message message 2, the first operating environment message message obtained contains fields c, d, e, and h.

[0093] S102: Generate a metadata definition file according to at least one of the screened operating environment message packets.

[0094] Furthermore, in an embodiment of the present application, before generating a metadata definition file according to the operating environment message message, in order to improve the validity of the operating environment message message, the operating environment message message is preprocessed, and unrecognizable character information in the operating environment message message is filtered to obtain a filtered operating environment message message. Thus, the metadata definition file is generated according to the filtered operating environment message message.

[0095] In the embodiment of the present application, the second service considers the operating environment message sent by the first service when generating the metadata definition file according to its own file. That is, the second service generates the metadata definition file according to its own file and the operating environment message.

[0096] Specifically, in the embodiment of the present application, when the second service generates a metadata definition file according to the operating environment message message of the first service, the development language of the first service can be determined according to the operating environment message message, for example, Java, C++, C language, etc.

[0097] In addition, the second service may also determine a file format applicable to the first service, such as a data structure, according to the operating environment message.

[0098] Thus, the second service generates a metadata definition file applicable to the first service based on the information about the first service obtained from the operating environment message and in combination with its own files.

[0099] S103: Send the metadata definition file to the first service, so that the first service generates an API interface for performing service calls with the second service according to the metadata definition file.

[0100] Furthermore, in order to better ensure the validity and accuracy of the metadata definition file sent to the first service in the embodiment of the present application, the second service verifies the validity of the metadata definition file after obtaining the metadata definition file.

[0101] Specifically, in the embodiment of the present application, the validity of the metadata definition file is verified in the following manner:

[0102] A certain number of operating environment message messages (for example, at least two operating environment message messages) are selected from the operating environment message messages included in the first information as verification message messages, and the validity of the metadata definition file is verified through the verification message messages.

[0103] Among them, in order to better ensure the accuracy of validity verification, the verification message message can be selected from the remaining operating environment message messages in the first information, and the remaining operating environment message messages refer to the message messages after removing at least one screened operating environment message message message from all received operating environment message messages.

[0104] Furthermore, the validity of the generated metadata definition file is verified based on the verification message.

[0105] In an optional manner in the embodiment of the present application, it is determined that the metadata definition file passes the validity verification in the following manner:

[0106] Use each of the at least two verification message messages to verify the validity of the generated metadata definition file, and determine that the ratio of the number of verification message messages corresponding to the metadata definition file that pass the validity verification to the number of the at least two verification message messages is not less than a first threshold.

[0107] When all fields in a verification message include all fields in the metadata definition file, it is determined that the metadata definition file passes the validity verification of the verification message.

[0108] Otherwise, it is determined that the metadata definition file is invalid.

[0109] Exemplarily, assuming that the first threshold is 50%, four operating environment message messages are selected from the remaining operating environment message messages as verification message messages, namely operating environment message messages 9 to operating environment message messages 12, for verifying the validity of the generated metadata definition file.

[0110] If all fields in the operating environment message message 9 include all fields in the metadata definition file, and all fields in the operating environment message message 11 include all fields in the metadata definition file, it is determined that the metadata definition file has passed the verification of the operating environment message message 9 and the operating environment message message 11, and the number of messages that pass the verification is 2, accounting for 50% of the total number of verified message messages, meeting the first threshold ratio, and therefore, it is determined that the metadata definition file is valid.

[0111] It should be noted that there are other ways to verify the validity of the metadata definition file in the embodiments of the present application, which are not specifically limited here.

[0112] Further, after determining that the metadata definition file has not successfully passed the validity verification, the metadata definition file is calibrated according to the at least two verification message packets to obtain a metadata definition file that meets the validity verification.

[0113] For example, the missing data structures in the current metadata definition file are supplemented and improved, and the incorrect data structures in the metadata definition file are modified and adjusted.

[0114] Exemplarily, a target field is determined, any one of the at least two verification message messages includes the target field, and the metadata definition file does not include the target field, and then the target field is added to the metadata definition file.

[0115] In addition, currently, in the process of determining the metadata definition file, the developer mainly manually generates the metadata definition file according to the corresponding information for making the metadata definition file. However, this method will generate certain labor costs, and the subjective writing of the metadata definition file by the developer is also difficult to ensure the accuracy of the metadata definition file.

[0116] To this end, an embodiment of the present application also provides an API metadata determination system, which inputs information used to determine the metadata definition file into the API metadata determination device, thereby automatically generating the metadata definition file, effectively saving labor costs, and being more efficient and convenient.

[0117] To facilitate understanding of the embodiments of the present application, first Figure 2 The API metadata determination method provided in the embodiment of the present application is described in detail with the API metadata determination system shown in FIG. Figure 2 As shown, the system includes a data processing device 210 and a data proofreading device 220 .

[0118] The data processing device 210 is mainly used to process the acquired operating environment message and generate a metadata definition file.

[0119] Among them, Figure 3 As shown, the data processing device in the embodiment of the present application mainly includes a data preprocessing module 211, a data mapping module 212 and a data generating module 213.

[0120] The data preprocessing module 211 is used to filter unrecognizable character information in the message.

[0121] The data mapping module 212 is used to determine the data structure corresponding to the pre-processed message.

[0122] The data generation module 213 is used to generate a metadata definition file according to the data structure.

[0123] Among them, Figure 4As shown, the data proofreading device in the embodiment of the present application mainly includes a proofreading file library 221 and a data generation module 222.

[0124] The proofreading file library 221 stores at least one real metadata definition file used for proofreading and / or at least one received operating environment message.

[0125] Specifically, the proofreading file library 221 stores the check message message determined by the second service for performing validity check and calibration on the metadata definition file.

[0126] The data proofreading module 222 is used to proofread the metadata definition file generated by the data processing device.

[0127] The system architecture and device structure described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. It is known to those skilled in the art that with the evolution of technology and the emergence of new business scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems. It should be understood that Figure 2 to Figure 4 The simplified schematic diagram is only for the sake of understanding. The system may also include other devices or other structures, the data processing device may also include other modules or other structures, and the data proofreading device may also include other modules or other structures. Figure 2 to Figure 4 Not drawn in.

[0128] Through the introduction of the above application scenarios and other contents, the embodiment of the present application provides a method for determining API metadata by applying the above API metadata determination system. For details, please refer to Figure 5 Steps shown.

[0129] S500: Obtain an input operating environment message.

[0130] S501: A data preprocessing module in the data processing device preprocesses the operating environment message.

[0131] Specifically, in the embodiment of the present application, the unrecognizable character information in the operating environment message is filtered through the data preprocessing module in the data processing device to obtain the filtered operating environment message.

[0132] For example, assume that the message input by the user is as follows:

[0133]

[0134] According to the content of the above message, it can be known that the message contains the following types of character information:

[0135] (1) string type: "extType", "auther";

[0136] (2)Array array type structure: "content";

[0137] (3) Boolean type structure: "visible";

[0138] (4) Number type: "id";

[0139] (5) Object type structure: "baseinfo";

[0140] Among them, there is unrecognizable character information in the above message, for example, "-123". Therefore, the "-123" is confirmed as illegal character information and deleted.

[0141] Further, in an embodiment of the present application, when filtering the message message through the data preprocessing module, if the data preprocessing module confirms that there is unrecognizable character information when preprocessing the message message, the data preprocessing module will prompt "there is unrecognizable character information" and provide the specific content of the unrecognizable character information. For example, the data preprocessing module prompts that "-123" is unrecognizable character information and needs to be deleted.

[0142] Furthermore, after the data preprocessing module preprocesses the above-mentioned operating environment message message, the following preprocessed operating environment message message is obtained:

[0143]

[0144]

[0145] S502: The data preprocessing module sends the preprocessed operating environment message to the data mapping module in the data processing device.

[0146] S503: The data mapping module generates a data structure according to the pre-processed operating environment message.

[0147] Specifically, the data mapping module generates the first data structure according to the data name and the data type to which the data value of each data in the filtered message.

[0148] In an optional manner in an embodiment of the present application, the data mapping module generates a sub-data structure corresponding to each data type in the message message, and then combines all the generated sub-data structures to obtain the first data structure.

[0149] Each data in the message has a corresponding name, and each data value has a corresponding data type. At present, according to the standard protocol specification, the type includes the following types: Array type, Object type, basic type and exception type Error.

[0150] The basic types include 8 kinds, which are divided into 4 categories, namely:

[0151] (1) Integer: including byte, short, int, long

[0152] (2) Generics: float, double;

[0153] (3) Character type: char;

[0154] (4) Boolean: boolean.

[0155] Furthermore, the data mapping module in the embodiment of the present application generates different sub-data structures according to different data types in the message, which are described below respectively:

[0156] Substructure 1: When the data type type is a basic type, the character information corresponding to the data type is directly converted into<name,type> Two-tuple.

[0157] Substructure 2: When the data type is Array, it means that the character information is an array, which is a set of data.

[0158] Therefore, it is necessary to convert the character information corresponding to the data type into<name,type,items> Items is the lower structure corresponding to the sub-data structure, that is, each element in the array is repeatedly and recursively parsed in the manner of sub-structure 1 to obtain a hierarchical structure.

[0159] Substructure 3: When the data type is Object, it means that the character information is an object. Therefore, the character information corresponding to the data type needs to be converted into<name,type,properties> Triple. Among them, properties are the sub-data structures corresponding to the object, that is, each object is repeatedly recursively parsed in the manner of sub-structure 1 and converted into a group of sub-data structures.

[0160] If the message contains character information of data type Error, the character information is directly ignored, and the corresponding substructure is not determined based on the character information.

[0161] Exemplarily, it is assumed that the data mapping module obtains the following according to each data type in the message: Figure 6 The first data structure is shown.

[0162] S504: The data mapping module sends the data structure to the data generating module in the data processing device.

[0163] S505: The data generation module generates a first metadata definition file according to the data structure.

[0164] In an optional manner in an embodiment of the present application, the data processing device determines a protocol for generating a metadata definition file according to a category identifier of the message message, and generates the metadata definition file according to the protocol and the data structure.

[0165] Exemplarily, assuming that the data structure is as above Figure 6 The data structure shown, and the protocol content for generating the metadata definition file determined by the data processing device according to the category identifier of the message message are as follows:

[0166]

[0167] Therefore, the metadata definition file generated by the data processing device according to the data structure and the protocol has the following content:

[0168]

[0169]

[0170] S506: The data generation module sends the first metadata definition file to the data proofreading module in the data proofreading device.

[0171] S507: The data verification module verifies the validity of the first metadata definition file to obtain a second metadata definition file.

[0172] If the first metadata definition file passes the validity verification of the data proofreading module, the first metadata definition file is used as the second metadata definition file. If the first metadata definition file does not pass the validity verification of the data proofreading module, the data proofreading module proofreads the first metadata definition file to obtain the proofread first metadata definition file, i.e., the second metadata definition file.

[0173] S508: Output the second metadata definition file.

[0174] Furthermore, after obtaining the second metadata definition file, the second service sends the second metadata definition file to the first service, so that the first service establishes an API interface according to the metadata definition file after receiving the metadata definition file.

[0175] Through the above introduction to the scheme of the present application, it can be understood that, in order to realize the above functions, the above-mentioned implementation devices include hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0176] Based on the above embodiments, Figure 7 As shown, the present application provides a device for determining API metadata, which may be a terminal device, and the terminal device includes a processor 700, a memory 701, and a communication interface 702.

[0177] The processor 700 is responsible for managing the bus architecture and general processing, and the memory 701 can store data used by the processor 700 when performing operations. The transceiver communication interface 702 is used to receive and send data under the control of the processor 700 to perform data communication with the memory 701.

[0178] The processor 700 may be a central processing unit (CPU), a network processor (NP) or a combination of a CPU and a NP. The processor 700 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. The memory 1001 may include 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.

[0179] The processor 700, the memory 701 and the communication interface 702 are interconnected. Optionally, the processor 700, the memory 701 and the communication interface 702 can be interconnected via a bus 703; the bus 703 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0180] Specifically, the processor 700 is used to read the program in the memory 701 and execute the following Figure 1 The method flow in S100-S103 shown in FIG. 100-103; or Figure 5 The method flow executed in S500-S508 is shown.

[0181] like Figure 8As shown, the present invention provides an API metadata determination device, the device comprising: at least one processing unit 800 and at least one storage unit 801, wherein the storage unit 801 stores a program code, and when the program code is executed by the processing unit 800, the processing unit 800 performs the following process:

[0182] Used to receive a first message sent by a first business, the first message is used to request a metadata definition file; filter out at least one operating environment message message from the operating environment message of the first business contained in the first message; generate a metadata definition file based on the at least one filtered operating environment message message; send the metadata definition file to the first business, so that the first business generates an API interface for service call with a second business according to the metadata definition file.

[0183] Specifically, the processing unit 800 is used to read the program of the storage unit 801 and execute the following steps: Figure 1 The method flow in S100-S103 shown in FIG. 100-103; or Figure 5 The method flow executed in S500-S508 is shown.

[0184] In a possible implementation, the processing unit 800 is further configured to:

[0185] Select at least two operating environment message messages from the operating environment message messages included in the first information as at least two verification message messages; verify the validity of the generated metadata definition file based on the at least two verification message messages; and determine that the metadata definition file passes the validity verification.

[0186] In a possible implementation, the processing unit 800 is specifically configured to:

[0187] Use each of the at least two verification message messages to verify the validity of the generated metadata definition file; and determine that the ratio of the number of verification message messages corresponding to the metadata definition file that pass the validity verification to the number of the at least two verification message messages is not less than a first threshold; wherein, when all fields in a verification message message include all fields in the metadata definition file, it is determined that the metadata definition file passes the validity verification of the verification message message.

[0188] In a possible implementation, the processing unit 800 is further configured to:

[0189] After determining that the metadata definition file has not successfully passed the validity verification, the metadata definition file is calibrated according to the at least two verification message packets to obtain a metadata definition file that meets the validity verification.

[0190] In a possible implementation, the processing unit 800 is specifically configured to:

[0191] Determine a target field, any one of the at least two verification message messages includes the target field, and the metadata definition file does not include the target field; add the target field to the metadata definition file.

[0192] In a possible implementation, the processing unit 800 is further configured to:

[0193] The operating environment message message is preprocessed, and unrecognizable character information in the operating environment message message is filtered to obtain a filtered operating environment message message.

[0194] In a possible implementation, the processing unit 800 is further configured to:

[0195] When the number of the screened operating environment message messages includes at least two, the at least two operating environment message messages are integrated to generate a first operating environment message message; and a metadata definition file is generated according to the first operating environment message.

[0196] In a possible implementation, the processing unit 800 is specifically configured to:

[0197] Determine a field whose number of appearances in the at least two operating environment message messages is not less than a second threshold; generate a first operating environment message message based on the field that is not less than the second threshold, wherein the first operating environment message message includes the field that is not less than the second threshold.

[0198] For a detailed description of the functions or operations performed by the API metadata determination device provided in the present application, reference can be made to the steps performed by the API metadata determination method described in the method embodiment of the present application, which will not be repeated here.

[0199] In some possible implementations, various aspects of the API metadata determination method provided by the embodiments of the present invention may also be implemented in the form of a program product, which includes a program code. When the program code is run on a computer device, the program code is used to enable the computer device to perform the steps of the API metadata determination method according to various exemplary embodiments of the present invention described in this specification.

[0200] The program product may adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. Examples of readable storage media in one implementation of the present application embodiment (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0201] The program product for API metadata determination according to an embodiment of the present invention may be a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a server device. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with a message transmission, an apparatus or a device.

[0202] The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium, which may transmit, propagate, or transfer a program for use by or in conjunction with a periodic network action system, apparatus, or device.

[0203] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0204] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device.

[0205] The embodiment of the present application also provides a computing device readable storage medium for the API metadata determination method, that is, the content is not lost after power failure. The storage medium stores a software program, including program code, and when the program code is run on a computing device, the software program can implement any of the above API metadata determination solutions of the embodiment of the present application when it is read and executed by one or more processors.

[0206] The present application is described above with reference to the block diagrams and / or flow charts showing the methods, devices (systems) and / or computer program products according to the embodiments of the present application. It should be understood that a block of the block diagram and / or flow chart diagram and a combination of blocks of the block diagram and / or flow chart diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer and / or other programmable data processing device to produce a machine, so that the instructions executed by the computer processor and / or other programmable data processing device create a method for implementing the functions / actions specified in the block diagram and / or flow chart block.

[0207] Accordingly, the present application may also be implemented with hardware and / or software (including firmware, resident software, microcode, etc.). Furthermore, the present application may take the form of a computer program product on a computer-usable or computer-readable storage medium, which has a computer-usable or computer-readable program code implemented in the medium, for use by an instruction execution system or in conjunction with an instruction execution system. In the context of the present application, a computer-usable or computer-readable medium may be any medium that may contain, store, communicate, transmit, or convey a program for use by an instruction execution system, device, or apparatus, or in conjunction with an instruction execution system, device, or apparatus.

[0208] Although the present application has been described in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely exemplary illustrations of the present application as defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, a person skilled in the art may make various modifications and variations to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for determining API metadata, characterized in that: include: receiving first information sent by a first service, wherein the first information is used to request a metadata definition file; Filtering at least one operating environment message message from the operating environment message messages of the first service contained in the first information; Generate a metadata definition file according to at least one of the screened operating environment message packets; Sending the metadata definition file to the first service, so that the first service generates an application programming interface API for service calling with the second service according to the metadata definition file; Before sending the metadata definition file to the first service, the method further includes: Selecting at least two operating environment message messages from the operating environment message messages included in the first information as at least two verification message messages; Performing validity verification on the generated metadata definition file according to the at least two verification message packets; Determining that the metadata definition file passes validity verification; The step of determining that the metadata definition file passes the validity verification includes: Using each of the at least two verification message messages respectively, verify the validity of the generated metadata definition file; and determining that the ratio of the number of verification message messages corresponding to the metadata definition file passing the validity verification to the number of the at least two verification message messages is not less than a first threshold; When all fields in a verification message include all fields in the metadata definition file, it is determined that the metadata definition file passes the validity verification of the verification message; The method further comprises: After determining that the metadata definition file has not successfully passed the validity verification, the metadata definition file is calibrated according to the at least two verification message packets to obtain a metadata definition file that meets the validity verification.

2. The method according to claim 1, characterized in that Calibrating the metadata definition file according to the at least two verification message packets includes: Determine a target field, any one of the at least two verification message messages includes the target field, and the metadata definition file does not include the target field; The target field is added to the metadata definition file.

3. The method according to claim 1 or 2, characterized in that Before generating a metadata definition file according to at least one of the screened operating environment message packets, the method further includes: The operating environment message message is preprocessed, and unrecognizable character information in the operating environment message message is filtered to obtain a filtered operating environment message message.

4. The method according to claim 1 or 2, characterized in that: The step of generating a metadata definition file according to at least one of the screened operating environment message packets further comprises: When the number of the screened operating environment message packets includes at least two, integrating the at least two operating environment message packets to generate a first operating environment message packet; Generate a metadata definition file according to the first operating environment message.

5. The method according to claim 4, characterized in that Integrating at least two operating environment message messages to generate a first operating environment message message includes: Determine a field in the at least two operating environment message messages that appears a number of times not less than a second threshold; A first operating environment message packet is generated according to the field that is not less than the second threshold, wherein the first operating environment message packet includes the field that is not less than the second threshold.

6. An API metadata determination device, characterized in that: include: Processor and memory; The memory is used to store program instructions; The processor is configured to execute the method according to any one of claims 1 to 5 by calling the program instructions stored in the memory.

7. A computer-readable storage medium, characterized in that: The method comprises computer instructions, and when the computer instructions are executed on an API metadata determination device, the API metadata determination device is caused to execute the method as claimed in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for generating interface service, calculation equipment and medium

    CN111045756A