Method, device, equipment and storage medium for determining interface protocol
By collecting and evaluating interface specifications and using specification evaluation models to generate interface specification documents, the time-consuming and labor-intensive problems of traditional interface specifications are solved, and fast and efficient interface development and quality assurance are achieved.
Patent Information
- Application Number
- CN202111231941.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-22
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2041-10-22
AI Technical Summary
The traditional method of determining interface specifications requires multiple discussions, which is time-consuming and labor-intensive, resulting in difficulty in improving development efficiency and high costs.
Collect multiple interface specifications, determine the development scenario corresponding to each interface specification through the trained specification evaluation model, generate multiple sets of interface specification documents, and quickly match the target interface specification document when receiving a development request.
It simplifies the development process of interface specifications, saves costs, improves development efficiency, and ensures the quality of interface development and meets customer needs.
Smart Images

Figure CN113885839B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of artificial intelligence technology, and in particular relates to a method, apparatus, device, and storage medium for determining an interface protocol. Background Art
[0002] With the development of internet technology, separating front-end and back-end functions has become the way more and more internet companies build applications. Traditional front-end and back-end development requires back-and-forth meetings between the two parties to discuss and agree on interface specifications, such as interface content, message formats, and fields. This is not only time-consuming and labor-intensive, but also hinders development efficiency and keeps development costs high. Summary of the Invention
[0003] In view of this, the embodiments of the present application provide a method, apparatus, device and storage medium for determining interface specifications to solve the problem that the traditional method of determining interface specifications requires multiple discussions on agreed interface specifications, which is time-consuming and labor-intensive, resulting in difficulty in improving development efficiency and high development costs.
[0004] A first aspect of an embodiment of the present application provides a method for determining an interface specification, the method comprising:
[0005] Collecting multiple interface specifications, including interface identification specifications, attribute specifications, mode specifications, security specifications, message specifications, and parameter specifications;
[0006] Inputting the multiple interface specifications into a trained specification evaluation model for processing to obtain a development scenario corresponding to each of the interface specifications;
[0007] Determining multiple groups of interface specification documents according to the development scenarios corresponding to each of the interface specifications;
[0008] When a development interface request is received, determining an actual development scenario corresponding to the development interface request;
[0009] Determine a target interface specification document that matches the actual development scenario from among the multiple groups of interface specification documents.
[0010] Optionally, the inputting the multiple interface specifications into a trained specification evaluation model for processing to obtain a development scenario corresponding to each interface specification includes:
[0011] For each of the interface specifications, performing word segmentation processing on the interface specifications based on the specification evaluation model to obtain multiple word segments;
[0012] Determining keywords corresponding to the interface specification from the multiple participles;
[0013] The keywords are classified and processed by the specification evaluation model to obtain the development scenario corresponding to the interface specification.
[0014] Optionally, the target interface specification document is used by the developer to develop an interface according to the target interface specification document. After determining the target interface specification document matching the actual development scenario from the multiple groups of interface specification documents, the method further includes:
[0015] Get interface development results;
[0016] Parsing the target interface specification document to obtain a parsing result;
[0017] Verifying the interface development result according to the analysis result;
[0018] When the inspection result shows that the interface development result is qualified, the interface is released.
[0019] Optionally, after verifying the interface development result according to the parsing result, the method further includes:
[0020] When the inspection result shows that the interface development result is unqualified, the target interface specification document is modified, and the modified target interface specification document is used by the developer to redevelop the interface.
[0021] Optionally, after verifying the interface development result according to the parsing result, the method further includes:
[0022] When the inspection result shows that the interface development result is unqualified, determining the error type of the interface;
[0023] Generate prompt information according to the error type.
[0024] Optionally, determining multiple groups of interface specification documents according to the development scenarios corresponding to each interface specification includes:
[0025] Determining interface specifications belonging to the same development scenario based on the development scenario corresponding to each interface specification;
[0026] The interface specifications belonging to the same development scenario are combined to obtain the multiple groups of interface specification documents.
[0027] Optionally, before inputting the multiple interface specifications into a trained specification evaluation model for processing to obtain a development scenario corresponding to each interface specification, the method further includes:
[0028] Obtaining a sample training set, the sample training set including a plurality of sample interface specifications and a sample development scenario corresponding to each of the sample interface specifications;
[0029] Training an initial protocol evaluation network based on the sample training set, and updating parameters of the initial protocol evaluation network based on the training results;
[0030] When it is detected that the loss function corresponding to the initial reduction evaluation network converges, the reduction evaluation model is obtained.
[0031] A second aspect of an embodiment of the present application provides a device for determining an interface protocol, including:
[0032] A collection unit, configured to collect a plurality of interface specifications, wherein the interface specifications include interface identification specifications, attribute specifications, mode specifications, security specifications, message specifications, and parameter specifications;
[0033] A processing unit, configured to input the plurality of interface specifications into a trained specification evaluation model for processing, and obtain a development scenario corresponding to each of the interface specifications;
[0034] A first determining unit, configured to determine a plurality of groups of interface specification documents according to a development scenario corresponding to each of the interface specifications;
[0035] A second determining unit is configured to, when receiving a development interface request, determine an actual development scenario corresponding to the development interface request;
[0036] The development unit is configured to determine a target interface specification document that matches the actual development scenario from among the multiple groups of interface specification documents.
[0037] A third aspect of an embodiment of the present application provides a device for determining an interface protocol, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for determining the interface protocol as described in the first aspect above when executing the computer program.
[0038] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the method for determining the interface protocol as described in the first aspect above.
[0039] A fifth aspect of the embodiments of the present application provides a computer program product. When the computer program product runs on a device, the device executes the steps of the method for determining the interface protocol described in the first aspect above.
[0040] The method, apparatus, device, and storage medium for determining an interface protocol provided in the embodiments of the present application have the following beneficial effects:
[0041] Collect multiple interface specifications, which include interface identification specifications, attribute specifications, mode specifications, security specifications, message specifications, and parameter specifications; input multiple interface specifications into a trained specification evaluation model for processing to obtain the development scenario corresponding to each interface specification; determine multiple groups of interface specification documents based on the development scenario corresponding to each interface specification; when a development interface request is received, determine the actual development scenario corresponding to the development interface request; and determine the target interface specification document that matches the actual development scenario in the multiple groups of interface specification documents. In the above scheme, multiple interface specifications are collected, and the development scenario corresponding to each interface specification is determined by the specification evaluation model, and then multiple groups of interface specification documents are determined. When a development interface request is received, the target interface specification document that can be used to develop the interface is quickly determined in the multiple groups of interface specification documents. This method quickly generates and determines the target interface specification document for developing the interface, without the need for the development parties to discuss the interface specification back and forth multiple times, simplifying the steps of developing interface agreement specifications, saving the cost of developing interfaces, and improving development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0043] Figure 1 is a schematic flow chart of a method for determining an interface protocol provided by an exemplary embodiment of the present application;
[0044] Figure 2 This is a specific flow chart of step S102 of the method for determining the interface protocol shown in an exemplary embodiment of the present application;
[0045] Figure 3 is a specific flow chart of a method for verifying interface development results shown in yet another exemplary embodiment of the present application;
[0046] Figure 4 is a specific flow chart of a method for training a specification evaluation model shown in yet another exemplary embodiment of the present application;
[0047] Figure 5 is a schematic diagram of a device for determining an interface protocol provided by an embodiment of the present application;
[0048] Figure 6 This is a schematic diagram of a device for determining an interface protocol provided by another embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0050] In the description of the embodiments of this application, unless otherwise specified, " / " represents or. For example, A / B can represent A or B. "And / or" in this article is simply a description of the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of this application, "plurality" means two or more than two.
[0051] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.
[0052] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0053] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning, deep learning, and supervised learning.
[0054] See Figure 1 , Figure 1 This is a schematic flow chart of a method for determining an interface protocol provided by an exemplary embodiment of the present application. The method for determining an interface protocol provided by the present application is performed by a device for determining the interface protocol, wherein the device includes but is not limited to mobile terminals such as smartphones, tablet computers, computers, personal digital assistants (PDAs), and desktop computers, and may also include various types of servers.
[0055] For example, the server can be a stand-alone server or a cloud service that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0056] In the embodiments of the present application, a computer terminal is used as an example for explanation.
[0057] like Figure 1 The method for determining the interface protocol may include: S101 to S105, which are specifically as follows:
[0058] S101: Collect multiple interface specifications, including interface identification specifications, attribute specifications, mode specifications, security specifications, message specifications, and parameter specifications.
[0059] For example, an interface specification includes an interface identification specification, an attribute specification, a mode specification, a security specification, a message specification, a parameter specification, a request connection, and a request type. The interface identification specification specifies the interface identifier, the attribute specification specifies the attribute parameters, the mode specification specifies the interaction mode, the security specification specifies the encryption and decryption methods, the message specification specifies the message format, and the parameter specification specifies the request parameters and the parameters returned for the request. This is for illustrative purposes only and is not intended to be limiting.
[0060] For example, various types of developed interfaces can be obtained, and the corresponding interface specifications can be obtained. Alternatively, multiple interface specifications can be collected from the network, or multiple interface specifications can be customized by the user. Any combination of these methods of obtaining interface specifications can also be used. This is merely an example and is not intended to be limiting.
[0061] S102: Input multiple interface specifications into the trained specification evaluation model for processing to obtain a development scenario corresponding to each interface specification.
[0062] Exemplarily, each interface specification is sequentially input into the trained specification evaluation model for processing, and the specification evaluation model outputs a development scenario corresponding to each interface specification.
[0063] In this embodiment, a pre-trained protocol evaluation model is pre-stored in the terminal. This protocol evaluation model is obtained by training an initial protocol evaluation network using a machine learning algorithm based on a sample training set. The sample training set may include multiple sample interface protocols and a sample development scenario corresponding to each sample interface protocol.
[0064] It is understood that the protocol evaluation model can be pre-trained by the terminal, or pre-trained by another device and then the corresponding file of the protocol evaluation model transplanted to the terminal. In other words, the execution entity that trains the protocol evaluation model and the execution entity that uses the protocol evaluation model can be the same or different.
[0065] For example, when using another device to train an initial protocol evaluation network (an untrained protocol evaluation model), after the other device completes training of the initial protocol evaluation network, it fixes the parameters of the initial protocol evaluation network to obtain a file corresponding to the trained protocol evaluation model. This file is then ported to the terminal. The initial protocol evaluation network refers to the untrained protocol evaluation model.
[0066] S103: Determine multiple groups of interface specification documents according to the development scenario corresponding to each interface specification.
[0067] For example, an interface specification document refers to a document consisting of interface specifications, which may include information such as interface identification specifications, attribute specifications, mode specifications, security specifications, message specifications, parameter specifications, connection request, and request type.
[0068] For example, based on the development scenario corresponding to each interface specification, interface specifications belonging to similar scenarios are determined, and the interface specifications belonging to similar development scenarios are combined to obtain multiple groups of interface specification documents. Each group of interface specification documents includes multiple interface specifications belonging to similar development scenarios.
[0069] For example, the development scenario corresponding to interface specification A is the login scenario of social software A, and the development scenario corresponding to interface specification B is the login scenario of social software B. Social software A and social software B are not the same, but they are both social software, and both interface specifications correspond to login scenarios. Therefore, the development scenario corresponding to interface specification A and the development scenario corresponding to interface specification B are similar development scenarios.
[0070] For another example, the development scenario corresponding to the C interface protocol is the subscription scenario of the C fund software, and the development scenario corresponding to the D interface protocol is the subscription scenario of the D fund software. The C fund software and the D fund software are not the same, but both belong to fund trading software, and both interface protocols correspond to the subscription scenario. Therefore, the development scenario corresponding to the C interface protocol and the development scenario corresponding to the D interface protocol are similar development scenarios.
[0071] This is merely an example and is not intended to be limiting.
[0072] Optionally, in some possible implementations of the present application, the above S103 may include S1031 to S1032, which are specifically as follows:
[0073] S1031: Determine interface specifications belonging to the same development scenario based on the development scenario corresponding to each interface specification.
[0074] For example, interface specifications with identical development scenarios are selected from these interface specifications. For example, text similarity software can be used to determine identical development scenarios, and interface specifications corresponding to the identical development scenarios are obtained to obtain interface specifications belonging to the same development scenario.
[0075] For example, the development scenarios may include normal login (such as login to various websites, login to social software, etc.), submitting orders, subscribing to funds, redeeming funds, purchasing insurance, logging out, etc. This is only an example and is not intended to be limiting.
[0076] S1032: Combine interface specifications belonging to the same development scenario to obtain multiple groups of interface specification documents.
[0077] Each set of interface specification documents includes multiple interface specifications belonging to the same development scenario.
[0078] For example, an interface specification is an interface identification specification, and its corresponding development scenario is fund subscription. Another interface specification is an attribute specification, and its corresponding development scenario is also fund subscription. Therefore, the interface identification specification and the attribute specification belong to the same interface specification for the same development scenario.
[0079] Optionally, multiple interface specifications belonging to the same development scenario may be deduplicated. For example, multiple interface specifications belonging to the same development scenario are detected to see if there are identical interface specifications, and one identical interface specification is retained and the rest are deleted.
[0080] S104: When a development interface request is received, an actual development scenario corresponding to the development interface request is determined.
[0081] For example, the actual development scenario can be understood as the scenario in which the interface is developed, that is, what kind of scenario the interface is developed for.
[0082] Interface requests can include client interface requests, server interface requests, and so on. For example, when a client interface needs to be developed, a client interface request is sent, which carries the actual development scenario corresponding to the client, and the actual development scenario is obtained. For example, if a client needs to develop a login interface, the client interface request sent carries the actual development scenario of normal login, and the development scenario is obtained. This is merely an example and is not intended to be limiting.
[0083] There are no restrictions on the method of interface request, and you can choose according to actual development needs. For example, the request method may include Get request (issuing a request to a specific resource), Post request (submitting data to a specified resource for processing), Put request (uploading the latest content to a specified resource location), Head request (similar to Get request, the returned response does not contain specific content, and is used to obtain the header), Delete request (requesting the server to delete a page), Trace request (used for testing and diagnosis), Opions request (allowing the client to view server performance), etc.
[0084] S105: Determine a target interface specification document that matches the actual development scenario from the multiple groups of interface specification documents.
[0085] Exemplarily, the development scenario corresponding to each set of interface specification documents is obtained, and in the development scenario corresponding to each set of interface specification documents, the interface specification document corresponding to the development scenario that matches the actual development scenario is searched, and the interface specification document found is the target interface specification document.
[0086] The target interface specification document may include: an interface identification specification (specifying an interface identifier), an attribute specification (specifying attribute parameters), a mode specification (specifying an interaction mode), a security specification (specifying encryption and decryption methods), a message specification (specifying a message format), a parameter specification (specifying request parameters and parameters returned for the request), a request type (i.e., a request method), etc. This is merely an example and is not intended to be limiting.
[0087] Developers can develop interfaces based on the data in the target interface specification document. The specific interface development methods can refer to existing methods for developing interfaces. However, in existing methods, the interface specification is determined through multiple rounds of discussions between the development and development parties. In this solution, the target interface specification document is determined through the same method.
[0088] In the above solution, multiple interface specifications are collected, and the development scenarios corresponding to each interface specification are determined using a specification evaluation model. This leads to the identification of multiple sets of interface specification documents. When a request to develop an interface is received, the target interface specification document that can be used to develop the interface is quickly identified from these multiple sets of interface specification documents. This method quickly generates and identifies the target interface specification document for developing the interface, eliminating the need for multiple rounds of interface specification discussions between the development parties. This simplifies the process of developing interface agreements and reduces development costs. Furthermore, developing the interface based on the identified target interface specification document improves efficiency.
[0089] Optionally, in some possible implementations of this application, the target interface specification document may be adjusted based on customer needs. For example, if a customer has special requirements for the interface being developed, the interface specification related to that special requirement may be adjusted accordingly. The interface is then developed based on the adjusted target interface specification document.
[0090] In this implementation method, the target interface specification document is adjusted according to customer needs, so that the final developed interface can better meet customer requirements, avoid multiple adjustments to the developed interface, and indirectly improve the efficiency of interface development.
[0091] See Figure 2 , Figure 2 This is a specific flow chart of step S102 of the method for determining the interface protocol according to an exemplary embodiment of the present application. Optionally, in some possible implementations of the present application, the above S102 may include S1021 to S1023, as follows:
[0092] S1021: For each interface specification, perform word segmentation processing on the interface specification based on the specification evaluation model to obtain multiple word segments.
[0093] For example, for each interface specification, a word segmentation process is performed on the interface specification. Word segmentation process refers to dividing a continuous sequence of words in the interface specification into multiple word sequences, i.e., obtaining multiple word segments. Specifically, the specification evaluation model may include a word segmentation algorithm, and the word segmentation algorithm is used to perform word segmentation on the interface specification to obtain multiple word segments corresponding to the word segmentation algorithm.
[0094] S1022: Determine keywords corresponding to the interface specification from the multiple segmented words.
[0095] Exemplarily, for each interface protocol, multiple word sequences are processed based on the network layer in the protocol evaluation model, that is, each word segment is mapped to the vector space to obtain the vector feature corresponding to each word segment.
[0096] Determine the cosine similarity between the vector feature corresponding to each word segment and the interface specification. Normalize each cosine similarity to obtain a correlation value between each word segment and the interface specification. A larger correlation value indicates a higher correlation between the word segment and the interface specification; a smaller correlation value indicates a lower correlation between the word segment and the interface specification.
[0097] According to the correlation degree between each word segment and the interface specification, the keyword corresponding to the interface specification is determined.
[0098] Specifically, for each interface specification, the corresponding vector features are determined based on the specification evaluation model. The cosine similarity between the vector features corresponding to each word segment and the vector features corresponding to the interface specification is calculated. Softmax logistic regression is performed on each cosine similarity, ensuring that the cosine similarity value falls within the range [0, 1]. This yields the degree of association between each word segment and the interface specification.
[0099] All the segmented words are sorted based on the relevance value corresponding to each segmented word, and several segmented words are selected from the sorted words as keywords corresponding to the interface specification based on the sorted results. For example, based on the relevance value corresponding to each segmented word, all the segmented words are sorted from large to small, and several segmented words with the highest sorted positions are selected as keywords corresponding to the interface specification.
[0100] Alternatively, based on the relevance value corresponding to each segmented word, all segmented words are sorted from smallest to largest, and several segmented words with the lowest ranking are selected as keywords corresponding to the interface specification. There is no limit on the number of keywords and it can be adjusted according to actual conditions.
[0101] For example, the keywords corresponding to a certain interface specification may be any one or more of "unauthorized access", "brute force attack", "security verification", "secure login", etc. This is merely an example and is not intended to limit the scope of the present invention.
[0102] S1023: Classify the keywords through the specification evaluation model to obtain the development scenario corresponding to the interface specification.
[0103] Exemplarily, the specification evaluation model may include a fully connected layer that classifies keywords to obtain the development scenario corresponding to the interface specification. Specifically, the fully connected layer calculates the probability that the keyword belongs to each development scenario, and the development scenario with the highest probability is selected as the development scenario corresponding to the interface specification.
[0104] For example, when the keyword corresponding to a certain interface specification is "override", the development scenario corresponding to the corresponding interface specification is "normal login". This is only an example and is not intended to be limiting.
[0105] During training, the specification evaluation model learns the connections between different interface specifications and their corresponding development scenarios, and continuously adjusts the specification evaluation model parameters to make the model's processing results increasingly accurate. Therefore, when processing multiple interface specifications based on the trained specification evaluation model, the development scenario corresponding to each interface specification can be accurately and quickly determined.
[0106] See Figure 3 , Figure 3is a specific flow chart of a method for checking interface development results shown in another exemplary embodiment of the present application; optionally, in some possible implementations of the present application, when executing Figure 1 After the method shown, a method for verifying the interface development result may be further included. The method for verifying the interface development result may include: S106 to S109, which are specifically as follows:
[0107] S106: Obtain interface development results.
[0108] For example, a developer develops an interface according to a target interface specification document, and after the development is completed, obtains an interface development result corresponding to the interface. The interface development result may include data responding to the interface request, the interface name, and the functions implemented by the interface.
[0109] S107: Parse the target interface specification document to obtain a parsing result.
[0110] The parsing results may include data such as the user request method, requested module name, interface name, description type, interface function, return parameters, request parameters, decryption method, encryption method, and interface access rights.
[0111] For example, specific data such as the interface request method, the requested module name, the interface name, the description type, the interface function, and the interface access rights are extracted from the target interface specification document.
[0112] S108: Verify the interface development results based on the analysis results.
[0113] Based on the customer's needs, verify the correctness of each piece of data in the parsing results. For example, if the request method in the parsing results is a Get request, test the developed interface to see if it also uses a Get request method. If the developed interface corresponds to a Get request method, then the developed interface has no issues with the request method.
[0114] For example, if the return parameter in the parsing result is this.yxVideos = data.data, test the developed interface to see if its return parameter is also this.yxVideos = data.data. If the return parameter of the developed interface is this.yxVideos = data.data, then it proves that there is no problem with the developed interface in terms of return parameters.
[0115] This is just an example and is not limiting.
[0116] S109: When the inspection result shows that the interface development result is qualified, the interface is released.
[0117] For example, based on each item in the analysis result, the interface development result is sequentially checked. If there are no problems with the developed interface based on each item in the analysis result, the interface developed this time is qualified and released.
[0118] In this embodiment, the target interface specification document is parsed to obtain the parsing result, and the developed interface is verified based on the parsing result, which can ensure the quality of the developed interface, avoid the release of unqualified interfaces, and cause economic losses to customers, thereby indirectly improving the customer experience.
[0119] Optionally, in some possible implementations of the present application, after S108, the following may be included: when the inspection result shows that the interface development result is unqualified, modifying the target interface specification document, and the modified target interface specification document is used by developers to develop the interface again.
[0120] For example, based on each item in the analysis result, the interface development results are sequentially checked. If one or more of the developed interfaces have problems based on each item in the analysis result, it is proved that the interface developed this time is unqualified and cannot be directly released.
[0121] Determine which content in the developed interface has a problem, and further determine whether the problem is caused by an error during the interface development process or an unreasonable setting of this content in the target interface specification document. If the former is the case, fix the error in the interface; if the latter is the case, modify the problematic content in the target interface specification document accordingly, and developers can redevelop the interface based on the modified target interface specification document.
[0122] In this embodiment, the target interface specification document is parsed to obtain a parsing result, and the developed interface is verified based on the parsing result. When the inspection result of the developed interface is unqualified, the problems in the interface are repaired, which can ensure the quality of the developed interface and avoid releasing unqualified interfaces, which would cause economic losses to customers and indirectly improve the customer experience.
[0123] Optionally, in some possible implementations of the present application, after S108, the following steps may be performed: when the inspection result shows that the interface development result is unqualified, determining the error type of the interface; and generating a prompt message according to the error type. The prompt message is used to inform the developer of the error type corresponding to the current interface.
[0124] Error types may include permission settings, return parameters, request methods, encryption methods, decryption methods, etc.
[0125] For example, if one or more issues exist in the developed interface based on each item in the analysis result, the interface is deemed unqualified and cannot be directly released. The issue is determined for the item in the developed interface, and the error type corresponding to the issue is determined based on the item in question.
[0126] Generate a prompt based on the error type. For example, if the error type is a return parameter, you might generate a prompt: "Current return parameter is incorrect, please adjust." This prompt is displayed to the developer. This is for illustrative purposes only and is not intended to be limiting.
[0127] In this embodiment, when the inspection result of the developed interface is unqualified, the corresponding error type is determined, and the developer is reminded based on the error type, so that the developer can make timely and targeted adjustments to the developed interface.
[0128] See Figure 4 , Figure 4 is a specific flow chart of a method for training a specification evaluation model shown in another exemplary embodiment of the present application; optionally, in some possible implementations of the present application, when executing Figure 1 Before the method shown, a method for training a specification evaluation model may be included. The method for training a specification evaluation model may include: S201 to S203, which are specifically as follows:
[0129] S201: Obtain a sample training set, where the sample training set includes multiple sample interface specifications and a sample development scenario corresponding to each sample interface specification.
[0130] Exemplarily, a sample training set is obtained, comprising multiple sample interface specifications and sample development scenarios corresponding to each sample interface specification. For example, various types of developed interfaces can be obtained, the interface specifications corresponding to these interfaces can be obtained, and the development scenarios corresponding to these interface specifications can be annotated. Alternatively, multiple interface specifications can be collected online and the development scenarios corresponding to these interface specifications can be annotated. Alternatively, multiple user-defined interface specifications can be annotated with the development scenarios corresponding to each interface specification.
[0131] Optionally, some data can be selected from the sample training set as a test set. For example, some sample interface specifications and sample development scenarios corresponding to these sample interface specifications can be selected from the sample training set as a test set.
[0132] S202: Train the initial protocol evaluation network based on the sample training set, and update the parameters of the initial protocol evaluation network based on the training results.
[0133] For example, multiple sample interface protocols in the sample training set, as well as the sample development scenarios corresponding to each sample interface protocol, are input into the initial protocol evaluation network (untrained protocol evaluation model) for training. The gradient descent method can be selected for training. The hidden layer in the initial protocol evaluation network learns the vector features of the label corresponding to each sample interface protocol (i.e., its corresponding sample development scenario). The initial protocol evaluation network's processing of the sample interface protocol can be referred to the description in S102 above and will not be repeated here.
[0134] S203: When it is detected that the loss function corresponding to the initial reduced evaluation network converges, a reduced evaluation model is obtained.
[0135] Exemplarily, when a preset number of training cycles is reached, the initial protocol evaluation network is tested based on the test set. Exemplarily, the sample interface protocol in the test set is input into the initial protocol evaluation network for processing, and the initial protocol evaluation network outputs the development scenario corresponding to the sample interface protocol. The loss value between the development scenario corresponding to the sample interface protocol and the sample development scenario corresponding to the sample interface protocol is calculated based on a preset loss function. The loss function may be a cross-entropy loss function.
[0136] When the loss value does not meet the preset conditions, the parameters of the initial reduction evaluation network are adjusted (for example, the weight values corresponding to the hidden layers of the initial reduction evaluation network are adjusted), and the initial reduction evaluation network is continued to be trained. When the loss value meets the preset conditions, the training of the initial reduction evaluation network is stopped, and the trained initial reduction evaluation network is used as the trained reduction evaluation model.
[0137] For example, assuming the preset condition is that the loss value is less than or equal to a preset loss value threshold. Then, when the loss value is greater than the loss value threshold, the parameters of the initial reduction evaluation network are adjusted, and training of the initial reduction evaluation network continues. When the loss value is less than or equal to the loss value threshold, training of the initial reduction evaluation network is stopped, and the trained initial reduction evaluation network is used as the trained reduction evaluation model. This is merely an example and is not intended to be limiting.
[0138] Optionally, during the training of the initial reduction evaluation network, the convergence of the loss function corresponding to the initial reduction evaluation network can be observed. If the loss function does not converge, the parameters of the initial reduction evaluation network can be adjusted, and the training of the initial reduction evaluation network can be continued. When the loss function converges, the training of the initial reduction evaluation network is stopped, and the trained initial reduction evaluation network is used as the trained reduction evaluation model. The convergence of the loss function means that the value of the loss function tends to be stable. This is only for illustrative purposes and is not intended to be limiting.
[0139] In this embodiment, the initial protocol evaluation network is trained based on the sample training set to obtain a protocol evaluation model, which facilitates subsequent processing of the interface protocol based on the protocol evaluation model, thereby quickly generating an interface protocol document.
[0140] Alternatively, in one possible implementation, the method for determining interface specifications provided in this application can also be applied to the medical field. For example, when developing a medical-related interface, the method for determining interface specifications provided in this application can quickly generate and determine an interface specification document for developing the medical interface, eliminating the need for the development parties to repeatedly discuss the interface specification. This simplifies the steps for developing the medical interface specification and saves the cost of developing the medical interface. Furthermore, developing the medical interface based on the determined interface specification document improves the efficiency of developing the medical interface.
[0141] The files to be classified can be medical files, specifically personal health records, medical records, examination report files, etc. Classifying and displaying medical files helps patients and doctors check their conditions and facilitates treatment.
[0142] See Figure 5 , Figure 5 This is a schematic diagram of a device for determining an interface protocol provided by an embodiment of the present application. The various units included in the device 3 are used to execute Figure 1 - Figure 4 Each step in the corresponding embodiment. Please refer to Figure 1 - Figure 4 For the convenience of explanation, only the parts related to this embodiment are shown. Figure 5 ,include:
[0143] The collection unit 310 is used to collect multiple interface specifications, including interface identification specifications, attribute specifications, mode specifications, security specifications, message specifications, and parameter specifications;
[0144] The processing unit 320 is configured to input the plurality of interface specifications into a trained specification evaluation model for processing to obtain a development scenario corresponding to each of the interface specifications;
[0145] A first determining unit 330 is configured to determine multiple groups of interface specification documents according to the development scenario corresponding to each of the interface specifications;
[0146] The second determining unit 340 is configured to, upon receiving a development interface request, determine an actual development scenario corresponding to the development interface request;
[0147] The development unit 350 is configured to determine a target interface specification document that matches the actual development scenario from among the multiple groups of interface specification documents.
[0148] Optionally, the processing unit 320 is specifically configured to:
[0149] For each of the interface specifications, performing word segmentation processing on the interface specifications based on the specification evaluation model to obtain multiple word segments;
[0150] Determining keywords corresponding to the interface specification from the multiple participles;
[0151] The keywords are classified and processed by the specification evaluation model to obtain the development scenario corresponding to the interface specification.
[0152] Optionally, the device further comprises:
[0153] An acquisition unit, used to obtain interface development results;
[0154] A parsing unit, configured to parse the target interface specification document to obtain a parsing result;
[0155] The inspection unit is used to inspect the interface development result according to the analysis result; the publishing unit is used to publish the interface when the inspection result shows that the interface development result is qualified.
[0156] Optionally, the device further comprises:
[0157] The modification unit is used to modify the target interface specification document when the inspection result shows that the interface development result is unqualified, and the modified target interface specification document is used by the developer to redevelop the interface.
[0158] Optionally, the device further comprises:
[0159] A third determining unit is configured to determine an error type of the interface when the inspection result shows that the interface development result is unqualified;
[0160] The prompt unit is used to generate prompt information according to the error type.
[0161] Optionally, the first determining unit 330 is specifically configured to:
[0162] Determining interface specifications belonging to the same development scenario based on the development scenario corresponding to each interface specification;
[0163] The interface specifications belonging to the same development scenario are combined to obtain the multiple groups of interface specification documents.
[0164] Optionally, the device further comprises a training unit, wherein the training unit is configured to:
[0165] Obtaining a sample training set, the sample training set including a plurality of sample interface specifications and a sample development scenario corresponding to each of the sample interface specifications;
[0166] Training an initial protocol evaluation network based on the sample training set, and updating parameters of the initial protocol evaluation network based on the training results;
[0167] When it is detected that the loss function corresponding to the initial reduction evaluation network converges, the reduction evaluation model is obtained.
[0168] See Figure 6 , Figure 6 FIG. 1 is a schematic diagram of a device for determining an interface protocol provided by another embodiment of the present application. Figure 6 As shown, the device 4 of this embodiment includes: a processor 40, a memory 41, and a computer program 42 stored in the memory 41 and executable on the processor 40. When the processor 40 executes the computer program 42, the steps in the above-mentioned method for determining the interface protocol are implemented, for example Figure 1 Alternatively, when the processor 40 executes the computer program 42, the functions of the units in the above embodiments are realized, for example, Figure 5 The functions of units 310 to 350 are shown.
[0169] Exemplarily, the computer program 42 may be divided into one or more units, which are stored in the memory 41 and executed by the processor 40 to implement the present application. The one or more units may be a series of computer instruction segments capable of performing specific functions, which describe the execution process of the computer program 42 in the device 4. For example, the computer program 42 may be divided into an acquisition unit, a processing unit, a first determination unit, a second determination unit, and a development unit, with the specific functions of each unit being as described above.
[0170] The device may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will understand that Figure 6 It is only an example of device 4 and does not constitute a limitation of the device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the device may also include input and output devices, network access devices, buses, etc.
[0171] The processor 40 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0172] The memory 41 may be an internal storage unit of the device, such as a hard disk or memory of the device. The memory 41 may also be an external storage terminal of the device, such as a plug-in hard disk equipped on the device, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. Furthermore, the memory 41 may include both an internal storage unit of the device and an external storage terminal. The memory 41 is used to store the computer instructions and other programs and data required by the terminal. The memory 41 may also be used to temporarily store data that has been output or is about to be output.
[0173] An embodiment of the present application further provides a computer storage medium, which may be non-volatile or volatile. The computer storage medium stores a computer program, which, when executed by a processor, implements the steps in the above-mentioned embodiments of the method for determining the interface protocol.
[0174] The present application also provides a computer program product. When the computer program product is run on a device, the device is caused to execute the steps in the above-mentioned embodiments of the method for determining the interface protocol.
[0175] An embodiment of the present application also provides a chip or integrated circuit, which includes: a processor for calling and running a computer program from a memory, so that a device equipped with the chip or integrated circuit executes the steps in the above-mentioned embodiments of the method for determining the interface protocol.
[0176] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0177] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0178] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software 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 beyond the scope of this application.
[0179] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit of the technical solutions of the embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A method for determining an interface specification, characterized in that: include: Collecting multiple interface specifications, including interface identification specifications, attribute specifications, mode specifications, security specifications, message specifications, and parameter specifications; The mode specification is used to agree on the interaction mode, the security specification is used to agree on the encryption method and decryption method, and the message specification is used to agree on the message format; Inputting the multiple interface specifications into a trained specification evaluation model for processing to obtain a development scenario corresponding to each interface specification; Among all the development scenarios corresponding to the interface specifications, determine the interface specifications that belong to the same development scenario; The interface specifications belonging to the same development scenario are combined to obtain multiple groups of interface specification documents; each group of interface specification documents includes the interface identification specification, attribute specification, security specification, message specification, parameter specification, request connection, and request type corresponding to the same development scenario; the same development scenario includes any one of the following scenarios: fund subscription scenario, fund redemption scenario, and insurance purchase scenario; When a development interface request is received, determining an actual development scenario corresponding to the development interface request; A target interface specification document matching the actual development scenario is determined from the multiple groups of interface specification documents.
2. The method according to claim 1, wherein Inputting the multiple interface specifications into the trained specification evaluation model for processing to obtain a development scenario corresponding to each interface specification includes: For each of the interface specifications, performing word segmentation processing on the interface specifications based on the specification evaluation model to obtain multiple word segments; Determining keywords corresponding to the interface specification from the multiple participles; The keywords are classified and processed by the specification evaluation model to obtain the development scenario corresponding to the interface specification.
3. The method according to claim 1, wherein The target interface specification document is used by developers to develop interfaces according to the target interface specification document. After determining the target interface specification document matching the actual development scenario from the multiple groups of interface specification documents, the method further includes: Get interface development results; Parsing the target interface specification document to obtain a parsing result; Verifying the interface development result according to the analysis result; When the inspection result shows that the interface development result is qualified, the interface is released.
4. The method according to claim 3, wherein After verifying the interface development result according to the analysis result, the method further includes: When the inspection result shows that the interface development result is unqualified, the target interface specification document is modified, and the modified target interface specification document is used by the developer to redevelop the interface.
5. The method according to claim 3, wherein After verifying the interface development result according to the analysis result, the method further includes: When the inspection result shows that the interface development result is unqualified, determining the error type of the interface; Generate prompt information according to the error type.
6. The method according to claim 1, wherein Before inputting the multiple interface specifications into the trained specification evaluation model for processing to obtain a development scenario corresponding to each interface specification, the method further includes: Obtaining a sample training set, the sample training set including a plurality of sample interface specifications and a sample development scenario corresponding to each of the sample interface specifications; Training an initial protocol evaluation network based on the sample training set, and updating parameters of the initial protocol evaluation network based on the training results; When it is detected that the loss function corresponding to the initial reduction evaluation network converges, the reduction evaluation model is obtained.
7. A device for determining an interface protocol, characterized in that: include: A collection unit, configured to collect multiple interface specifications, including interface identification specifications, attribute specifications, mode specifications, security specifications, message specifications, and parameter specifications; the mode specifications are used to specify an interaction mode, the security specifications are used to specify an encryption method and a decryption method, and the message specifications are used to specify a message format; A processing unit, configured to input the plurality of interface specifications into a trained specification evaluation model for processing, and obtain a development scenario corresponding to each of the interface specifications; A first determining unit is configured to determine, among the development scenarios corresponding to all the interface specifications, interface specifications belonging to the same development scenario; The interface specifications belonging to the same development scenario are combined to obtain multiple groups of interface specification documents; each group of interface specification documents includes the interface identification specification, attribute specification, security specification, message specification, parameter specification, request connection, and request type corresponding to the same development scenario; the same development scenario includes any one of the following scenarios: fund subscription scenario, fund redemption scenario, and insurance purchase scenario; A second determining unit is configured to, when receiving a development interface request, determine an actual development scenario corresponding to the development interface request; The development unit is configured to determine a target interface specification document that matches the actual development scenario from among the multiple groups of interface specification documents.
8. A device for determining an interface protocol, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Test document generation method and device, electronic equipment and storage medium
CN110209575A
Interface testing method and device, equipment and storage medium
CN113312258A