Automatic interface generation method and device, computer equipment and storage medium
By analyzing interface requirements, selecting templates, and conducting automated testing, interface code is generated and optimized, solving the problems of low automation and low accuracy in existing interface generation methods, and achieving efficient and accurate interface code generation and management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-25
- Publication Date
- 2026-04-14
AI Technical Summary
Existing methods for generating APIs suffer from low automation, inefficiency, low accuracy, difficulty in cross-language and cross-framework implementation, lack of automated testing and verification, and strong data dependency, which limit the efficiency and quality of API generation.
By receiving interface requirements, analyzing and outputting structured interface elements, selecting matching basic structure templates and business scenario templates, generating initial interface code, automatically creating test suites, executing multi-level tests, optimizing interface code, and finally deploying it to the development or testing environment.
It improves the efficiency and quality of interface code development, reduces manual coding workload, lowers the error rate, enhances the flexibility and adaptability of the interface, supports multiple languages and frameworks, and ensures the correctness and stability of the interface.
Smart Images

Figure CN121858087A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and more specifically, to an automated interface generation method, apparatus, computer device, and storage medium. Background Technology
[0002] With the increasing complexity of software development and the significant advancement of microservice architecture, interface design and implementation have become a demanding and error-prone task. Traditional interface development methods require developers to manually write a large amount of interface code and perform tedious testing and maintenance.
[0003] The interface generation methods for related technologies include: (1) AI-based code generation tools: GitHub Copilot: Developed jointly by OpenAI and GitHub, it is an AI-driven code generator. It learns from user input and a large number of open source code repositories to generate relevant code snippets. However, it does not directly provide complete functions for interface generation, such as interface recommendation, automated testing, or optimization suggestions. Codota: An AI-driven code auto-completion tool designed to help developers write code faster. It uses machine learning technology to learn from a large amount of code and provides code suggestions based on the developer's code input. However, it also focuses mainly on code completion and does not involve complete interface generation and testing. DeepCode: An AI-driven code review tool that can automatically discover potential errors and security vulnerabilities during the code writing process. It focuses more on code review and optimization and does not directly provide interface generation functions. Kite: An AI-driven programming assistant that provides code suggestions and auto-completion based on user input. While it helps improve programming efficiency, it also focuses mainly on code hints and does not involve the complete interface generation process.
[0004] (2) Modular Framework-Based Code Generation System: In some industries, such as the rubber machinery industry, the interface between equipment and MES (Manufacturing Execution System) often requires manual writing of interface code, which is both time-consuming and error-prone. To improve this process, existing technologies have begun to explore code generation methods based on modular frameworks. These methods define standard interface modules and use AI technology to parse user requirements, automatically generating interface code that meets those requirements. However, these systems may not yet fully realize the automated generation, testing, and optimization of interfaces.
[0005] (3) Technologies combining automated testing and API generation: Some technologies or platforms are dedicated to combining automated testing with API generation, using AI technology to improve the efficiency of test data generation and test coverage. For example, machine learning algorithms are used to construct test data from raw data, and test data generation is optimized through pre-execution and coverage feedback adjustments. Although these technologies focus on automated testing, their underlying principles and methods are closely related to API generation, providing important technical support for the automation of API generation.
[0006] However, the above methods of generating interfaces have technical defects such as low automation, low efficiency, low accuracy, difficulty in cross-language and cross-framework operation, lack of automated testing and verification, and strong data dependency. These limitations restrict the efficiency and quality of interface generation and limit the application of interfaces in complex scenarios. Summary of the Invention
[0007] This application provides an automated interface generation method, apparatus, computer device, and storage medium.
[0008] The first aspect of this application provides an automated interface generation method, including: Receive input interface requirements, analyze the interface requirements, and output structured interface elements; Select the basic structure template and business scenario template that match the interface requirements from the preset template library; Initial interface code is generated based on structured interface elements, basic structure templates, and business scenario templates; Test suites are automatically created based on the generated initial interface code, multi-level tests from unit to integration are executed, the initial interface code is optimized based on the test results, and the optimized interface code is deployed to the development or testing environment.
[0009] In an optional embodiment of this application, the step of analyzing interface requirements and outputting structured interface elements includes: Based on the interface description data in the interface requirements, identify the interface name, parameters, request method, and return type as key information of the interface; Construct an interface parsing model, and train the interface parsing model by taking the interface description data, business logic and interaction mode as input and output respectively, so that the trained interface parsing model can determine the business logic and interaction mode corresponding to the interface based on the interface description data. Based on the preset business rule engine, structured interface elements are generated according to the key information of the interface, the corresponding business logic, and the interaction mode of the interface.
[0010] In an optional embodiment of this application, the infrastructure template defines the basic framework and common elements of the interface, wherein the common elements include at least one of interface name, parameter list, request method and return type; the business scenario template includes business logic and interaction mode under a specific business scenario.
[0011] In an optional embodiment of this application, the step of selecting the infrastructure template and business scenario template that match the interface requirements from the preset template library includes: Determine the basic structure template based on the method definitions in the interface description data of the interface requirements; Determine the business scenario template based on the business semantics in the interface description data in the interface requirements.
[0012] In an optional embodiment of this application, the step of generating initial interface code based on structured interface elements, basic structure templates, and business scenario templates includes: The methods, paths, and general rules in the structured interface elements are used as general elements to populate the basic framework of the basic structure template; Generate business logic for specific business scenarios from the username and password in the structured interface elements, and embed the corresponding interaction mode of the business logic.
[0013] In an optional embodiment of this application, the automatic creation of a test suite based on the generated initial interface code, and the execution of multi-level tests from unit to integration, includes: Integrated automated testing tools are used to perform functional, performance, and security testing on the generated initial interface code; Test cases are automatically generated based on the interface description data required by the interface. Supports joint testing between interfaces to ensure accurate data transmission and logical processing between interfaces; Based on test cases, testing tools, and joint debugging between interfaces, functional testing, performance testing, and security testing are performed on the generated initial interface code.
[0014] In an optional embodiment of this application, the method further includes: Deploy API monitoring tools to collect API usage and performance data in real time, and automatically adjust API design or code implementation based on the API usage and performance data.
[0015] A second aspect of this application provides an automated interface generation apparatus, comprising: The analysis module receives input interface requirements, analyzes them, and outputs structured interface elements. The selection module is used to choose the infrastructure template and business scenario template that match the interface requirements from the preset template library; The generation module is used to generate initial interface code based on structured interface elements, basic structure templates, and business scenario templates. The optimization module is used to automatically create test suites based on the generated initial interface code, execute multi-level tests from unit to integration, optimize the initial interface code based on the test results, and deploy the optimized interface code to the development or testing environment.
[0016] A third aspect of this application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the above-mentioned automated interface generation methods.
[0017] A fourth aspect of the embodiments of this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the automated interface generation method as described above.
[0018] Compared with the prior art, the technical solutions provided in this application have at least some or all of the following advantages: The automated interface generation method described in this application receives input interface requirements, analyzes the requirements, and outputs structured interface elements; selects a basic structure template and a business scenario template that match the interface requirements from a preset template library; generates initial interface code based on the structured interface elements, the basic structure template, and the business scenario template; automatically creates a test suite based on the generated initial interface code, executes multi-level tests from unit to integration, optimizes the initial interface code based on the test results, and deploys the optimized interface code to a development environment or a test environment, thereby improving the efficiency and quality of interface code development. Attached Figure Description
[0019] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A flowchart illustrating an automated interface generation method provided in one embodiment of this application; Figure 2 This is a schematic diagram of the structure of an automated interface generation device provided in one embodiment of this application; Figure 3 This is a schematic diagram of a computer device structure provided in one embodiment of this application. Detailed Implementation
[0020] To make the technical solutions and advantages of the embodiments of this application clearer, the exemplary embodiments of this application will be described in further detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not an exhaustive list of all embodiments. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.
[0021] Please see Figure 1 The automated interface generation method provided in this application includes the following steps S100~S400: S100 receives input interface requirements, analyzes the interface requirements, and outputs structured interface elements. S200: Select the basic structure template and business scenario template that match the interface requirements from the preset template library; S300 generates initial interface code based on structured interface elements, basic structure templates, and business scenario templates; S400 automatically creates test suites based on the generated initial interface code, executes multi-level tests from unit to integration, optimizes the initial interface code based on the test results, and deploys the optimized interface code to the development or testing environment.
[0022] In an optional embodiment of this application, in step S100, the interface type includes RESTful interface, GraphQL interface, message queue interface, database access interface, and third-party service integration interface, etc.
[0023] In one optional embodiment of this application, the correspondence between the interface generation model and the interface type can take two forms. One is a single general-purpose model where a deep learning model supports multiple interface types, distinguished by input interface type labels (e.g., "RESTful" or "GraphQL"). Internally, the model adapts to the business rules of different interfaces through dynamic routing or attention mechanisms. The other is a multi-model joint architecture where each interface type corresponds to a dedicated sub-model (e.g., a RESTful model or a GraphQL model). The main model calls the corresponding sub-model to generate code based on the input interface type. In practical applications, the appropriate correspondence needs to be selected based on specific requirements and project scale. For small projects or cases with a relatively simple interface type, a method of one interface generation model corresponding to multiple interface types can be used; while for large projects or cases with complex interface types, a method of one interface generation model corresponding to one interface type is required.
[0024] The automated interface generation method of this application optimizes the model structure by adjusting and optimizing the architecture of the original model, such as increasing the number of network layers, adjusting the inter-layer connection methods, and introducing residual connections. These optimizations improve the model's expressive and learning capabilities, thus better adapting to the needs of interface generation tasks. It also improves the training algorithm by adopting more efficient optimization algorithms, introducing regularization techniques to prevent overfitting, and using dynamic learning rate adjustment strategies. These improvements enhance the model's training efficiency and generalization performance, thereby improving the accuracy and stability of interface generation. Finally, it improves feature extraction and representation learning by employing more advanced natural language processing techniques to extract text features and graph neural networks to process structured data. These improvements enhance the model's understanding of interface requirements, resulting in more compliant interface documentation and code.
[0025] In an optional embodiment of this application, step S100, which involves analyzing the interface requirements and outputting structured interface elements, includes: Based on the interface description data in the interface requirements, identify the interface name, parameters, request method, and return type as key information of the interface; Construct an interface parsing model, and train the interface parsing model by taking the interface description data, business logic and interaction mode as input and output respectively, so that the trained interface parsing model can determine the business logic and interaction mode corresponding to the interface based on the interface description data. Based on the preset business rule engine, structured interface elements are generated according to the key information of the interface, the corresponding business logic, and the interaction mode of the interface.
[0026] In an optional embodiment of this application, by constructing a large-scale corpus and training a deep learning model, interface description data in different contexts is identified and understood, thereby generating accurate and standardized interface documents and code. Utilizing advanced natural language processing and deep learning technologies, intelligent parsing and adaptive understanding of interface requirement descriptions are achieved. Compared to traditional methods, this approach not only accurately extracts key interface information (such as interface name, parameters, request methods, etc.) but also deeply understands complex business logic and interaction scenarios, providing precise input for interface generation.
[0027] In one optional embodiment of this application, natural language processing technology is used to parse the interface description document or natural language requirements to identify key information such as interface name, parameters, request method, and return type. A deep learning model is constructed: a deep learning-based parsing model is built, and by training a large amount of interface description data, the model's ability to understand complex business logic and interaction scenarios is improved. A business rule engine is integrated to further process and verify the parsing results according to business requirements, ensuring that the generated interface conforms to business specifications.
[0028] The automated interface generation method of this application achieves high-precision parsing and complex scenario understanding. High-precision parsing: By combining natural language processing technology and deep learning technology, it achieves high-precision parsing of interface descriptions, reducing manual intervention and error rate. Complex scenario understanding: It has the ability to understand complex business logic and interaction scenarios, providing accurate input for interface generation.
[0029] In an optional embodiment of this application, in step S200, the infrastructure template defines the basic framework and common elements of the interface, wherein the common elements include at least one of interface name, parameter list, request method and return type; the business scenario template includes business logic and interaction mode under a specific business scenario.
[0030] In an optional embodiment of this application, step S200, which involves selecting a basic infrastructure template and a business scenario template from a preset template library that match the interface requirements, includes: Determine the basic structure template based on the method definitions in the interface description data of the interface requirements; Determine the business scenario template based on the business semantics in the interface description data in the interface requirements.
[0031] In an optional embodiment of this application, a flexible and configurable template library is designed. This library not only includes basic interface structure templates but also covers various common business scenario and interaction mode templates. Users can select appropriate templates according to project requirements and generate compliant interface documentation and code through simple configuration. Based on the interface information extracted by the intelligent analysis module, suitable templates are automatically matched and the corresponding data is populated to generate compliant interface documentation and code. Simultaneously, custom templates and extended template libraries are supported to meet the specific needs of different projects. Basic structure templates: These define the basic framework and common elements of the interface, such as interface name, parameter list, request method, and return type. These templates ensure that the basic structure of the interface code and documentation conforms to industry standards and project specifications, improving the consistency and readability of the interface. Business scenario templates: These are templates designed for specific business scenarios (such as user registration, order payment, data query, etc.) and include the unique business logic and interaction modes of that scenario. Using these templates can solve the complexity of business logic, directly generate interface code that meets business requirements, and reduce the need for developers to manually implement business rules.
[0032] In an optional embodiment of this application, interface description data and business rule data are associated with the template in the following ways: (1) Interface description data (such as interface name, parameters, request method): Basic structure template: fills in the general structure according to the interface description data. Example: If the interface description defines method: POST and path: / users, the basic template will automatically generate the corresponding HTTP POST method and routing path code. Business scenario template: matches the scenario template with the business semantics in the interface description (such as "user registration"). Example: If the interface description contains the keyword "user registration", the system selects the business scenario template and generates password encryption logic based on the parameters (such as username, password). (2) Business rule data (such as input validation, data conversion rules): Basic structure template: integrates general rules (such as parameter type validation, non-empty validation). Example: automatically generates type validation code (if not isinstance(age, int): raiseValueError) based on the parameter age: int. Business scenario template: embeds specific business rules (such as password complexity requirements, payment status flow). Example: If the business rules require the password to be ≥8 characters long and contain special characters, the business scenario template will generate the corresponding regular expression validation logic.
[0033] In an optional embodiment of this application, the user registration interface generation process is exemplified as follows: (1) Input data: Interface description data: {"name": "User Registration", "method": "POST", "params": ["username", "password", "email"]} Business rule data: {"Password complexity": "Length ≥ 8 and contains special characters", "Email verification": "Send confirmation email"} (2) Template matching: Infrastructure Template: Select the RESTful POST interface template to generate the POST / register route and parameter parsing code.
[0034] Business scenario template: Match the "user registration" scenario template to generate password encryption (such as BCrypt) and email verification logic.
[0035] (3) Data filling: The basic template is populated with method and path to generate framework code; The business template populates the password verification logic (regular expression) and email service call code based on the rule data.
[0036] In an optional embodiment of this application, the step of selecting the infrastructure template and business scenario template that match the interface requirements from the preset template library includes: (1) Flexible template configuration: The template library is designed to be flexible and configurable, including interface templates for various programming languages and frameworks, and supports user-defined templates and extension of the template library.
[0037] (2) Template parameterization: Parameterize the key information in the interface template (such as interface name, parameter type, etc.) and fill the template parameters with the interface information extracted by the intelligent analysis and understanding module.
[0038] (3) Template optimization: Based on user feedback and generation results, we continuously optimize the template library to improve the reusability and accuracy of templates.
[0039] The automated interface generation method of this application has high flexibility and high efficiency. High flexibility: it supports the generation of interfaces for multiple programming languages and frameworks to meet the needs of different projects; high efficiency: through template parameterization and optimization, it improves the reusability and generation efficiency of templates.
[0040] In an optional embodiment of this application, step S300, generating initial interface code based on structured interface elements, basic structure templates, and business scenario templates, includes: The methods, paths, and general rules in the structured interface elements are used as general elements to populate the basic framework of the basic structure template; Generate business logic for specific business scenarios from the username and password in the structured interface elements, and embed the corresponding interaction mode of the business logic.
[0041] In an optional embodiment of this application, the code automatic generation module is the key execution part of the engine, responsible for converting the interface template into specific code implementation. This module supports multiple programming languages and frameworks and can automatically generate front-end calling code, back-end processing logic code, and database interaction code, etc. (1) Code generation engine: Based on the template library and the output of the intelligent analysis and understanding module, it automatically generates interface code that conforms to the specifications. (2) Code formatting: The generated code is formatted to ensure consistent code style and improve code readability. (3) Dependency management: The dependencies in the interface code are automatically handled to ensure the correctness and maintainability of the code.
[0042] The automated interface generation method of this application supports multiple languages: it supports a variety of mainstream programming languages and frameworks to meet the needs of different development teams; code optimization algorithm: it adopts an advanced code optimization algorithm to simplify and optimize the generated code, thereby improving the readability and execution efficiency of the code.
[0043] In an optional embodiment of this application, step S400, which involves automatically creating a test suite based on the generated initial interface code and executing multi-level tests from unit to integration, includes: Integrated automated testing tools are used to perform functional, performance, and security testing on the generated initial interface code; Test cases are automatically generated based on the interface description data required by the interface. Supports joint testing between interfaces to ensure accurate data transmission and logical processing between interfaces; Based on test cases, testing tools, and joint debugging between interfaces, functional testing, performance testing, and security testing are performed on the generated initial interface code.
[0044] In an optional embodiment of this application, a test case library is constructed, test cases are automatically generated based on the interface information, and tests are executed. An integrated automated testing and verification mechanism is used to perform comprehensive testing on the generated interface to ensure the correctness and stability of the interface. This includes functional testing, performance testing, security testing, etc. of the interface. The test results will be fed back to the user in real time so that the user can discover problems and fix them in time. At the same time, continuous integration and continuous deployment (CI / CD) are supported to realize the automated release and update of the interface. (1) Automated testing tools: Integrated automated testing tools are used to perform functional testing, performance testing, security testing, etc. on the generated interface. (2) Test case generation: Test cases are automatically generated based on the interface description to ensure the comprehensiveness and accuracy of the test. (3) Test result feedback: The test results are fed back to the user in real time to help the user discover problems and fix them in time.
[0045] The automated interface generation method of this application includes: intelligent test case generation: automatically generating test cases based on interface documents and template information, covering various possible scenarios of the interface; continuous integration and deployment: integrating with continuous integration (CI) and continuous deployment (CD) tools to achieve automated testing and rapid deployment of the interface; and test data generation: supporting the automatic generation of test data to simulate interface calls in real-world scenarios, improving the comprehensiveness and effectiveness of testing.
[0046] In an optional embodiment of this application, the method further includes: Deploy API monitoring tools to collect API usage and performance data in real time, and automatically adjust API design or code implementation based on the API usage and performance data.
[0047] In an optional embodiment of this application, a specific example of the automated interface generation method of this application includes the following steps: 1. Intelligent Requirements Analysis: The system intelligently parses and understands interface requirement descriptions using Natural Language Processing (NLP) and deep learning models. It can identify key information such as interface name, parameters, request method, and return type, and understand complex business logic and interaction scenarios.
[0048] 2. Model Training: An interface generation model is built by training a large number of interface samples using machine learning algorithms. A deep learning model is then trained using a large amount of interface description data and business rule data. Through continuous iteration and optimization, the model's ability to accurately parse interface requirements and deeply understand business logic is improved.
[0049] 3. Template matching: Utilizing Natural Language Processing (NLP) and Machine Learning (ML) techniques, requirements are analyzed to extract key information, and suitable interface templates are selected or generated from a template library. The template library contains interface templates for various programming languages and frameworks, supporting user customization and extension. Key information includes basic interface information (such as interface name, interface type, and request method), interface functional information (such as input / output parameters, function description, and request examples), business attribute information (such as business scenario classification, parameter validation rules, business logic flow, and access control rules), technical implementation information (such as programming language and framework, and data format), and other information (input / output interface version, interface status, and interface documentation links).
[0050] 4. Code generation: Based on the selected template and interface requirements, the system automatically generates compliant interface code using code generation technology (such as a template engine). The generated code is then formatted to ensure consistent code style and improve readability and maintainability. It also supports multiple programming languages and frameworks to meet diverse development needs.
[0051] 5. Interface testing: This integrated API testing framework utilizes AI algorithms to automatically generate test cases and perform API testing. It supports multiple testing methods, including unit testing and integration testing, to ensure API quality.
[0052] 6. Joint debugging and deployment: It supports joint testing between interfaces to ensure correct data transmission and logical processing. After the test passes, the interface is automatically deployed to the production environment.
[0053] 7. Monitoring and Optimization: Deploy API monitoring tools to collect API usage and performance data in real time. Utilize AI technology for intelligent analysis to identify potential performance bottlenecks and optimization points, and automatically adjust API design or code implementation.
[0054] In one optional embodiment of this application, the interface requirement for receiving input is implemented based on an efficient converged access method for heterogeneous networks.
[0055] In an optional embodiment of this application, the efficient converged access method for heterogeneous networks includes the following steps: Step 1: The smart gateway acquires network characteristic information of several heterogeneous networks, including network type identifier, protocol stack information, and access capability parameters; Step 2: Construct a heterogeneous network fusion model based on the network feature information. The heterogeneous network fusion model includes a protocol conversion rule set and an access priority strategy. Step 3: When an access request from a terminal device is received, the service requirement characteristics in the access request are parsed. The service requirement characteristics include service type, service quality requirements, and security level requirements. Step 4: Based on the business requirement characteristics and the heterogeneous network fusion model, determine whether there is a target network that meets the business requirement characteristics: if there is a target network that meets the conditions, proceed to Step 5; if there is no target network that meets the conditions, proceed to Step 6. Step 5: When a target network that meets the conditions exists, further determine the number of target networks: if the target network is a single network, then directly establish a converged access channel between the terminal device and the single network; if the target network is several networks, then select the appropriate network according to the access priority policy and establish the corresponding converged access channel. Step 6: When no target network meets the conditions, a virtual converged network is formed by combining the resources of several heterogeneous networks, so that the virtual converged network meets the service requirements, and a converged access channel based on the virtual converged network is established. Step 7: After the converged access channel is established, continuously monitor the operating status of the converged access channel. When a change in network status is detected, dynamically adjust the configuration parameters of the converged access channel.
[0056] The collection of network feature information includes the following steps: Step 11: The smart gateway obtains network type identifiers of several heterogeneous networks in the current environment; the process of obtaining the network type identifiers is implemented through the multi-mode communication interface of the smart gateway; the smart gateway is configured with several communication modules, each communication module periodically scans the network signals in its operating frequency band, and when a network is detected, it extracts the identification information of the network broadcast as the network type identifier; Step 12: The smart gateway parses the protocol stack information of each heterogeneous network; the parsing of the protocol stack information is completed by the protocol analysis module; the protocol analysis module establishes a test connection and captures interactive messages for each identified network; Step 13: The smart gateway measures and records the access capability parameters of each heterogeneous network; The construction of the heterogeneous network fusion model includes the following steps: Step 21: Construct a protocol conversion rule set based on the protocol stack information in the network feature information; the construction process of the protocol conversion rule set analyzes the differences and mapping relationships between different network protocol stacks; Step 22: Based on the access capability parameters and network type identifier in the network feature information, formulate an access priority policy; the formulation of the access priority policy is based on network performance and network characteristics; Step 23: Integrate the protocol conversion rule set and the access priority policy to construct a heterogeneous network fusion model; the heterogeneous network fusion model adopts a layered architecture design, deploying the protocol conversion rule set in the protocol adaptation layer and the access priority policy in the decision control layer.
[0057] The process of parsing the business requirement features in the access request includes the following steps: Step 31: Extract service type information from the access request of the terminal device; the extraction of service type information is achieved through deep packet inspection technology; Step 32: Derive the service quality requirements based on the service type; the derivation of the service quality requirements is based on a knowledge base mapping service type and QoS requirements. Step 33: Determine the security level requirements based on the business type; the determination of the security level requirements is based on the sensitivity and compliance requirements of the business data.
[0058] Determining whether a target network exists that meets the characteristics of the business requirements includes the following steps: Step 41: Perform a matching analysis between the business requirement features and the heterogeneous network fusion model; the matching analysis process extracts the various indicator requirements from the business requirement features and compares them with the network capability parameters recorded in the fusion model; Step 42: Evaluate the degree to which each heterogeneous network meets the characteristics of the service requirements; the evaluation process provides a quantitative score for the satisfaction of technically feasible heterogeneous networks. Step 43: Count the number of target networks that meet the business requirements and select the execution branch.
[0059] The method for establishing converged access between the terminal device and the single network is to configure protocol conversion parameters for the single network. The method for selecting the appropriate network according to the access priority policy is as follows: The access priority strategy is applied to calculate the priority score of each network, and the network with the highest score is selected as the adapted access network. The method for establishing the converged access channel is as follows: The establishment of the converged access channel comprises three phases: First, the connection establishment phase, where the smart gateway establishes connections with both the terminal device and the adapted access network or a single network, completing authentication and key negotiation; second, the channel configuration phase, where, based on the determined adapted access network or single network, the corresponding protocol conversion parameters are loaded, the data forwarding path is configured, and a session state table is established; finally, the channel activation phase, where end-to-end connectivity testing is performed, and after confirming that data can be forwarded correctly, an access success response is sent to the terminal device, activating the converged access channel. After the channel is established, the terminal device accesses heterogeneous network resources of the adapted access network or single network through the smart gateway.
[0060] The process of forming a virtual converged network, enabling the virtual converged network to meet the service requirements, and establishing a converged access channel based on the virtual converged network includes the following steps: Step 61: Analyze the gap between each indicator in the service requirement characteristics and the existing network capabilities; the analysis process of the gap between each indicator and the existing network capabilities compares the requirements of each indicator of the service requirement with the corresponding capability parameters of all available heterogeneous networks. Step 62: Design a multi-network collaborative scheme, which constructs a virtual converged network by combining several heterogeneous network resources; the design of the multi-network collaborative scheme is based on the principle of resource complementarity and network combination optimization; Step 63: Implement the access configuration of the virtual converged network and establish a converged access channel based on multiple networks; the access configuration process first creates a virtual network interface on the smart gateway as the unified access point of the virtual converged network; then establishes connections with each heterogeneous network participating in the virtual converged network and allocates an independent data channel for each connection.
[0061] The dynamic adjustment of the configuration parameters of the converged access channel includes the following steps: Step 71: Deploy a monitoring unit on the converged access channel to continuously collect operational status data; the monitoring unit is implemented by embedding monitoring probes on the data forwarding path; Step 72: Analyze the operational status data to detect changes in network status and performance anomalies; the analysis process employs a combination of baseline comparison and trend prediction. Step 73: Execute the corresponding dynamic adjustment strategy according to the type of detected state change or performance anomaly; the dynamic adjustment strategy adopts preset targeted measures according to different types of state change.
[0062] This invention's automated interface generation method effectively addresses the limitations of traditional static configuration methods in terms of flexibility, intelligence, and real-time performance of data service interfaces by combining configuration management and service instance management. It achieves dynamic management of the entire lifecycle of data service interfaces, improving the system's adaptability and operational efficiency. Intelligent interface requirement analysis: Utilizing advanced Natural Language Processing (NLP) and deep learning technologies, it achieves intelligent parsing and adaptive understanding of interface requirement descriptions. This innovation not only improves the accuracy of interface requirement parsing but also significantly reduces manual intervention and error rates. The system can deeply understand complex business logic and interaction scenarios, providing accurate input for interface generation. Flexible and configurable template library: A highly flexible and configurable template library is designed, containing interface templates for various programming languages and frameworks, and supporting user customization and extension. This design not only improves the flexibility and scalability of interface generation but also allows different projects to choose appropriate templates according to their own needs, thereby accelerating the development process. Automated code generation: Based on intelligently parsed requirements and templates in the template library, it automatically generates interface code that conforms to specifications. This process greatly improves development efficiency and reduces the workload and error rate of manual coding. At the same time, the system will also format the generated code to ensure consistent code style and improve code readability and maintainability.
[0063] The automated interface generation method of this invention significantly improves development efficiency: During interface development, developers need to manually write a large amount of interface code, which is both time-consuming and error-prone. The AI-powered automated interface generation engine can drastically reduce the amount of manually written code, increasing the automation rate of interface generation. Automated interface generation reduces developers' manual coding work, allowing them to focus more on implementing business logic, thereby improving overall development efficiency. It also reduces the error rate: The AI engine, through intelligent analysis and optimization, reduces errors caused by human coding, improving code quality and stability. Furthermore, it enhances customization: Traditional interface generation tools often only generate standardized interface templates, making it difficult to meet the personalized needs of specific projects. The AI-powered automated interface generation engine, by providing rich configuration options and parameterization support, enables the generated interfaces to better adapt to the needs of different projects, improving the adaptability and customizability of the interfaces. The AI engine has self-learning and evolution capabilities, continuously optimizing the generation strategy as the project progresses and data accumulates, improving the customization level of the interfaces. Finally, it simplifies interface management: While generating interfaces, it automatically generates detailed interface documentation, including interface descriptions, parameter specifications, request examples, etc., facilitating the use and testing of interfaces by developers and testers. By automatically generating detailed interface documentation and implementing version control, the management and maintenance of interfaces become more convenient and efficient.
[0064] It should be understood that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order constraint on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the diagram may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0065] Please see Figure 2 One embodiment of this application provides an automated interface generation apparatus 600, comprising: Analysis module 210 is used to receive input interface requirements, analyze the interface requirements, and output structured interface elements. Select module 220, which is used to select the infrastructure template and business scenario template that match the interface requirements from the preset template library; The generation module 230 is used to generate initial interface code based on structured interface elements, basic structure templates, and business scenario templates. The optimization module 240 is used to automatically create test suites based on the generated initial interface code, execute multi-level tests from unit to integration, optimize the initial interface code based on the test results, and deploy the optimized interface code to the development environment or test environment.
[0066] This application's automated interface generation device, by introducing AI technology, solves the technical shortcomings of existing interface generation methods, such as low automation, low efficiency, low accuracy, difficulty in cross-language and cross-framework development, lack of automated testing and verification, and strong data dependence. This invention can automatically analyze interface requirements, generate interface documentation and code, and supports multiple programming languages and frameworks. Through AI's intelligent processing, the workload of manually writing interfaces is reduced, improving development efficiency and interface quality.
[0067] This application's automated interface generation device uses artificial intelligence technology to automatically generate compliant, maintainable, and extensible interface code, reducing development costs and improving development efficiency. Improved development efficiency: By introducing AI technology, automated interface generation is achieved. The AI engine can automatically parse interface descriptions, generate code and documentation, significantly reducing manual writing workload and improving development efficiency. Support for multiple languages and frameworks: Interface generation is supported for multiple programming languages and frameworks through plugins or extension mechanisms. This allows developers to choose appropriate languages and frameworks according to project needs, improving interface flexibility and scalability. Enhanced accuracy: The AI engine can generate interface code and documentation based on predefined templates and rules, ensuring that the generated interfaces conform to specifications in terms of naming, comments, and parameter types. Simultaneously, automated testing and verification mechanisms ensure the correctness and stability of the interfaces. Resolving data dependency issues: Interface generation may require reliance on large amounts of external data or specifications. This invention, through built-in data parsing and processing capabilities, automatically extracts the necessary information from various data sources, reducing problems caused by data dependencies. Provides intelligent support: The introduction of AI technology provides intelligent analysis and optimization capabilities for interface generation. A thorough understanding and analysis of interface requirements enables the generation of interface code and documentation that better align with business logic, thereby improving the usability and maintainability of the interfaces.
[0068] Specific limitations regarding the aforementioned device 200 can be found in the above description of the limitations on the automated interface generation method, and will not be repeated here. Each module in the aforementioned device 200 can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in a computer device, or stored in software in the memory of a computer device, so that the processor can call and execute the operations corresponding to each module.
[0069] In one embodiment, a computer device is provided, the internal structure of which can be as follows: Figure 3 As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements the above-described automated interface generation method. This includes: a memory and a processor; the memory stores a computer program; and the processor executes the computer program to implement any step in the above-described automated interface generation method.
[0070] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, can perform any of the steps in the above-described automated interface generation method.
[0071] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0072] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0073] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0074] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0075] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0076] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. An automated interface generation method, characterized in that, include: Receive input interface requirements, analyze the interface requirements, and output structured interface elements; Select the basic structure template and business scenario template that match the interface requirements from the preset template library; Initial interface code is generated based on structured interface elements, basic structure templates, and business scenario templates; Test suites are automatically created based on the generated initial interface code, multi-level tests from unit to integration are executed, the initial interface code is optimized based on the test results, and the optimized interface code is deployed to the development or testing environment.
2. The method according to claim 1, characterized in that, The analysis of interface requirements outputs structured interface elements, including: Identify the interface name, parameters, request method, and return type as key information of the interface based on the interface description data in the interface requirements; Construct an interface parsing model, and train the interface parsing model by taking the interface description data, business logic and interaction mode as input and output respectively, so that the trained interface parsing model can determine the business logic and interaction mode corresponding to the interface based on the interface description data. Based on the preset business rule engine, structured interface elements are generated according to the key information of the interface, the corresponding business logic, and the interaction mode of the interface.
3. The method according to claim 1, characterized in that, The infrastructure template defines the basic framework and common elements of the interface, wherein the common elements include at least one of the following: interface name, parameter list, request method, and return type; the business scenario template includes the business logic and interaction mode under a specific business scenario.
4. The method according to claim 1, characterized in that, The step of selecting infrastructure templates and business scenario templates that match the interface requirements from the preset template library includes: Determine the basic structure template based on the method definitions in the interface description data of the interface requirements; Determine the business scenario template based on the business semantics in the interface description data in the interface requirements.
5. The method according to claim 1, characterized in that, The process of generating initial interface code based on structured interface elements, basic structure templates, and business scenario templates includes: The methods, paths, and general rules in the structured interface elements are used as general elements to populate the basic framework of the basic structure template; Generate business logic for specific business scenarios from the username and password in the structured interface elements, and embed the corresponding interaction mode of the business logic.
6. The method according to claim 1, characterized in that, The automatic creation of test suites based on the generated initial interface code executes multi-level tests from unit to integration, including: Integrated automated testing tools are used to perform functional, performance, and security testing on the generated initial interface code; Test cases are automatically generated based on the interface description data required by the interface. Supports joint testing between interfaces to ensure accurate data transmission and logical processing between interfaces; Based on test cases, testing tools, and joint debugging between interfaces, functional testing, performance testing, and security testing are performed on the generated initial interface code.
7. The method according to claim 1, characterized in that, The method further includes: Deploy API monitoring tools to collect API usage and performance data in real time, and automatically adjust API design or code implementation based on the API usage and performance data.
8. An automated interface generation device, characterized in that, include: The analysis module receives input interface requirements, analyzes them, and outputs structured interface elements. The selection module is used to choose the infrastructure template and business scenario template that match the interface requirements from the preset template library; The generation module is used to generate initial interface code based on structured interface elements, basic structure templates, and business scenario templates. The optimization module is used to automatically create test suites based on the generated initial interface code, execute multi-level tests from unit to integration, optimize the initial interface code based on the test results, and deploy the optimized interface code to the development or testing environment.
9. A computer device, comprising: A memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the automated interface generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the automated interface generation method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Automatic code generation method and device based on service scene
CN112162744A
Automatic interface code generation method and system based on AI and modular framework
CN117111916A
System and method for automatically generating codes for data service of data-in-data platform and medium
CN120687087A