CN110738036A - Method and apparatus for generating information - Google Patents

Method and apparatus for generating information Download PDF

Info

Publication number
CN110738036A
CN110738036A CN201910978408.9A CN201910978408A CN110738036A CN 110738036 A CN110738036 A CN 110738036A CN 201910978408 A CN201910978408 A CN 201910978408A CN 110738036 A CN110738036 A CN 110738036A
Authority
CN
China
Prior art keywords
request
api
information
parameter
description information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910978408.9A
Other languages
Chinese (zh)
Inventor
陈佳熠
董灵芝
张全
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910978408.9A priority Critical patent/CN110738036A/en
Publication of CN110738036A publication Critical patent/CN110738036A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

Landscapes

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

Abstract

The specific implementation manner of of the method comprises the steps of receiving API information input by a user, wherein the API information comprises API basic description information and API request information, the API request information comprises a request body, analyzing the request body based on a language identification tool to obtain request parameter information, the language identification tool is used for analyzing the request body according to a preset analysis rule, determining analysis data aiming at the API information based on the API basic description information, the API request information and the request parameter information, and generating an API document according to the analysis data and a pre-established document content template.

Description

Method and apparatus for generating information
Technical Field
The embodiment of the disclosure relates to the technical field of computers, in particular to a method and a device for generating information.
Background
The gateway provides various functional support for an API (Application Programming Interface). Typically, an application encapsulates its own service capabilities into an API and opens calls to users through a gateway. When an API is opened through a gateway, an API document needs to be used. At present, the API document can be generated in a manual writing mode, and can also be automatically generated in a mode of predefining API document specifications. Manually compiling API documents is time consuming, labor intensive, and of varying quality. Although the API document generated by predefining the API document specification can ensure the standard and specification of the generated API document, the standard API document specification needs to be predefined, and the user needs to write specific API request information according to the API document specification, so that the whole generation process is complex.
Disclosure of Invention
The embodiment of the disclosure provides a method and a device for generating information.
, the disclosed embodiment provides methods for generating information, the method includes receiving API information input by a user, wherein the API information includes API basic description information and API request information, wherein the API request information includes a request body, parsing the request body based on a language identification tool to obtain request parameter information, wherein the language identification tool is used for parsing the request body according to a preset parsing rule, determining parsing data aiming at the API information based on the API basic description information, the API request information and the request parameter information, and generating an API document according to the parsing data and a pre-established document content template.
In , the request body includes JSON structure data and a comment, and the analyzing of the request body based on the language identification tool to obtain the request parameter information includes analyzing the JSON structure data and the comment by the language identification tool to obtain parameter characteristics and parameter description information, and taking the parameter characteristics and the parameter description information as the request parameter information obtained by analyzing.
In , the determining the parsed data of the API information based on the API basic description information, the API request information and the request parameter information includes checking the API basic description information, the request address, the request method and the request header, and determining the API basic description information, the request address, the request method, the request header and the request parameter information as the parsed data of the API information in response to determining that the API basic description information, the request address, the request method and the request header check pass.
In , the determining parsing data for the API information based on the API basic description information, the API request information, and the request parameter information further includes sending a prompt message to the user according to a check result in response to determining that at least of the API basic description information, the request address, the request method, and the request header failed to check.
In , the generating an API document based on the parsed data and a pre-established document content template includes generating an API document by filling the parsed data into the document content template using a template engine.
In a second aspect, the disclosed embodiment provides apparatuses for generating information, the apparatuses including a receiving unit configured to receive API information input by a user, wherein the API information includes API basic description information and API request information, wherein the API request information includes a request body, a parsing unit configured to parse the request body based on a language identification tool to obtain request parameter information, wherein the language identification tool is configured to parse the request body according to a preset parsing rule, a determining unit configured to determine parsing data for the API information based on the API basic description information, the API request information and the request parameter information, and a generating unit configured to generate an API document according to the parsing data and a pre-established document content template.
, the request body includes JSON structure data and comments, and the parsing unit is further configured to parse the JSON structure data and the comments by using the language identification tool to obtain parameter characteristics and parameter description information, and use the parameter characteristics and the parameter description information as the parsed request parameter information.
In , the API request information further includes a request address, a request method and a request header, and the determining unit is further configured to check the API basic description information, the request address, the request method and the request header, and to determine the API basic description information, the request address, the request method, the request header and the request parameter information as the resolution data for the API information in response to determining that the API basic description information, the request address, the request method and the request header check pass.
In , the determining unit is further configured to send a prompt to the user according to the verification result in response to determining that at least of the API basic description information, the request address, the request method, and the request header fail to verify.
In , the generating unit is further configured to generate an API document by using a template engine to populate the parsed data into the document content template.
In a third aspect, the disclosed embodiments provide apparatuses comprising or multiple processors, a storage device having or multiple programs stored thereon, wherein when the or multiple programs are executed by the or multiple processors, the or multiple processors implement the method as described in any implementation manner of the aspect.
In a fourth aspect, the disclosed embodiments provide computer readable media having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method as described in any of the implementations of aspect .
According to the method and the device for generating information, the API information input by a user is received, the request body is analyzed based on the language identification tool to obtain the request parameter information, the analysis data aiming at the API information is determined based on the API basic description information, the API request information and the request parameter information, and the API document is generated according to the analysis data and the pre-established document content template, so that the automatic generation of the API document is realized, and the generation efficiency of the API document is improved.
Drawings
Other features, objects and advantages of the disclosure will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram to which embodiments of the present disclosure may be applied;
FIG. 2 is a flow diagram of embodiments of a method for generating information according to the present disclosure;
FIG. 3 is a schematic diagram of application scenarios of a method for generating information according to the present disclosure;
FIG. 4 is a flow diagram of still another embodiments of a method for generating information according to the present disclosure;
FIG. 5 is a schematic block diagram of embodiments of an apparatus for generating information according to the present disclosure;
FIG. 6 is a schematic block diagram of a computer system suitable for use in implementing an electronic device of an embodiment of the present disclosure.
Detailed Description
The present disclosure will now be described in further detail in with reference to the drawings and examples, it being understood that the specific embodiments herein described are merely illustrative of and not restrictive on the broad invention, and it should be further noted that for purposes of illustration only those portions which are pertinent to the present invention are shown in the drawings.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary system architecture 100 of a method for generating information or an apparatus for generating information to which embodiments of the present disclosure may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have installed thereon various communication client applications, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, API document auto-generation software, and the like.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices having a display screen and supporting information input, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server providing various services, such as a background server providing support for information displayed on the terminal devices 101, 102, 103. The backend server may analyze and perform other processing on the received data such as the API information, and feed back a processing result (e.g., an API document) to the terminal devices 101, 102, and 103.
The server 105 may be hardware or software. When the server 105 is hardware, it may be implemented as a distributed server cluster composed of a plurality of servers, or may be implemented as a single server. When the server 105 is software, it may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
It should be noted that the method for generating information provided by the embodiment of the present disclosure may be executed by the terminal devices 101, 102, and 103, or may be executed by the server 105, and accordingly, the apparatus for generating information may be disposed in the terminal devices 101, 102, and 103, or may be disposed in the server 105.
With continued reference to FIG. 2, a flow 200 of embodiments of a method for generating information in accordance with the present disclosure is shown.
Step 201, receiving API information input by a user.
In the present embodiment, an execution subject of the method for generating information (e.g., the terminal device 101, 102, 103 or the server 105 shown in fig. 1) may receive API information input by a user. The API information may include API basic description information and API request information. Here, the API basic description information may be used to describe basic information of the API, and may include API function profile, version, person in charge, region information, and the like. The region information may be used to describe a deployment location of a server supporting a service corresponding to the API. The API request information may include a request address, a request method, a request header, a request body, and the like. Wherein the requestor may include invocation instances of the request parameters.
Generally, a user who is to generate an API document may input API information to an executing body by filling out a form on a page.
Step 202, analyzing the request body based on the language identification tool to obtain request parameter information.
In this embodiment, the execution body may parse the request body based on the language identification tool, so as to obtain the request parameter information. The language identification tool can be used for analyzing the request body according to a preset analysis rule. As an example, the Language identification Tool may be derived based on antlr (speaker for Language recognition). Specifically, an analysis rule for analyzing the request body may be defined according to the specification of the Antlr, that is, a syntax description file corresponding to the analysis rule is written. And then, Antlr can automatically generate a corresponding parser, namely a language recognition tool, according to the grammar description file. The language identification tool can analyze the request body according to the analysis rule so as to obtain the request parameter information.
Step 203, determining the analysis data aiming at the API information based on the API basic description information, the API request information and the request parameter information.
In this embodiment, the execution body may determine the parsing data for the API information based on the API basic description information, the API request information, and the request parameter information. As an example, the execution body may use various information included in the API basic description information, information other than the requester in the API request information, and the request parameter information parsed in step 202 as the parsing data for the API information.
In optional implementation manners of this embodiment, the API request information may further include a request address, a request method, and a request header, and step 203 may specifically include the following:
first, the API basic description information, request address, request method, and request header are checked.
In this implementation, the execution body may check the API basic description information, the request address, the request method, and the request header. As an example, the execution body may store in advance verification rules for verifying the API basic description information, the request address, the request method, and the request header, respectively. The execution body can verify the API basic description information, the request address, the request method and the request header according to the verification rule. In practice, the calibration rule can be set according to actual needs. For example, for the API basic description information, a check rule for checking the data format and the data content may be set. For the request address, the request method, the request header, and the like, a check rule for checking whether or not the preset format is satisfied may be set. Generally, the request address, the request method, and the request header need to conform to a predetermined format, for example, the request address needs to conform to an address format of HTTP (hypertext transfer protocol).
Then, in response to determining that the API basic description information, the request address, the request method, and the request header check pass, the API basic description information, the request address, the request method, the request header, and the request parameter information are determined as the parsing data for the API information.
In this implementation, the execution main body may determine whether the API basic description information, the request address, the request method, and the request header check, and if so, may determine the API basic description information, the request address, the request method, the request header, and the request parameter information as the parsing data for the API information.
In , the step 203 may further include the following steps:
and in response to determining that at least items in the API basic description information, the request address, the request method and the request header fail to be checked, sending prompt information to a user according to the checking result.
In this implementation, if items or more of the API basic description information, the request address, the request method and the request header are judged to be failed, the execution main body can send prompt information to the user according to the verification result.
Step 204, generating an API document according to the analysis data and a pre-established document content template.
In this embodiment, the execution agent may generate an API document from the parsed data obtained in step 203 and a document content template established in advance. By way of example, the generated API document may include, but is not limited to, an API profile, service information, a generic description (e.g., API version number), a parameter description, and the like. Here, the document content template may be established according to actual needs.
In alternative implementations of the present embodiment, step 204 may be specifically performed by using a template engine to fill parsing data into a document content template to generate an API document.
For example, the document content template may be a YAML (YAML Ain't markup Language, markup languages) template, and format support of a MarkDown tag is realized, YAML is high readability and is used to express a data serialization format MarkDown is markup languages that can be written using a common text editor and can make the common text content have a format determined by through simple markup syntax, and the template engine may be velocity, which is java-based template engines.
With continued reference to FIG. 3, FIG. 3 is schematic diagrams of an application scenario of a method for generating information according to the present embodiment, in the application scenario of FIG. 3, terminal device 301 first receives API information input by a user, wherein the API information includes API base description information and API request information, wherein the API request information includes a request body, after which terminal device 301 parses the request body based on a language identification tool to obtain request parameter information, then terminal device 301 determines parsed data for the API information based on the API base description information, the API request information and the request parameter information, and finally terminal device 301 generates an API document based on the parsed data and a pre-established document content template.
The method provided by the embodiment of the disclosure can automatically generate the API document according to the API information input by the user, thereby realizing the automatic generation of the API document and improving the generation efficiency of the API document.
referring further to FIG. 4, there is shown a flow 400 of yet another embodiment of a method for generating information, the flow 400 of the method for generating information comprising the steps of:
step 401, receiving API information input by a user.
In the present embodiment, an execution subject of the method for generating information (e.g., the terminal device 101, 102, 103 or the server 105 shown in fig. 1) may receive API information input by a user. The API information may include API basic description information and API request information. The API request information may include a request body, and the request body may include a call instance of the request parameter. Call examples may include JSON structure data and annotations. Where annotations may be used to describe parameters.
And step 402, analyzing the JSON structure data and the annotation by adopting a language identification tool to obtain parameter characteristics and parameter description information.
In this embodiment, the execution subject may analyze the JSON structure data and the annotation by using a speech recognition tool, so as to obtain the parameter features and the parameter description information.
By way of example, the API request information entered by the user may include request parameters in the requestor that are in the following categories:
category , includes JSON structure data only, without annotation.
Class two, JSON structure data + category notes here, category notes may refer to simple direct notes.
Category three, formal JSON structure data + second category annotation. Wherein the second category of annotations may refer to complex annotations.
For example, the following request body includes three invocation examples of request parameters that conform to the three categories described above, respectively, where line belongs to category , the second line belongs to category two, and the third line belongs to category three.
Figure BDA0002234408590000091
The execution subject can analyze the request body by adopting a language identification tool so as to obtain the parameter characteristics and the parameter description information of the parameters. Specifically, the language identification tool may parse the parameter name, the type, the necessity, the parameter location, the example value, and the like to obtain the parameter feature, and may use the annotated category as the parameter description information of the parameter. For example, the requesting entity may parse the parameter characteristics and the parameter description information as shown in table 1 below.
Table 1:
Figure BDA0002234408590000101
it is to be understood that the above request body and the parameter information in table 1 are only illustrative and not limiting of the parameter information. In practice, the parameter information of the request body can be set according to actual needs.
And step 403, taking the parameter characteristics and the parameter description information as the request parameter information obtained by analysis.
In this embodiment, the execution subject may use the parameter characteristics and the parameter description information obtained in step 402 as the request parameter information obtained by parsing.
Step 404, determining parsing data for the API information based on the API basic description information, the API request information, and the request parameter information.
In this embodiment, step 404 is similar to step 203 of the embodiment shown in fig. 2, and is not described here again.
Step 405, generating an API document according to the analysis data and a pre-established document content template.
In this embodiment, step 405 is similar to step 204 of the embodiment shown in fig. 2, and is not described herein again.
As can be seen from fig. 4, compared with the embodiment corresponding to fig. 2, the flow 400 of the method for generating information in the present embodiment highlights the parsing of the request body including JSON structure data and annotations. Therefore, the method described in the embodiment can support more forms of requestors, and the generated API document can contain more abundant information.
with further reference to FIG. 5, as an implementation of the methods shown in the above figures, the present disclosure provides embodiments of apparatus for generating information, which correspond to the method embodiment shown in FIG. 2, and which are particularly applicable in various electronic devices.
As shown in fig. 5, the apparatus 500 for generating information of the present embodiment includes: receiving section 501, analyzing section 502, determining section 503, and generating section 504. The receiving unit 501 is configured to receive API information input by a user, where the API information includes API basic description information and API request information, where the API request information includes a request body; the parsing unit 502 is configured to parse the request body based on a language identification tool, so as to obtain request parameter information, where the language identification tool is used to parse the request body according to a preset parsing rule; the determining unit 503 is configured to determine analysis data for the API information based on the API basic description information, the API request information, and the request parameter information; the generating unit 504 is configured to generate an API document based on the parsing data and a pre-established document content template.
In this embodiment, specific processes of the receiving unit 501, the analyzing unit 502, the determining unit 503, and the generating unit 504 of the apparatus 500 for generating information and technical effects brought by the specific processes can refer to related descriptions of step 201, step 202, step 203, and step 204 in the corresponding embodiment of fig. 2, which are not described herein again.
In alternative implementations of this embodiment, the request body includes JSON structure data and a comment, and the parsing unit 502 is further configured to parse the JSON structure data and the comment by using the language identification tool to obtain a parameter feature and parameter description information, and use the parameter feature and the parameter description information as the parsed request parameter information.
In alternative implementations of this embodiment, the API request information further includes a request address, a request method, and a request header, and the determining unit 503 is further configured to check the API basic description information, the request address, the request method, and the request header, and determine the API basic description information, the request address, the request method, the request header, and the request parameter information as the parsing data for the API information in response to determining that the API basic description information, the request address, the request method, and the request header check pass.
In alternative implementations of the embodiment, the determining unit 503 is further configured to, in response to determining that at least of the API basic description information, the request address, the request method, and the request header fail to check, send a prompt message to the user according to a check result.
In alternative implementations of the embodiment, the generating unit 504 is further configured to generate the API document by using a template engine to fill the parsing data into the document content template.
Referring now to fig. 6, a schematic diagram of an electronic device (e.g., the server or the terminal device in fig. 1) 600 suitable for implementing embodiments of the present disclosure is shown, the electronic device shown in fig. 6 is merely an example and should not bring any limitations to the functions and scope of use of the embodiments of the present disclosure.
As shown in fig. 6, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
In general, input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc., output devices 607 including, for example, a Liquid Crystal Display (LCD), speaker, vibrator, etc., storage devices 608 including, for example, magnetic tape, hard disk, etc., and communication devices 609. the communication devices 609 may allow the electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data.
Embodiments of the present disclosure include, for example, computer program products comprising a computer program embodied on a computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart in such embodiments, the computer program may be downloaded and installed from a network through the communication means 609, or installed from the storage means 608, or the ROM 602.
In an embodiment of the disclosure, the computer readable storage medium may be any tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device, and may include, but is not limited to, a computer readable signal medium or a computer readable storage medium, or any combination of the foregoing, such as an electrical connection having or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer-readable medium may be included in the electronic device or may exist separately and not be incorporated in the electronic device, and carry or more programs, when the or more programs are executed by the electronic device, the electronic device receives API information input by a user, wherein the API information includes API basic description information and API request information, wherein the API request information includes a request body, parses the request body based on a language identification tool to obtain request parameter information, wherein the language identification tool is configured to parse the request body according to a preset parsing rule, determines parsing data for the API information based on the API basic description information, the API request information, and the request parameter information, and generates an API document according to the parsing data and a pre-established document content template.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, or a combination thereof, as well as conventional procedural programming languages, such as the "C" programming language or similar programming languages.
It should also be noted that in some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures, for example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved, it being noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, may be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described may also be provided in a processor, for example, it may be described that kinds of processors include a receiving unit, a parsing unit, a determining unit and a generating unit, wherein names of the units do not constitute a limitation of the units themselves in some cases, for example, the receiving unit may also be described as a "unit receiving API information input by a user".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.

Claims (12)

1, a method for generating information, comprising:
receiving API information input by a user, wherein the API information comprises API basic description information and API request information, and the API request information comprises a request body;
analyzing the request body based on a language identification tool to obtain request parameter information, wherein the language identification tool is used for analyzing the request body according to a preset analysis rule;
determining parsing data for the API information based on the API basic description information, the API request information, and the request parameter information;
and generating an API document according to the analysis data and a pre-established document content template.
2. The method of claim 1, wherein the request body comprises JSON structure data and annotations; and
the analyzing the request body based on the language identification tool to obtain request parameter information comprises the following steps:
analyzing the JSON structure data and the annotation by adopting the language identification tool to obtain parameter characteristics and parameter description information;
and taking the parameter characteristics and the parameter description information as request parameter information obtained by analysis.
3. The method of claim 1, wherein the API request information further includes a request address, a request method, and a request header; and
the determining parsing data for the API information based on the API basic description information, the API request information, and the request parameter information includes:
checking the basic description information of the API, the request address, the request method and the request header;
in response to determining that the API basic description information, the request address, the request method, and the request header check pass, determining the API basic description information, the request address, the request method, the request header, and the request parameter information as parsed data for the API information.
4. The method of claim 3, wherein the determining parsing data for the API information based on the API basic description information, the API request information, and the request parameter information further comprises:
and in response to determining that at least items in the API basic description information, the request address, the request method and the request header fail to be checked, sending prompt information to the user according to the checking result.
5. The method of claim 1, wherein generating an API document from the parsed data and a pre-established document content template comprises:
and filling the analysis data into the document content template by adopting a template engine to generate an API document.
An apparatus for generating information of , comprising:
a receiving unit configured to receive API information input by a user, wherein the API information includes API basic description information and API request information, wherein the API request information includes a request body;
the analysis unit is configured to analyze the request body based on a language identification tool to obtain request parameter information, wherein the language identification tool is used for analyzing the request body according to a preset analysis rule;
a determination unit configured to determine parsing data for the API information based on the API basic description information, the API request information, and the request parameter information;
and the generating unit is configured to generate the API document according to the analysis data and a pre-established document content template.
7. The apparatus of claim 6, wherein the request body comprises JSON fabric data and annotations; and
the parsing unit is further configured to:
analyzing the JSON structure data and the annotation by adopting the language identification tool to obtain parameter characteristics and parameter description information;
and taking the parameter characteristics and the parameter description information as request parameter information obtained by analysis.
8. The apparatus of claim 6, wherein the API request information further includes a request address, a request method, and a request header; and
the determining unit is further configured to:
checking the basic description information of the API, the request address, the request method and the request header;
in response to determining that the API basic description information, the request address, the request method, and the request header check pass, determining the API basic description information, the request address, the request method, the request header, and the request parameter information as parsed data for the API information.
9. The apparatus of claim 8, wherein the determining unit is further configured to:
and in response to determining that at least items in the API basic description information, the request address, the request method and the request header fail to be checked, sending prompt information to the user according to the checking result.
10. The apparatus of claim 6, wherein the generating unit is further configured to:
and filling the analysis data into the document content template by adopting a template engine to generate an API document.
An apparatus of the type 11, , comprising:
or more processors;
a storage device having or more programs stored thereon,
when the or more programs are executed by the or more processors, cause the or more processors to implement the method of any of claims 1-5.
12, computer readable medium, having a computer program stored thereon, wherein the program, when executed by a processor, implements the method of any of claims 1-5, .
CN201910978408.9A 2019-10-15 2019-10-15 Method and apparatus for generating information Pending CN110738036A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910978408.9A CN110738036A (en) 2019-10-15 2019-10-15 Method and apparatus for generating information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910978408.9A CN110738036A (en) 2019-10-15 2019-10-15 Method and apparatus for generating information

Publications (1)

Publication Number Publication Date
CN110738036A true CN110738036A (en) 2020-01-31

Family

ID=69268881

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910978408.9A Pending CN110738036A (en) 2019-10-15 2019-10-15 Method and apparatus for generating information

Country Status (1)

Country Link
CN (1) CN110738036A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111581937A (en) * 2020-05-15 2020-08-25 航天科工智慧产业发展有限公司 Document generation method and device, computer readable medium and electronic equipment
CN112130837A (en) * 2020-09-25 2020-12-25 腾讯科技(深圳)有限公司 Code processing method and device and storage medium
CN113741893A (en) * 2021-08-02 2021-12-03 重庆长安汽车股份有限公司 JSON (Java Server object notation) -analysis-based open platform interface document automatic generation method and system
CN113766030A (en) * 2021-09-13 2021-12-07 城云科技(中国)有限公司 Automatic parameter entering method and device for interface constant parameters

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111581937A (en) * 2020-05-15 2020-08-25 航天科工智慧产业发展有限公司 Document generation method and device, computer readable medium and electronic equipment
CN112130837A (en) * 2020-09-25 2020-12-25 腾讯科技(深圳)有限公司 Code processing method and device and storage medium
CN113741893A (en) * 2021-08-02 2021-12-03 重庆长安汽车股份有限公司 JSON (Java Server object notation) -analysis-based open platform interface document automatic generation method and system
CN113766030A (en) * 2021-09-13 2021-12-07 城云科技(中国)有限公司 Automatic parameter entering method and device for interface constant parameters

Similar Documents

Publication Publication Date Title
CN110738036A (en) Method and apparatus for generating information
CN109359194B (en) Method and apparatus for predicting information categories
US10164848B1 (en) Web service fuzzy tester
US20180181270A1 (en) Ordered Macro Building Tool
CN110780874B (en) Method and device for generating information
RU2662405C2 (en) Certification documents automatic generation
CN110888794B (en) Interface testing method and device
CN113626223A (en) Interface calling method and device
CN111443909A (en) Method and device for generating page
US10133730B2 (en) Context based document analysis
CN113760729A (en) Code detection method and device
CN110362630B (en) Data management method, device, equipment and computer readable storage medium
CN110377273A (en) A kind of method, apparatus of data processing, medium and electronic equipment
CN112084114B (en) Method and apparatus for testing interfaces
CN113778725A (en) Data verification method and device
CN112559024A (en) Method and device for generating transaction code change list
CN110489326B (en) IDS-based HTTPAPI debugging method device, medium and equipment
CN114816246B (en) Processing method and device for Proto file
CN112395194B (en) Method and device for accessing test platform
CN115454956A (en) Log generation method and device, electronic equipment and storage medium
CN114936151A (en) Display method, device, equipment, storage medium and communication system of debugging page
CN114691527A (en) Unit test case generation method, apparatus, device, medium, and program product
CN113419738A (en) Interface document generation method and device and interface management equipment
CN108170557B (en) Method and apparatus for outputting information
CN112905970A (en) Authority verification method and device, computer readable storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination