CN110333850A - Generation method, device, computer equipment and the storage medium of interface document - Google Patents
Generation method, device, computer equipment and the storage medium of interface document Download PDFInfo
- Publication number
- CN110333850A CN110333850A CN201910463199.4A CN201910463199A CN110333850A CN 110333850 A CN110333850 A CN 110333850A CN 201910463199 A CN201910463199 A CN 201910463199A CN 110333850 A CN110333850 A CN 110333850A
- Authority
- CN
- China
- Prior art keywords
- interface
- information
- document
- specified
- interface document
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/73—Program documentation
Abstract
This application discloses a kind of generation method of interface document, device, computer equipment and storage mediums, and wherein method includes: the source code for obtaining first item;The class method with interface flag is filtered out from all class methods of source code, and the class method with interface flag is denoted as interface class method;Interface essential information is extracted from method body corresponding with interface class method by reflection technology, and interface additional information is extracted from the corresponding code comments information of method body;Integrated interface essential information and interface additional information form first interface information;First interface information is added in preset interface document template, according to preset interface document template generation first interface document corresponding with first interface information.First interface document corresponding with the source code of first item can be automatically generated by the application, the consistency of first interface document Yu first interface information is ensure that, has been effectively saved human cost, improve the formation efficiency of interface document.
Description
Technical field
This application involves field of computer technology, and in particular to a kind of generation method of interface document, device, computer are set
Standby and storage medium.
Background technique
With the continuous development of computer technology, during project development, since the complexity of software systems is more next
It is higher, cause item code amount also can be increasing, it usually needs many name developers cooperate jointly carrys out opening for finished item
Hair, but be different the coding style between developer difference it is larger, the code that a certain developer writes often be difficult to by
Another developer understands.Therefore, for the ease of can mutually understand in the code respectively write between different developers
Hold, task of each developer in addition to complete to write code, it is also necessary to provide it is perfect and with the item code pair write
The interface document answered.The a large amount of time and efforts of developer, low efficiency and appearance can be wasted by carrying out hand-coding to interface document
Error-prone, development cost is high.
Summary of the invention
The main purpose of the application is that the generation method for providing a kind of interface document, device, computer equipment and storage are situated between
Matter, it is intended to solve existing developer and need hand-coding interface document corresponding with item code, waste developer
A large amount of time and efforts, low efficiency and easy error, the high technical problem of development cost.
The application proposes a kind of generation method of interface document, the method includes the steps:
Obtain the source code of first item;
The class method with interface flag is filtered out from all class methods of the source code, and described will have interface
The class method of label is denoted as interface class method;
Interface essential information is extracted from method body corresponding with the interface class method by reflection technology, and from institute
State extraction interface additional information in the corresponding code comments information of method body;
The interface essential information and the interface additional information are integrated, first interface information is formed, wherein described first
Interface message include at least the title of input parameter, input the type of parameter, the title of output parameter, the type of output parameter with
And parameter annotation information;
The first interface information is added in preset interface document template, according to the preset interface document mould
Plate generates first interface document corresponding with the first interface information.
Optionally, before the step of source code for obtaining first item, comprising:
The first item information for receiving user's input, wherein the first item information includes maven coordinate;
According to the maven coordinate, hunted out from preset program development management tool corresponding with the maven coordinate
The first item;
Generate the instruction for obtaining the source code of the first item.
Optionally, described that the first interface information is added in preset interface document template, according to described default
Interface document template generation corresponding with the first interface information first interface document the step of after, comprising:
Corresponding first index is established for the first interface document, and described first is indexed and the first interface
Document is uploaded to preset document database, wherein the first interface document is the total interface that the document database includes
Any one interface document in document;
Judge whether that the document searching for receiving user's input instructs;
If receiving the document searching instruction of user's input, the search extracted in the document searching instruction is crucial
Word;
Judge in the pre-stored index of the document database, if there is index corresponding with described search keyword
?;
Index entry corresponding with described search keyword if it exists then obtains the corresponding specified interface text of the index entry
Shelves;
Pass through specified interface document described in specified display page presentation.
It is optionally, described to pass through specified the step of showing specified interface document described in page presentation, comprising:
Create various forms of display interfaces of specified quantity;
Receive the first display interface that the user chooses from all display interfaces;
First display interface is determined as the specified display page, and institute is shown by first display interface
State specified interface document.Optionally, the index entry corresponding with described search keyword if it exists, then obtain the index entry
Corresponding specified interface document, and after the step of by specifying specified interface document described in display page presentation, comprising:
Judge whether to receive the modification information that the user inputs in the specified display interface;
If so, modifying according to the modification information to the specified interface document, modified interface document is obtained;
The specified interface document is replaced using the modified interface document.
Optionally, described that the first interface information is added in preset interface document template, according to described default
Interface document template generation corresponding with the first interface information first interface document the step of after, comprising:
Judge whether the corresponding source code of the first interface document produces modification record;
If the source code produces modification record, the specified interface information of modified source code is obtained, and by institute
It states specified interface information and the clean interface information of the pre-stored source code compares, obtain comparing result, wherein institute
State the interface message that clean interface information is the source code before modification;
According to the comparing result, judge the specified interface information and the clean interface information with the presence or absence of difference;
If the specified interface information has differences with the clean interface information, according to the specified interface information with
The difference of the clean interface information is updated the first interface document.
Optionally, described that the first interface information is added in preset interface document template, according to described default
Interface document template generation corresponding with the first interface information first interface document the step of after, comprising:
Judge whether to receive the debugging request for specified interface that the user inputs, wherein the specified interface is
The interface debugged, the debugging request carry the required parameter of the specified interface;
The debugging request is forwarded to the application example that the specified interface corresponds to technical routine, to pass through the application
Example handles the debugging request, and obtains output parameter corresponding with the required parameter of the specified interface;
The output parameter that the application example returns is received, and shows the output parameter.
The application also provides a kind of generating means of interface document, comprising:
First obtains module, for obtaining the source code of first item;
Screening module, for filtering out the class method with interface flag from all class methods of the source code, and
The class method with interface flag is denoted as interface class method;
First extraction module, for extracting interface from method body corresponding with the interface class method by reflection technology
Essential information, and interface additional information is extracted from the corresponding code comments information of the method body;
Module is integrated, for integrating the interface essential information and the interface additional information, forms first interface information,
Wherein the first interface information includes at least the title of input parameter, the type for inputting parameter, the title of output parameter, output
The type and parameter annotation information of parameter;
Adding module, for the first interface information to be added in preset interface document template, according to described pre-
If interface document template generation first interface document corresponding with the first interface information.
The application also provides a kind of computer equipment, including memory and processor, is stored with calculating in the memory
The step of machine program, the processor realizes the above method when executing the computer program.
The application also provides a kind of computer readable storage medium, is stored thereon with computer program, the computer journey
The step of above method is realized when sequence is executed by processor.
Generation method, device, computer equipment and the storage medium of interface document provided herein have with following
Beneficial effect:
Generation method, device, computer equipment and the storage medium of interface document provided herein obtain first item
Purpose source code;The class method with interface flag is filtered out from all class methods of the source code, and is had by described in
The class method of interface flag is denoted as interface class method;It is mentioned from method body corresponding with the interface class method by reflection technology
Interface essential information is taken, and extracts interface additional information from the corresponding code comments information of the method body;Described in integration
Interface essential information and the interface additional information form first interface information, wherein the first interface information includes at least
It inputs the title of parameter, input type, the title of output parameter, the type of output parameter and the parameter annotation information of parameter;
The first interface information is added in preset interface document template, according to the preset interface document template generation with
The corresponding first interface document of the first interface information.The source code pair with first item can be automatically generated by the application
The first interface document answered, is not required to manual compiling, ensure that the consistency of first interface document Yu first interface information, effectively
Human cost is saved, the formation efficiency of interface document, and the uniform format of the interface document generated are improved, convenient for difference
Developer read.
Detailed description of the invention
Fig. 1 is the flow diagram of the generation method of the interface document of one embodiment of the application;
Fig. 2 is the structural schematic diagram of the generating means of the interface document of one embodiment of the application;
Fig. 3 is the structural schematic diagram of the computer equipment of one embodiment of the application.
The embodiments will be further described with reference to the accompanying drawings for realization, functional characteristics and the advantage of the application purpose.
Specific embodiment
It should be appreciated that specific embodiment described herein is used only for explaining the application, it is not used to limit the application.
It is to be appreciated that the directional instruction (such as up, down, left, right, before and after ...) of institute is only used in the embodiment of the present application
In explaining in relative positional relationship, the motion conditions etc. under a certain particular pose (as shown in the picture) between each component, if should
When particular pose changes, then directionality instruction also correspondingly changes correspondingly, and the connection, which can be, to be directly connected to,
It can be and be indirectly connected with.
Referring to Fig.1, the generation method of the interface document of one embodiment of the application, comprising:
S1: the source code of first item is obtained;
S2: the class method with interface flag is filtered out from all class methods of the source code, and is had by described in
The class method of interface flag is denoted as interface class method;
S3: extracting interface essential information by reflection technology from method body corresponding with the interface class method, and
Interface additional information is extracted from the corresponding code comments information of the method body;
S4: integrating the interface essential information and the interface additional information, forms first interface information, wherein described the
One interface message includes at least the title of input parameter, inputs type, the title of output parameter, the type of output parameter of parameter
And parameter annotation information;
S5: the first interface information is added in preset interface document template, according to the preset interface text
Shelves template generation first interface document corresponding with the first interface information.
As described in above-mentioned steps S1, the executing subject of the method for the present embodiment is the generating means of interface document, above-mentioned to connect
The generating means of mouth document can automatically generate corresponding with the source code of the first item after obtaining the source code of first item
First interface document, wherein above-mentioned first item can be the specific project on exploitation machine, the source code of above-mentioned first item can
The code file under code file project by scanning the first item obtains.Specifically, can be inputted according to user first
Project information obtains first item corresponding with the first item information from preset program development management tool, and from first
Corresponding source code is extracted in project, wherein be not construed as limiting to the type of above-mentioned source code, such as above-mentioned source code file can
Think Java code, or the code write by other programming languages, the present embodiment are carried out by Java code of source code
Explanation.
As described in above-mentioned steps S2 to step S4, after obtaining above-mentioned source code, then by reflection technology to above-mentioned first
The source code of project is parsed, to obtain first interface information corresponding with first item, wherein above-mentioned reflection technology is one
Kind is suitable for the reflection mechanism of programming language, and dynamic acquisition information and dynamic call object may be implemented by the reflection mechanism
The function of method can obtain this class so as to realize in operating status for any one class in source code
All attribute informations.It may include multiple class methods in a class in addition, may include multiple classes in source code, and class method
Including interface class method and non-interface class method, wherein the class method with interface flag can be known as interface class method, such as
Class method with Path label in method body is interface class method, and different service frameworks to the label of interface not
Together, the method class marked in jersey frame is the interface externally provided, and is got the bid in spring mvc frame
Remember that the method class for having@path Mapping is the interface externally provided.Above by reflection technology to the source generation of first item
Code is parsed, and is obtained the process of first interface information corresponding with source code, is specifically included: connecing in acquisition source code first
Mouthful class method filters out the class method (interface in source code with interface flag in all class methods of that is, above-mentioned source code
Class method), included interface in the class to find out source code.Then by above-mentioned reflection technology from above-mentioned interface class side
Interface essential information is obtained in the corresponding method body of method, and extracts connect in the corresponding code comments information of body from the above
Mouth additional information, wherein above-mentioned interface essential information includes the information such as parameter name and parameter type, above-mentioned interface additional information
Including information such as interface description information, interface types.Finally integrate above-mentioned interface essential information and interface additional information, i.e., it will be upper
It states interface additional information to be added in corresponding interface essential information, to form above-mentioned first interface information.
As described in above-mentioned steps S5, after obtaining first interface information corresponding with the source code of first item, into one
First interface information is added in preset interface document template by step, and generated according to the preset interface document template with
The corresponding above-mentioned first interface document of source code, wherein above-mentioned first interface information is by interface essential information and the additional letter of interface
Breath is integrally formed, and specifically may include the title for inputting parameter, type, the title of output parameter, output parameter for inputting parameter
Type and parameter annotation information etc., above-mentioned interface document template can be configured according to actual needs, not do specific limit herein
System.In the present embodiment, first interface information corresponding with interface in source code is parsed by reflection technology, so as to subsequent straight
It connects and first interface information is added in preset interface document, to automatically form the interface document of first item, ensure that
The consistency of one interface document and first interface information eliminates the movement of manual compiling interface document, has been effectively saved people
Power cost improves the formation efficiency of interface document, and the uniform format of the interface document generated, convenient for different exploit persons
Member is read.
Further, in one embodiment of the application, before above-mentioned steps S1, comprising:
S100: the first item information of user's input is received, wherein the first item information includes maven coordinate;
S101: it according to the maven coordinate, is hunted out and the maven coordinate from preset program development management tool
The corresponding first item;
S102: the instruction for obtaining the source code of the first item is generated.
As described in above-mentioned steps S100 to S102, the source code of above-mentioned acquisition first item the step of before, further include
The process of first item is obtained, specifically can include: the first item information of reception user input first, wherein the first item is believed
Breath includes maven coordinate, i.e. GroupId, ArtifactId and Version.Wherein, above-mentioned GroupID be the project organization only
One identifier, the structure of the packet of practical corresponding java, is the bibliographic structure of java in main catalogue, and citing ground GroupID is fixed
Which group is justice project belong to, and if there is a company is mycom, having a project is myapp, then GroupId can table
It is shown as: com.mycom.myapp;Above-mentioned ArtifactID is unique identifier of project, practical respective items purpose title, just
It is the title of project root, ArtifactID defines current maven project unique ID in the group, such as can be
Myapp-util, myapp-domain, myapp-web etc.;Above-mentioned Version specifies the current version of maven project.It is obtaining
Obtained above-mentioned first item information, i.e., after above-mentioned maven coordinate, can be hunted out from preset program development management tool with
The corresponding first item of first item information, wherein above procedure development management tool is the warehouse maven, and finally regeneration obtains
The instruction of the source code of the first item is taken, to realize the acquisition to the source code of first item, so as to subsequent according to first
Source code in project automatically generates corresponding first interface document.It wherein can to the acquisition modes of the source code of first item
Including two kinds, can be directly download and store the first item, thus it is subsequent can directly from downloading content in obtain this first
The source code of project, can also for after the above-mentioned warehouse maven hunts out first item, directly from the warehouse maven call out this
The source code of one project.
Further, in one embodiment of the application, after above-mentioned steps S5, comprising:
S500: establishing corresponding first index for the first interface document, and described first is indexed and described the
One interface document is uploaded to preset document database, wherein the institute that the first interface document includes for the document database
There is any one interface document in interface document;
S501: judge whether to receive the document searching instruction of user's input;
S502: if receiving the document searching instruction of user's input, the search in the document searching instruction is extracted
Keyword;
S503: judge in the pre-stored index of the document database, if exist corresponding with described search keyword
Index entry;
S504: index entry corresponding with described search keyword if it exists then obtains corresponding specify of the index entry and connects
Mouth document;
S505: pass through specified interface document described in specified display page presentation.
As described in above-mentioned steps S500 to S505, the document database for memory interface document can be pre-created,
After generating above-mentioned first interface document, which can be uploaded in this article profile database and be deposited
Storage, and the interface document for the other projects being subsequently generated can also be uploaded to this article profile database and be stored, so that should
Document database is stored with the interface document of all items, index can be further established for the interface document of all items, and will
Interface document and corresponding index are uploaded to this article profile database together and are stored, with by the document database realizing for
The unified centralized management and inquiry of the interface document of all items.To which subsequent user is needing to read first interface document
When, above-mentioned first interface document can be rapidly indexed out from the total interface document uploaded in document database.In this reality
Example is applied, after generating above-mentioned first interface document, corresponding first index is established first for first interface document, by described first
Index and the first interface document are uploaded to preset document database, wherein above-mentioned first interface document is document data
Any one interface document in total interface document that library includes.Then judge whether that receiving carrying for user's input searches
The document searching of rope keyword instructs, if receiving above-mentioned document searching instruction, extracts in above-mentioned document searching instruction
Search key, and judge in the pre-stored index of above-mentioned document database with the presence or absence of rope corresponding with the search key
Draw item, wherein above-mentioned search key and above-mentioned specified interface document have corresponding relationship, which may include that this refers to
Certain key words in stationary interface document, and above-mentioned document database is that the total interface document uploaded establishes correspondence
Index.If there is index entry corresponding with above-mentioned search key, then specified interface corresponding with above-mentioned index entry is obtained
Document, and above-mentioned specified interface document is shown to above-mentioned user by the specified display page.In the present embodiment, user only needs defeated
Enter the document searching instruction for carrying search key corresponding with specified interface document, it can be from the index of document database
Index entry corresponding with the search key is matched, to rapidly acquire specified interface text corresponding with the index entry
Shelves.It is advantageously implemented unified management and inquiry for interface document by above-mentioned document database, is realized to all interfaces
The centralized management of document improves the convenience for searching interface document.
Further, in one embodiment of the application, above-mentioned steps S505, comprising:
S5050: various forms of display interfaces of specified quantity are created;
S5051: the first display interface that the user chooses from all display interfaces is received;
S5052: first display interface is determined as the specified display page, and passes through first display interface
Show the specified interface document.
As described in above-mentioned steps S5050 to S5052, above by the step of specified display page presentation specified interface document
Suddenly, specifically can include: create various forms of display interfaces of specified quantity first, wherein above-mentioned specified quantity is according to reality
Situation is set, and above-mentioned various forms of display interfaces may particularly include but be not limited to text box form display interface, table
Form display interface, code form display interface and form web page display interface.Then user is received from all displays circle
The first display interface chosen in face, and first display interface is determined as the above-mentioned specified display page, and by this
One display interface shows above-mentioned specified interface document to user, so that user consults the specified interface document.In this reality
Example is applied, a variety of various forms of display interfaces of display interface document are used for by being arranged, due to various forms of display interfaces
It is applicable to different users, user can select the first display interface for meeting self-demand from all display interfaces,
I.e. specified display interface, and the specified interface document is shown by first display interface, effectively raise specified interface
The readability of document also improves the usage experience of user, and further, user can examine the specified interface document of displaying
Core realizes the accuracy judgement for the interface document of generation, and the processing that can modify to the interface document.
Further, in one embodiment of the application, after above-mentioned steps S505, comprising:
S506: judge whether to receive the modification information that the user inputs in the specified display interface;
S507: if so, modifying according to the modification information to the specified interface document, modified interface is obtained
Document;
S508: the specified interface document is replaced using the modified interface document.
As described in above-mentioned steps S506 to S508, above-mentioned specified interface text is checked by above-mentioned specified display interface in user
When shelves, if it find that the specified interface document is described the content of mistake or user needs to add on specified interface document
Or when deleting certain contents, can directly it believe in above-mentioned specified display interface input for the modification of current specified interface document
Breath, wherein above-mentioned modification information includes that (Application Programming Interface, application programming connect to API
Mouthful) author of interface, exploitation date, method list, the function description of method, the parameter type of method and title, method parameter
Description information, method return to the request of Value Types and description information, the acceptable request type of method and method and method
The information such as path are modified.Later, it is modified, and obtained modified to specified interface document according to above-mentioned modification information
Interface document finally replaces the specified interface document using modified interface document.In the present embodiment, finger is checked in user
When stationary interface document, modification information can be inputted rapidly to realize to finger in specified display interface according to their own needs
The modification of the content of stationary interface document to correct to specified interface document, and is abided by the modification of specified interface document
From the wish of user, the usage experience of user is effectively increased.
Further, in one embodiment of the application, after above-mentioned steps S5, comprising:
S510: judge whether the corresponding source code of the first interface document produces modification record;
S511: if the source code produces modification record, obtaining the specified interface information of modified source code, and
The specified interface information and the clean interface information of the pre-stored source code are compared, comparing result is obtained,
Described in clean interface information be modification before source code interface message;
S512: according to the comparing result, judge that the specified interface information whether there is with the clean interface information
Difference;
S513: if the specified interface information has differences with the clean interface information, according to the specified interface
The difference of information and the clean interface information is updated the first interface document.
As described in above-mentioned steps S510 and S513, above-mentioned first interface corresponding with the source code of first item is being generated
After document, if detecting that the corresponding source code of first interface document produces modification record, such as developer to the source
Code is modified, and the modification carried out to the source code can impact the particular content of interface document, then can basis
Developer completes the synchronized update to first interface document, specific process for the modification of the source code can include: first
First judge whether the corresponding source code of above-mentioned first interface document produces modification record, if the source code produces modification note
Record, then obtain the specified interface information of modified source code, and by the specified interface information of above-mentioned modified source code with
The clean interface information of pre-stored source code compares, and obtains comparing result.Wherein above-mentioned clean interface information is modification
The interface message of preceding source code, and will do it storage processing, in addition above-mentioned comparison knot after clean interface information generation
Fruit may include that specified interface information identical as clean interface information or specified interface information and clean interface information is not identical, i.e.,
Specified interface information has differences with clean interface information.Then according to above-mentioned comparing result, judge above-mentioned specified interface information
It whether there is difference with above-mentioned clean interface information, if the two has differences, according to specified interface information and clean interface
The difference of information is updated first interface document.Wherein the difference of above-mentioned specified interface information and clean interface information can wrap
It includes: the specified interface information of modified interface source code and the interface message of the interface source code before modification are that is, above-mentioned original
Interface message is compared, and is increased new data, is deleted old data or old data are substituted for new data, etc.,
In addition above-mentioned data refer to the data for including in interface message, the i.e. type of input parameter, the title for inputting parameter, output parameter
The data such as type, the title of output parameter and parameter annotation information.Further, if specified interface information connects with original
Difference is not present in message breath, then is not modified processing to the corresponding first interface document of clean interface information.In the present embodiment,
After the source code of first item is modified by developer, first obtain source code it is modified after specified interface information, and examine
It measures with the presence or absence of difference between the specified interface information of modified source code and clean interface information, then basis should if it exists
Difference is updated first interface document, has effectively achieved the automatic of when source code changes first interface document
Synchronized update reduces the workload of developer without manual maintenance interface document.In addition above-mentioned specify is being detected
The difference of interface message and clean interface information is only regenerated and is kept other parts not to the data changed
Become, so that interface document need to only carry out modification by a small margin for above-mentioned difference, improve the speed of interface document synchronized update,
Decrease the workload of interface document synchronized update.
Further, in one embodiment of the application, after above-mentioned steps S5, comprising:
S520: judge whether to receive the debugging request for specified interface of user's input, wherein described specified
Interface is the interface debugged, and the debugging request carries the required parameter of the specified interface;
S521: the debugging request is forwarded to the application example that the specified interface corresponds to technical routine, to pass through
It states application example to handle the debugging request, and obtains output ginseng corresponding with the required parameter of the specified interface
Number;
S522: the output parameter that the application example returns is received, and shows the output parameter.
As described in above-mentioned steps S520 to S522, the generating means of above-mentioned interface document further include the debugging function having to interface
Can, when receive user's input for specified interface debugging request after, which can be forwarded to above-mentioned specified connect
Mouthful belonging to technical routine application example, i.e., technical routine belonging to specified interface be currently running in Service Instance so that
It obtains the Service Instance and is handled the debugging request and obtained processing result, wherein above-mentioned specified interface is to be debugged
Interface, above-mentioned debugging request carries the required parameter of the specified interface, and the required parameter is that specifying for user's filling is defeated
Enter parameter, the processing result that above-mentioned Service Instance obtains after handling the debugging request be output with specified input parameter
Corresponding specified output parameter, citing ground, if the specified input parameter of user's filling is HTTP (HyperText Transfer
Protocol, hypertext transfer protocol) request type parameter parameter, then the specified output parameter handled be HTTP
Protocol status code information;If specified input parameter is the parameter of non-HTTP request type parameter, specifying output parameter is pair
The return value description information answered.Later, receive processing result that above-mentioned application example returns will that is, after output parameter
Show the processing result to user, to complete the debugging to interface, user can according to obtained processing result come with expected result
It is compared, so that whether the function of verifying the interface improves and whether service can be used.It through this embodiment can be effectively real
Referring now to the debugging function of interface, the development efficiency of interface is improved.
Referring to Fig. 2, a kind of generating means of interface document are additionally provided in one embodiment of the application, comprising:
First obtains module 1, for obtaining the source code of first item;
Screening module 2, for filtering out the class method with interface flag from all class methods of the source code, and
The class method with interface flag is denoted as interface class method;
First extraction module 3 connects for being extracted from method body corresponding with the interface class method by reflection technology
Mouth essential information, and interface additional information is extracted from the corresponding code comments information of the method body;
Module 4 is integrated, for integrating the interface essential information and the interface additional information, forms first interface letter
Breath, wherein the first interface information include at least the title of input parameter, input the type of parameter, the title of output parameter,
The type and parameter annotation information of output parameter;
Adding module 5, for the first interface information to be added in preset interface document template, according to described pre-
If interface document template generation first interface document corresponding with the first interface information.
It is obtained in module above-mentioned first, the executing subject of the present embodiment is the generating means of interface document, above-mentioned interface
The generating means of document can automatically generate corresponding with the source code of the first item after obtaining the source code of first item
First interface document, wherein above-mentioned first item can lead to for the specific project on exploitation machine, the source code of above-mentioned first item
The code file over-scanned under the code file project of the first item obtains.Specifically, the first item that can be inputted according to user
Mesh information obtains first item corresponding with the first item information from preset program development management tool, and from first item
Corresponding source code is extracted in mesh, wherein be not construed as limiting to the type of above-mentioned source code, such as above-mentioned source code file can be with
For Java code, or the code write by other programming languages, the present embodiment are said by Java code of source code
It is bright.
It in above-mentioned screening module, the first extraction module and integrates in module, after obtaining above-mentioned source code, then by anti-
Technology is penetrated to parse the source code of above-mentioned first item, to obtain first interface information corresponding with first item, wherein
Above-mentioned reflection technology is a kind of reflection mechanism suitable for programming language, and dynamic acquisition information may be implemented by the reflection mechanism
And the function of dynamic call object method, so as to realize in operating status for any one class in source code,
All attribute informations of this class can be obtained.It may include multiple in a class in addition, may include multiple classes in source code
Class method, and class method includes interface class method and non-interface class method, wherein the class method with interface flag can be known as
Interface class method, such as it is interface class method that the class method of@Path label is had in method body, and different service frameworks docks
The label of mouth is different, and the method class marked in jersey frame is the interface externally provided, and
It is the interface externally provided that the method class for having Mapping is marked in spring mvc frame.Above by reflection skill
Art parses the source code of first item, obtains the process of first interface information corresponding with source code, specifically includes: first
The interface class method in source code is first obtained, i.e., filters out the class side with interface flag in all class methods of above-mentioned source code
Method (the interface class method in source code), included interface in the class to find out source code.Then pass through above-mentioned reflection skill
Art obtains interface essential information, and the corresponding code of body from the above from method body corresponding with above-mentioned interface class method
Outgoing interface additional information is extracted in annotating information, wherein above-mentioned interface essential information includes the letter such as parameter name and parameter type
Breath, above-mentioned interface additional information includes the information such as interface description information, interface type.Finally integrate above-mentioned interface essential information with
Above-mentioned interface additional information is added in corresponding interface essential information by interface additional information, to form above-mentioned first
Interface message.
In above-mentioned adding module, after obtaining first interface information corresponding with the source code of first item, into one
First interface information is added in preset interface document template by step, and generated according to the preset interface document template with
The corresponding above-mentioned first interface document of source code, wherein above-mentioned first interface information is by interface essential information and the additional letter of interface
Breath is integrally formed, and specifically may include the title for inputting parameter, type, the title of output parameter, output parameter for inputting parameter
Type and parameter annotation information etc., above-mentioned interface document template can be configured according to actual needs, not do specific limit herein
System.In the present embodiment, first interface information corresponding with interface in source code is parsed by reflection technology, so as to subsequent straight
It connects and first interface information is added in preset interface document, to automatically form the interface document of first item, ensure that
The consistency of one interface document and first interface information eliminates the movement of manual compiling interface document, has been effectively saved people
Power cost improves the formation efficiency of interface document, and the uniform format of the interface document generated, convenient for different exploit persons
Member is read.
Further, in one embodiment of the application, the generating means of above-mentioned interface document, comprising:
Receiving module, for receiving the first item information of user's input, wherein the first item information includes maven
Coordinate;
Search module, for according to the maven coordinate, from preset program development management tool hunt out with it is described
The corresponding first item of maven coordinate;
Generation module, for generating the instruction for obtaining the source code of the first item.
In the present embodiment, the source code of above-mentioned acquisition first item the step of before, further include obtaining first item
Process, specifically can include: the first item information of reception user input first, wherein the first item information includes that maven is sat
Mark, i.e. GroupId, ArtifactId and Version.Wherein, above-mentioned GroupID is the unique identifier of the project organization, real
Border corresponds to the structure of the packet of java, is the bibliographic structure of java in main catalogue, and citing ground GroupID defines which project belongs to
A group, if there is a company is mycom, as soon as having a project is myapp, then GroupId may be expressed as:
com.mycom.myapp;Above-mentioned ArtifactID is unique identifier of project, and practical respective items purpose title, is exactly item
The title of mesh root, ArtifactID define current maven project unique ID in the group, such as can be myapp-
Util, myapp-domain, myapp-web etc.;Above-mentioned Version specifies the current version of maven project.On obtaining
State first item information, i.e., after above-mentioned maven coordinate, can be hunted out from preset program development management tool with this first
The corresponding first item of project information, wherein above procedure development management tool is the warehouse maven, described in finally regeneration acquisition
The instruction of the source code of first item, to realize the acquisition to the source code of first item, so as to subsequent according in first item
Source code automatically generate corresponding first interface document.It may include wherein two to the acquisition modes of the source code of first item
Kind, it can be to directly download and store the first item, so that subsequent directly can obtain the first item from downloading content
Source code can also be directly to call out the first item from the warehouse maven after the above-mentioned warehouse maven hunts out first item
Source code.
Further, in one embodiment of the application, the generating means of above-mentioned interface document, comprising:
Uploading module, for for the first interface document establish it is corresponding first index, and will it is described first index with
And the first interface document is uploaded to preset document database, wherein the first interface document is the document database
Any one interface document in total interface document for including;
First judgment module, for judging whether that the document searching for receiving user's input instructs;
Second extraction module, if the document searching instruction for receiving user's input, extracts the document searching
Search key in instruction;
Second judgment module, for judging in the pre-stored index of the document database, if exist and described search
The corresponding index entry of keyword;
Second obtains module, for index entry corresponding with described search keyword if it exists, then obtains the index entry
Corresponding specified interface document;
First display module, for passing through specified interface document described in specified display page presentation.
In the present embodiment, a document database for memory interface document can be pre-created, generating above-mentioned the
After one interface document, which can be uploaded in this article profile database and be stored, and be subsequently generated
The interface documents of other projects can also be uploaded to this article profile database and stored so that the document database purchase has
The interface document of all items, can establish index further for the interface document of all items, and by interface document and corresponding
Index is uploaded to this article profile database together and is stored, with the interface text by the document database realizing for all items
The unified centralized management and inquiry of shelves.It, can be rapidly from document to which subsequent user is when needing to read first interface document
Above-mentioned first interface document is indexed out in the total interface document uploaded in database.In the present embodiment, above-mentioned the is being generated
After one interface document, corresponding first index is established for first interface document first, described first is indexed and described first
Interface document is uploaded to preset document database, wherein above-mentioned first interface document is the total interface that document database includes
Any one interface document in document.Then judge whether that the document for carrying search key for receiving user's input is searched
Suo Zhiling extracts the search key in above-mentioned document searching instruction, and sentence if receiving above-mentioned document searching instruction
It whether there is index entry corresponding with the search key in the pre-stored index of the above-mentioned document database that breaks, wherein above-mentioned search
Keyword and above-mentioned specified interface document have corresponding relationship, which may include certain in the specified interface document
Key word, and above-mentioned document database is that the total interface document uploaded establishes corresponding index.If there is with
The corresponding index entry of above-mentioned search key then obtains specified interface document corresponding with above-mentioned index entry, and is shown by specified
Show that the page shows above-mentioned specified interface document to above-mentioned user.In the present embodiment, user only needs to input and specified interface document
The corresponding document searching instruction for carrying search key, can match from the index of document database and close with the search
The corresponding index entry of keyword, to rapidly acquire specified interface document corresponding with the index entry.Pass through above-mentioned document
Database is advantageously implemented unified management and inquiry for interface document, realizes and manages to the centralization of all interface documents
Reason improves the convenience for searching interface document.
Further, in one embodiment of the application, above-mentioned first display module, comprising:
Creating unit, for creating various forms of display interfaces of specified quantity;
Receiving unit, the first display interface chosen from all display interfaces for receiving the user;
Display unit for first display interface to be determined as the specified display page, and passes through described first
Display interface shows the specified interface document.
In the present embodiment, the step of above by specified display page presentation specified interface document, specifically can include: first
Create specified quantity various forms of display interfaces, wherein above-mentioned specified quantity is set according to the actual situation, it is above-mentioned not
Display interface with form may particularly include but be not limited to text box form display interface, form display interface, code shape
Formula display interface and form web page display interface.Then the first display circle that user chooses from all display interfaces is received
Face, and first display interface is determined as the above-mentioned specified display page, and show to user by first display interface
Above-mentioned specified interface document, so that user consults the specified interface document.In the present embodiment, by being arranged for showing
A variety of various forms of display interfaces of interface document are used since various forms of display interfaces are applicable to different users
Family can select the first display interface for meeting self-demand from all display interfaces, i.e., specified display interface, and pass through
First display interface shows the specified interface document, effectively raises the readability of specified interface document, also improves
The usage experience of user, further, user can audit the specified interface document of displaying to realize connecing for generation
The accuracy judgement of mouth document, and the processing that can modify to the interface document.
Further, in one embodiment of the application, the generating means of above-mentioned interface document, comprising:
Third judgment module, the modification inputted in the specified display interface for judging whether to receive the user
Information;
Modified module, for being modified if so, modified according to the modification information to the specified interface document
Interface document afterwards;
Replacement module, for replacing the specified interface document using the modified interface document.
In the present embodiment, when user checks above-mentioned specified interface document by above-mentioned specified display interface, if it find that
The specified interface document is described the content of mistake or user needs to add or delete certain contents on specified interface document
When, it directly can be directed to the modification information of current specified interface document in above-mentioned specified display interface input, wherein above-mentioned repair
Converting to breath includes the work to API (Application Programming Interface, application programming interface) interface
Person, exploitation the date, method list, method function description, method parameter type and title, the description information of method parameter,
Method return the information such as the request path of Value Types and description information, the acceptable request type of method and method and method into
Row modification.Later, it is modified according to above-mentioned modification information to specified interface document, and obtains modified interface document, most
The specified interface document is replaced using modified interface document afterwards.In the present embodiment, specified interface document is checked in user
When, can modification information be inputted rapidly to realize to specified interface document in specified display interface according to their own needs
Content modification, to correct to specified interface document, and user's has been deferred to for the modification of specified interface document
Wish effectively increases the usage experience of user.
Further, in one embodiment of the application, the generating means of above-mentioned interface document, comprising:
4th judgment module, for judging whether the corresponding source code of the first interface document produces modification note
Record;
Third obtains module and obtains the finger of modified source code if producing modification record for the source code
Stationary interface information, and the specified interface information and the clean interface information of the pre-stored source code are compared, it obtains
To comparing result, wherein the clean interface information is the interface message of the source code before modification;
5th judgment module, for judging the specified interface information and the clean interface according to the comparing result
Information whether there is difference;
Update module, if being had differences for the specified interface information and the clean interface information, according to
The difference of specified interface information and the clean interface information is updated the first interface document.
In the present embodiment, after generating above-mentioned first interface document corresponding with the source code of first item, if inspection
It measures the corresponding source code of first interface document and produces modification record, such as developer repairs the source code
Change, and to the source code carry out modification the particular content of interface document can be impacted, then can according to developer for
The modification of the source code is to complete the synchronized update to first interface document, specific process can include: first determines whether above-mentioned the
Whether the corresponding source code of one interface document produces modification record, if the source code produces modification record, obtains modification
The specified interface information of source code afterwards, and by the specified interface information of above-mentioned modified source code and pre-stored source code
Clean interface information compare, obtain comparing result.Wherein above-mentioned clean interface information is connecing for the source code before modification
Message breath, and will do it storage processing after clean interface information generation, in addition above-mentioned comparing result may include specified connects
Message cease or specified interface information identical with clean interface information and clean interface information it is not identical, i.e., specified interface information and
Clean interface information has differences.Then according to above-mentioned comparing result, judge above-mentioned specified interface information and above-mentioned clean interface
Information whether there is difference, if the two has differences, according to the difference of specified interface information and clean interface information to the
One interface document is updated.The wherein difference of above-mentioned specified interface information and clean interface information can include: modified to connect
The specified interface information of mouth source code and the interface message of the interface source code before modification, i.e., above-mentioned clean interface information are compared,
New data are increased, old data is deleted or old data is substituted for new data, etc., in addition above-mentioned data are
Refer to the data for including in interface message, the i.e. type of input parameter, the title for inputting parameter, the type of output parameter, output ginseng
The data such as several title and parameter annotation information.Further, if specified interface information is not present with clean interface information
Difference is not then modified processing to the corresponding first interface document of clean interface information.In the present embodiment, when first item
After source code is modified by developer, first obtain source code it is modified after specified interface information, and detect modified
It whether there is difference between the specified interface information and clean interface information of source code, if it exists then according to the difference come to first
Interface document is updated, and the automatic synchronization for having effectively achieved the first interface document when source code changes updates, from
Without manual maintenance interface document, the workload of developer is reduced.In addition detect above-mentioned specified interface information with
The difference of clean interface information is only regenerated and is kept other parts constant the data changed, so that connecing
Mouth document need to only carry out modification by a small margin for above-mentioned difference, improve the speed of interface document synchronized update, decrease
The workload of interface document synchronized update.
Further, in one embodiment of the application, the generating means of above-mentioned interface document, further includes:
6th judgment module, for judging whether to receive the debugging request for specified interface of user's input,
Wherein the specified interface is the interface debugged, and the debugging request carries the required parameter of the specified interface;
Forwarding module, for the debugging request to be forwarded to the application example that the specified interface corresponds to technical routine,
To be handled by the application example the debugging request, and obtain corresponding with the required parameter of the specified interface
Output parameter;
Second display module, the output parameter returned for receiving the application example, and show the output ginseng
Number.
In the present embodiment, the generating means of above-mentioned interface document further include the debugging function having to interface, when receiving use
After the debugging request for specified interface of family input, which can be forwarded to specific items belonging to above-mentioned specified interface
Purpose application example, i.e. technical routine belonging to specified interface be currently running in Service Instance so that the Service Instance pair
The debugging request is handled and is obtained processing result, wherein above-mentioned specified interface is the interface debugged, above-mentioned tune
Examination request carries the required parameter of the specified interface, and the required parameter is the specified input parameter of user's filling, above-mentioned clothes
The processing result that pragmatic example obtains after handling the debugging request be output it is corresponding with specified input parameter specify it is defeated
Parameter out, citing ground, if the specified input parameter of user's filling is that (HyperText Transfer Protocol surpasses HTTP
Text transfer protocol) request type parameter parameter, then the specified output parameter handled be http protocol status code
Information;If specified input parameter is the parameter of non-HTTP request type parameter, specifying output parameter is corresponding return value
Description information.Later, it in the processing result for receiving above-mentioned application example return, i.e., after output parameter, will be shown to user
The processing result, to complete the debugging to interface, user can be compared according to obtained processing result with expected result, from
And whether the function of verifying the interface improves and whether service can be used.It can effectively realize for interface through this embodiment
Debugging function improves the development efficiency of interface.
Referring to Fig. 3, a kind of computer equipment is also provided in the embodiment of the present application, which can be server,
Its internal structure can be as shown in Figure 3.The computer equipment includes processor, the memory, network connected by system bus
Interface and database.Wherein, the processor of computer equipment design is for providing calculating and control ability.The computer equipment
Memory include non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system, computer
Program and database.The built-in storage provides ring for the operation of operating system and computer program in non-volatile memory medium
Border.The database of the computer equipment is for storing the data such as source code and the first interface information of first item.The calculating
The network interface of machine equipment is used to communicate with external terminal by network connection.When the computer program is executed by processor with
Realize a kind of generation method of interface document.
Above-mentioned processor executes the step of generation method of above-mentioned interface document:
Obtain the source code of first item;
The class method with interface flag is filtered out from all class methods of the source code, and described will have interface
The class method of label is denoted as interface class method;
Interface essential information is extracted from method body corresponding with the interface class method by reflection technology, and from institute
State extraction interface additional information in the corresponding code comments information of method body;
The interface essential information and the interface additional information are integrated, first interface information is formed, wherein described first
Interface message include at least the title of input parameter, input the type of parameter, the title of output parameter, the type of output parameter with
And parameter annotation information;
The first interface information is added in preset interface document template, according to the preset interface document mould
Plate generates first interface document corresponding with the first interface information.
In an embodiment, the step of the source code for obtaining first item before, comprising:
The first item information for receiving user's input, wherein the first item information includes maven coordinate;
According to the maven coordinate, hunted out from preset program development management tool corresponding with the maven coordinate
The first item;
Generate the instruction for obtaining the source code of the first item.
It is described that the first interface information is added in preset interface document template in an embodiment, according to described
After the step of preset interface document template generation corresponding with first interface information first interface document, comprising:
Corresponding first index is established for the first interface document, and described first is indexed and the first interface
Document is uploaded to preset document database, wherein the first interface document is the total interface that the document database includes
Any one interface document in document;
Judge whether that the document searching for receiving user's input instructs;
If receiving the document searching instruction of user's input, the search extracted in the document searching instruction is crucial
Word;
Judge in the pre-stored index of the document database, if there is index corresponding with described search keyword
?;
Index entry corresponding with described search keyword if it exists then obtains the corresponding specified interface text of the index entry
Shelves;
Pass through specified interface document described in specified display page presentation.
It is described to pass through specified the step of showing specified interface document described in page presentation in an embodiment, comprising:
Create various forms of display interfaces of specified quantity;
Receive the first display interface that the user chooses from all display interfaces;
First display interface is determined as the specified display page, and institute is shown by first display interface
State specified interface document.In an embodiment, the index entry corresponding with described search keyword if it exists then obtains the rope
Draw the corresponding specified interface document of item, and after the step of by specifying specified interface document described in display page presentation, comprising:
Judge whether to receive the modification information that the user inputs in the specified display interface;
If so, modifying according to the modification information to the specified interface document, modified interface document is obtained;
The specified interface document is replaced using the modified interface document.
It is described that the first interface information is added in preset interface document template in an embodiment, according to described
After the step of preset interface document template generation corresponding with first interface information first interface document, comprising:
Judge whether the corresponding source code of the first interface document produces modification record;
If the source code produces modification record, the specified interface information of modified source code is obtained, and by institute
It states specified interface information and the clean interface information of the pre-stored source code compares, obtain comparing result, wherein institute
State the interface message that clean interface information is the source code before modification;
According to the comparing result, judge the specified interface information and the clean interface information with the presence or absence of difference;
If the specified interface information has differences with the clean interface information, according to the specified interface information with
The difference of the clean interface information is updated the first interface document.
It is described that the first interface information is added in preset interface document template in an embodiment, according to described
After the step of preset interface document template generation corresponding with first interface information first interface document, comprising:
Judge whether to receive the debugging request for specified interface that the user inputs, wherein the specified interface is
The interface debugged, the debugging request carry the required parameter of the specified interface;
The debugging request is forwarded to the application example that the specified interface corresponds to technical routine, to pass through the application
Example handles the debugging request, and obtains output parameter corresponding with the required parameter of the specified interface;
The output parameter that the application example returns is received, and shows the output parameter.
It will be understood by those skilled in the art that structure shown in Fig. 3, only part relevant to application scheme is tied
The block diagram of structure does not constitute the restriction of the device, computer equipment that are applied thereon to application scheme.
One embodiment of the application also provides a kind of computer readable storage medium, is stored thereon with computer program, calculates
Machine program realizes a kind of generation method of interface document when being executed by processor, specifically:
Obtain the source code of first item;
The class method with interface flag is filtered out from all class methods of the source code, and described will have interface
The class method of label is denoted as interface class method;
Interface essential information is extracted from method body corresponding with the interface class method by reflection technology, and from institute
State extraction interface additional information in the corresponding code comments information of method body;
The interface essential information and the interface additional information are integrated, first interface information is formed, wherein described first
Interface message include at least the title of input parameter, input the type of parameter, the title of output parameter, the type of output parameter with
And parameter annotation information;
The first interface information is added in preset interface document template, according to the preset interface document mould
Plate generates first interface document corresponding with the first interface information.
In an embodiment, the step of the source code for obtaining first item before, comprising:
The first item information for receiving user's input, wherein the first item information includes maven coordinate;
According to the maven coordinate, hunted out from preset program development management tool corresponding with the maven coordinate
The first item;
Generate the instruction for obtaining the source code of the first item.
It is described that the first interface information is added in preset interface document template in an embodiment, according to described
After the step of preset interface document template generation corresponding with first interface information first interface document, comprising:
Corresponding first index is established for the first interface document, and described first is indexed and the first interface
Document is uploaded to preset document database, wherein the first interface document is the total interface that the document database includes
Any one interface document in document;
Judge whether that the document searching for receiving user's input instructs;
If receiving the document searching instruction of user's input, the search extracted in the document searching instruction is crucial
Word;
Judge in the pre-stored index of the document database, if there is index corresponding with described search keyword
?;
Index entry corresponding with described search keyword if it exists then obtains the corresponding specified interface text of the index entry
Shelves;
Pass through specified interface document described in specified display page presentation.
It is described to pass through specified the step of showing specified interface document described in page presentation in an embodiment, comprising:
Create various forms of display interfaces of specified quantity;
Receive the first display interface that the user chooses from all display interfaces;
First display interface is determined as the specified display page, and institute is shown by first display interface
State specified interface document.In an embodiment, the index entry corresponding with described search keyword if it exists then obtains the rope
Draw the corresponding specified interface document of item, and after the step of by specifying specified interface document described in display page presentation, comprising:
Judge whether to receive the modification information that the user inputs in the specified display interface;
If so, modifying according to the modification information to the specified interface document, modified interface document is obtained;
The specified interface document is replaced using the modified interface document.
It is described that the first interface information is added in preset interface document template in an embodiment, according to described
After the step of preset interface document template generation corresponding with first interface information first interface document, comprising:
Judge whether the corresponding source code of the first interface document produces modification record;
If the source code produces modification record, the specified interface information of modified source code is obtained, and by institute
It states specified interface information and the clean interface information of the pre-stored source code compares, obtain comparing result, wherein institute
State the interface message that clean interface information is the source code before modification;
According to the comparing result, judge the specified interface information and the clean interface information with the presence or absence of difference;
If the specified interface information has differences with the clean interface information, according to the specified interface information with
The difference of the clean interface information is updated the first interface document.
It is described that the first interface information is added in preset interface document template in an embodiment, according to described
After the step of preset interface document template generation corresponding with first interface information first interface document, comprising:
Judge whether to receive the debugging request for specified interface that the user inputs, wherein the specified interface is
The interface debugged, the debugging request carry the required parameter of the specified interface;
The debugging request is forwarded to the application example that the specified interface corresponds to technical routine, to pass through the application
Example handles the debugging request, and obtains output parameter corresponding with the required parameter of the specified interface;
The output parameter that the application example returns is received, and shows the output parameter.
In conclusion the generation method of the interface document provided in the embodiment of the present application, device, computer equipment and storage
Medium obtains the source code of first item;The class side with interface flag is filtered out from all class methods of the source code
Method, and the class method with interface flag is denoted as interface class method;By reflection technology from the interface class method
Interface essential information is extracted in corresponding method body, and extraction interface is attached from the method body corresponding code comments information
Add information;The interface essential information and the interface additional information are integrated, first interface information is formed, wherein described first connects
Message breath include at least the title of input parameter, input the type of parameter, the title of output parameter, the type of output parameter and
Parameter annotation information;The first interface information is added in preset interface document template, according to the preset interface
Document template generates first interface document corresponding with the first interface information.It can be automatically generated and first by the application
The corresponding first interface document of the source code of project, is not required to manual compiling, ensure that first interface document and first interface information
Consistency, the lattice for the interface document for being effectively saved human cost, having improved the formation efficiency of interface document, and generated
Formula is unified, reads convenient for different developers.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with
Relevant hardware is instructed to complete by computer program, the computer program can store and a non-volatile computer
In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein,
Any reference used in provided herein and embodiment to memory, storage, database or other media,
Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM
(PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include
Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM can by diversified forms
, such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double speed are according to rate SDRAM (SSRSDRAM), increasing
Strong type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM
(RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row
His property includes, so that the process, device, article or the method that include a series of elements not only include those elements, and
And further include the other elements being not explicitly listed, or further include for this process, device, article or method institute it is intrinsic
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do
There is also other identical elements in the process, device of element, article or method.
The foregoing is merely preferred embodiment of the present application, are not intended to limit the scope of the patents of the application, all utilizations
Equivalent structure or equivalent flow shift made by present specification and accompanying drawing content is applied directly or indirectly in other correlations
Technical field, similarly include in the scope of patent protection of the application.
Claims (10)
1. a kind of generation method of interface document characterized by comprising
Obtain the source code of first item;
The class method with interface flag is filtered out from all class methods of the source code, and described will have interface flag
Class method be denoted as interface class method;
Interface essential information is extracted from method body corresponding with the interface class method by reflection technology, and from the side
Interface additional information is extracted in the corresponding code comments information of body of laws;
The interface essential information and the interface additional information are integrated, first interface information is formed, wherein the first interface
Information includes at least the title of input parameter, inputs type, the title of output parameter, the type of output parameter and the ginseng of parameter
Number annotation information;
The first interface information is added in preset interface document template, it is raw according to the preset interface document template
At first interface document corresponding with the first interface information.
2. the generation method of interface document according to claim 1, which is characterized in that the source generation for obtaining first item
Before the step of code, comprising:
The first item information for receiving user's input, wherein the first item information includes maven coordinate;
According to the maven coordinate, hunted out from preset program development management tool corresponding with the maven coordinate described
First item;
Generate the instruction for obtaining the source code of the first item.
3. the generation method of interface document according to claim 1, which is characterized in that described by the first interface information
It is added in preset interface document template, according to the preset interface document template generation and the first interface information pair
After the step of first interface document answered, comprising:
Corresponding first index is established for the first interface document, and described first is indexed and the first interface document
It is uploaded to preset document database, wherein the first interface document is the total interface document that the document database includes
In any one interface document;
Judge whether that the document searching for receiving user's input instructs;
If receiving the document searching instruction of user's input, the search key in the document searching instruction is extracted;
Judge in the pre-stored index of the document database, if there is index entry corresponding with described search keyword;
Index entry corresponding with described search keyword if it exists then obtains the corresponding specified interface document of the index entry;
Pass through specified interface document described in specified display page presentation.
4. the generation method of interface document according to claim 3, which is characterized in that described to pass through specified display page exhibition
The step of showing the specified interface document, comprising:
Create various forms of display interfaces of specified quantity;
Receive the first display interface that the user chooses from all display interfaces;
First display interface is determined as the specified display page, and the finger is shown by first display interface
Stationary interface document.
5. the generation method of interface document according to claim 3, which is characterized in that described to pass through specified display page exhibition
After the step of showing the specified interface document, comprising:
Judge whether to receive the modification information that the user inputs in the specified display interface;
If so, modifying according to the modification information to the specified interface document, modified interface document is obtained;
The specified interface document is replaced using the modified interface document.
6. the generation method of interface document according to claim 1, which is characterized in that described by the first interface information
It is added in preset interface document template, according to the preset interface document template generation and the first interface information pair
After the step of first interface document answered, comprising:
Judge whether the corresponding source code of the first interface document produces modification record;
If the source code produces modification record, the specified interface information of modified source code is obtained, and by the finger
Stationary interface information and the clean interface information of the pre-stored source code compare, and comparing result are obtained, wherein the original
Beginning interface message is the interface message of the source code before modification;
According to the comparing result, judge the specified interface information and the clean interface information with the presence or absence of difference;
If the specified interface information has differences with the clean interface information, according to the specified interface information with it is described
The difference of clean interface information is updated the first interface document.
7. the generation method of interface document according to claim 1, which is characterized in that described by the first interface information
It is added in preset interface document template, according to the preset interface document template generation and the first interface information pair
After the step of first interface document answered, comprising:
Judge whether to receive the debugging request for specified interface that the user inputs, wherein the specified interface is to need
The interface debugged, the debugging request carry the required parameter of the specified interface;
The debugging request is forwarded to the application example that the specified interface corresponds to technical routine, to pass through the application example
The debugging request is handled, and obtains output parameter corresponding with the required parameter of the specified interface;
The output parameter that the application example returns is received, and shows the output parameter.
8. a kind of generating means of interface document characterized by comprising
First obtains module, for obtaining the source code of first item;
Screening module, for filtering out the class method with interface flag from all class methods of the source code, and by institute
It states the class method with interface flag and is denoted as interface class method;
First extraction module, it is basic for extracting interface from method body corresponding with the interface class method by reflection technology
Information, and interface additional information is extracted from the corresponding code comments information of the method body;
Module is integrated, for integrating the interface essential information and the interface additional information, forms first interface information, wherein
The first interface information includes at least the title of input parameter, inputs type, the title of output parameter, output parameter of parameter
Type and parameter annotation information;
Adding module, for the first interface information to be added in preset interface document template, according to described preset
Interface document template generation first interface document corresponding with the first interface information.
9. a kind of computer equipment, including memory and processor, it is stored with computer program in the memory, feature exists
In the step of processor realizes any one of claims 1 to 7 the method when executing the computer program.
10. a kind of storage medium, is stored thereon with computer program, which is characterized in that the computer program is held by processor
The step of method described in any one of claims 1 to 7 is realized when row.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910463199.4A CN110333850A (en) | 2019-05-30 | 2019-05-30 | Generation method, device, computer equipment and the storage medium of interface document |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910463199.4A CN110333850A (en) | 2019-05-30 | 2019-05-30 | Generation method, device, computer equipment and the storage medium of interface document |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110333850A true CN110333850A (en) | 2019-10-15 |
Family
ID=68141188
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910463199.4A Pending CN110333850A (en) | 2019-05-30 | 2019-05-30 | Generation method, device, computer equipment and the storage medium of interface document |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110333850A (en) |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110781189A (en) * | 2019-10-25 | 2020-02-11 | 北京达佳互联信息技术有限公司 | Document platform construction method and device, electronic equipment and storage medium |
CN111338637A (en) * | 2020-02-26 | 2020-06-26 | 腾讯科技(深圳)有限公司 | Code generation method and device |
CN111611173A (en) * | 2020-05-27 | 2020-09-01 | 中航信移动科技有限公司 | System and method applied to micro-service engineering interface document detection |
CN111796809A (en) * | 2020-06-29 | 2020-10-20 | 平安普惠企业管理有限公司 | Interface document generation method and device, electronic equipment and medium |
CN111984228A (en) * | 2020-07-09 | 2020-11-24 | 招联消费金融有限公司 | Interface document processing method and device, computer equipment and storage medium |
CN112230988A (en) * | 2020-10-16 | 2021-01-15 | 蜂助手股份有限公司 | Interface document generation method and device, computer equipment and storage medium |
CN112416430A (en) * | 2020-11-27 | 2021-02-26 | 亿企赢网络科技有限公司 | Interface document generation method, device, equipment and storage medium |
CN112486460A (en) * | 2020-11-30 | 2021-03-12 | 携程旅游信息技术(上海)有限公司 | Method, system, device and medium for automatically importing interface document |
CN113392070A (en) * | 2021-07-07 | 2021-09-14 | 百果园技术(新加坡)有限公司 | Online document management method, device, system, equipment and storage medium |
CN114327615A (en) * | 2022-03-09 | 2022-04-12 | 湖南云畅网络科技有限公司 | Interface document generation method and system based on big data |
CN114461298A (en) * | 2022-01-17 | 2022-05-10 | 中国银联股份有限公司 | Interface technology standard document generation method and system |
CN115146604A (en) * | 2022-07-01 | 2022-10-04 | 广州高专资讯科技有限公司 | Interface technology document generation method, device, equipment and storage medium |
CN115878125A (en) * | 2022-11-11 | 2023-03-31 | 盐城金堤科技有限公司 | Generation class extension method and device, storage medium and electronic equipment |
CN116894014A (en) * | 2023-09-08 | 2023-10-17 | 荣耀终端有限公司 | Cache updating method, server, terminal equipment and chip system |
CN117472367A (en) * | 2023-12-27 | 2024-01-30 | 中电数据产业有限公司 | Heterogeneous resource intelligent identification and access method, device, equipment and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103049271A (en) * | 2012-12-27 | 2013-04-17 | 微梦创科网络科技(中国)有限公司 | Method and device for automatically generating description document of API (application program interface) |
US8825708B1 (en) * | 2008-04-30 | 2014-09-02 | Netapp, Inc. | Program language binding generation for system interfaces |
CN107239271A (en) * | 2016-03-29 | 2017-10-10 | 滴滴(中国)科技有限公司 | Develop document structure tree method and device |
CN107885499A (en) * | 2017-10-19 | 2018-04-06 | 平安壹钱包电子商务有限公司 | A kind of interface document generation method and terminal device |
CN108932122A (en) * | 2018-06-19 | 2018-12-04 | 上海陆家嘴国际金融资产交易市场股份有限公司 | Interface document generation method, device, computer equipment and storage medium |
CN108959076A (en) * | 2018-06-25 | 2018-12-07 | 浙江网新恒天软件有限公司 | A kind of API on-line debugging method |
-
2019
- 2019-05-30 CN CN201910463199.4A patent/CN110333850A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8825708B1 (en) * | 2008-04-30 | 2014-09-02 | Netapp, Inc. | Program language binding generation for system interfaces |
CN103049271A (en) * | 2012-12-27 | 2013-04-17 | 微梦创科网络科技(中国)有限公司 | Method and device for automatically generating description document of API (application program interface) |
CN107239271A (en) * | 2016-03-29 | 2017-10-10 | 滴滴(中国)科技有限公司 | Develop document structure tree method and device |
CN107885499A (en) * | 2017-10-19 | 2018-04-06 | 平安壹钱包电子商务有限公司 | A kind of interface document generation method and terminal device |
CN108932122A (en) * | 2018-06-19 | 2018-12-04 | 上海陆家嘴国际金融资产交易市场股份有限公司 | Interface document generation method, device, computer equipment and storage medium |
CN108959076A (en) * | 2018-06-25 | 2018-12-07 | 浙江网新恒天软件有限公司 | A kind of API on-line debugging method |
Cited By (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110781189B (en) * | 2019-10-25 | 2022-08-26 | 北京达佳互联信息技术有限公司 | Document platform construction method and device, electronic equipment and storage medium |
CN110781189A (en) * | 2019-10-25 | 2020-02-11 | 北京达佳互联信息技术有限公司 | Document platform construction method and device, electronic equipment and storage medium |
CN111338637A (en) * | 2020-02-26 | 2020-06-26 | 腾讯科技(深圳)有限公司 | Code generation method and device |
CN111611173A (en) * | 2020-05-27 | 2020-09-01 | 中航信移动科技有限公司 | System and method applied to micro-service engineering interface document detection |
CN111796809A (en) * | 2020-06-29 | 2020-10-20 | 平安普惠企业管理有限公司 | Interface document generation method and device, electronic equipment and medium |
CN111984228A (en) * | 2020-07-09 | 2020-11-24 | 招联消费金融有限公司 | Interface document processing method and device, computer equipment and storage medium |
CN111984228B (en) * | 2020-07-09 | 2023-12-12 | 招联消费金融有限公司 | Interface document processing method and device, computer equipment and storage medium |
CN112230988A (en) * | 2020-10-16 | 2021-01-15 | 蜂助手股份有限公司 | Interface document generation method and device, computer equipment and storage medium |
CN112416430A (en) * | 2020-11-27 | 2021-02-26 | 亿企赢网络科技有限公司 | Interface document generation method, device, equipment and storage medium |
CN112486460A (en) * | 2020-11-30 | 2021-03-12 | 携程旅游信息技术(上海)有限公司 | Method, system, device and medium for automatically importing interface document |
CN113392070A (en) * | 2021-07-07 | 2021-09-14 | 百果园技术(新加坡)有限公司 | Online document management method, device, system, equipment and storage medium |
CN114461298A (en) * | 2022-01-17 | 2022-05-10 | 中国银联股份有限公司 | Interface technology standard document generation method and system |
CN114327615B (en) * | 2022-03-09 | 2022-06-28 | 湖南云畅网络科技有限公司 | Interface document generation method and system based on big data |
CN114327615A (en) * | 2022-03-09 | 2022-04-12 | 湖南云畅网络科技有限公司 | Interface document generation method and system based on big data |
CN115146604A (en) * | 2022-07-01 | 2022-10-04 | 广州高专资讯科技有限公司 | Interface technology document generation method, device, equipment and storage medium |
CN115878125A (en) * | 2022-11-11 | 2023-03-31 | 盐城金堤科技有限公司 | Generation class extension method and device, storage medium and electronic equipment |
CN115878125B (en) * | 2022-11-11 | 2024-02-06 | 盐城天眼察微科技有限公司 | Expansion method and device of generation class, storage medium and electronic equipment |
CN116894014A (en) * | 2023-09-08 | 2023-10-17 | 荣耀终端有限公司 | Cache updating method, server, terminal equipment and chip system |
CN116894014B (en) * | 2023-09-08 | 2024-02-27 | 荣耀终端有限公司 | Cache updating method, server, terminal equipment and chip system |
CN117472367A (en) * | 2023-12-27 | 2024-01-30 | 中电数据产业有限公司 | Heterogeneous resource intelligent identification and access method, device, equipment and storage medium |
CN117472367B (en) * | 2023-12-27 | 2024-03-26 | 中电数据产业有限公司 | Heterogeneous resource intelligent identification and access method, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110333850A (en) | Generation method, device, computer equipment and the storage medium of interface document | |
US10877736B2 (en) | Spreadsheet-based software application development | |
CN102426519B (en) | Linked data-based multiplexing method of business process execution language (BPEL) templates and services, and system thereof | |
CN110377336A (en) | Interface document generation method, device, computer equipment and storage medium | |
CN106528129A (en) | Web application interface generation system and method | |
JP2000148461A (en) | Software model and existing source code synchronizing method and device | |
CN101211336B (en) | Visualized system and method for generating inquiry file | |
CN107273122A (en) | Based on decoupling mechanism can iteration set up operation system method and its terminal | |
CN103383645A (en) | Code generation method and system | |
EP3718000A1 (en) | Spreadsheet-based software application development | |
CN107305527B (en) | Code file processing method and device | |
CN108762743A (en) | Data table operation code generation method and device | |
CN104461531B (en) | A kind of implementation method of reporting system SQL | |
US20110060712A1 (en) | Method and system for design check knowledge construction | |
CN109783065A (en) | Generate the method and system of dialog mode user interface | |
CN104994219A (en) | Data processing method and system | |
CN111581920A (en) | Document conversion method, device, equipment and computer storage medium | |
CN108984632A (en) | A kind of webpage setting method and device | |
CN109947399A (en) | Code structure generation method, device, computer installation and readable storage medium storing program for executing | |
CN108959095A (en) | Method based on XML Schema verifying XML document | |
CN108959475A (en) | A kind of webpage setting method and device | |
US20200012643A1 (en) | Method for managing and executing decoders and transformations using linked data and a service layer | |
CN109063059A (en) | User behaviors log processing method, device and electronic equipment | |
US20120185517A1 (en) | Method and system for converting ubl process diagrams to owl | |
CN104994220A (en) | Data processing method and system |
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 |