CN109683886A - A kind of diversification interface document generation method - Google Patents
A kind of diversification interface document generation method Download PDFInfo
- Publication number
- CN109683886A CN109683886A CN201811433944.2A CN201811433944A CN109683886A CN 109683886 A CN109683886 A CN 109683886A CN 201811433944 A CN201811433944 A CN 201811433944A CN 109683886 A CN109683886 A CN 109683886A
- Authority
- CN
- China
- Prior art keywords
- interface
- class
- interface document
- document
- annotation
- 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.)
- Withdrawn
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/35—Creation or generation of source code model driven
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
Abstract
The present invention relates to Java server-side development technique field, especially a kind of diversification interface document generation method.The present invention first has to that@ApiDoc annotation is added on module Controller class head, for by interface class, then@ApiOperation is added in connection inlet method there, interface IP address is then set, name, description, permission, enters to join class, go out ginseng class and the head header class, when final race starts, can automatically scanning institute generation interface document in need method, and generate the interface document of customization.The present invention solves interface document and follows code implementation stationary problem;Allow developer, tester and operation maintenance personnel that can apparent, more accurately understand the interface document that system automatically generated comes out.
Description
Technical field
The present invention relates to Java server-side development technique field, especially a kind of diversification interface document generation method.
Background technique
Present application system is more and more huger, and system reparation and renewal frequency are more and more;Editor's frequency of interface document
Rate is also higher and higher;Can so following problems be brought:
First is that there is interface document and the asynchronous problem of backstage code.
Second is that interface document is consulted difficult without classification.
Third is that multilayer parameter can not be shown.
Fourth is that interface document format is single.
It is easier in order to save exploitation, testing time and operation maintenance personnel management interface;Need a kind of diversification interface
Document structure tree method copes with huger operation system so as to efficiently and conveniently develop.
Summary of the invention
Present invention solves the technical problem that being to provide a kind of diversification interface document generation method;Solve back office interface text
Shelves problem of management.
The technical solution that the present invention solves above-mentioned technical problem is:
The method includes the following steps:
Step 1: ApiDoc annotation being added on interface class head based on SpringMvc, such needs is marked to be sent out by scanner
It is existing;
Step 2 :@ApiOperation annotation is added, on the Api method for needing to add interface document for marking this
Method needs to be added on interface document;
Step 3: it is corresponding that the address interface URL, the title of interface document, interface are write on@ApiOperation annotation
Rights markings, description specify into ginseng class, go out the ginseng class and head header class, these attributes, which all allow, scanner typing and to be opened up
Show on interface document;
Step 4: in project initiation method, ApiLogUtil call method is added, starts in scan item with annotation
The class and method of label;
Step 5: edited based on JavaPOI word document generate come format, the pattern of custom interface document;
Step 6: project initiation generates interface document.
The@ApiDoc is the annotation for distinguishing interface classification, each@ApiDoc can be set corresponding Key and
Name, identical Key correspond to the same classification, to distinguish different classes of interface method.
When the starting class of the scanner is used to project initiation, start scan interface annotation.
The method supports the feature of multilayer customized parameter, is based on recursive traversal mode, first traverses all categories of parameter class
Property, if attribute value is not type of foundation, the attribute in the object is continued to traverse, until traversing type of foundation;
And all put the attribute that traversal comes out into parameter queue.
It is described to enter to join class, go out ginseng class and header class, attribute name, type in custom parameter class, whether can be
Empty and request example.
In the method, the word exemplary format of generation is edited, the interface text of different patterns can be customized according to demand
Shelves.
The present invention realizes that interface document diversification generates by Java annotation and recursive traversal mode, can support more
The interface document of different scenes exports, to also realize interface authority control.The present invention not only solves interface document and follows generation
Code implements stationary problem, has also broken the single method for generating interface document of industry, has had the effect that
1. classification displaying can be carried out to interface according to different function.
2. supporting the interface document template for customizing different-format according to customer demand.
3. supporting multilayer customized parameter class, the attribute of nested parameter class can be shown in further detail.
4. supporting interface header parameter class generates, industry is temporarily without the program at present.
5. supporting permission control, make developer very clear to interface authority.
6. restful interface document is supported to generate.
Allow developer, tester and operation maintenance personnel can be apparent, more accurately understand system automatically generated and go out
The interface document come.
Detailed description of the invention
The following further describes the present invention with reference to the drawings:
Fig. 1 is the method for the present invention flow chart.
Specific embodiment
As shown in Figure 1, process of the invention is as follows:
Step 1: ApiDoc annotation being added on interface class head based on SpringMvc, such needs is marked to be sent out by scanner
It is existing.
Step 2 :@ApiOperation annotation is added, on the Api method for needing to add interface document for marking this
Method needs to be added on interface document.
Step 3: it is corresponding that the address interface URL, the title of interface document, interface are write on@ApiOperation annotation
Rights markings describe, specify into ginseng class, go out the ginseng class and head header class, these attributes can allow scanner typing simultaneously
And it is shown on interface document.
Step 4: in project initiation method, ApiLogUtil call method is added, starts in scan item with annotation
The class and method of label.
Step 5: edited based on JavaPOI word document generate come format, the pattern of custom interface document.
Step 6: project initiation generates interface document.
The present invention can classify total interface according to interface class, and custom formats is supported to generate interface document, support power
Limit control, supports multilayer customized parameter class, and restful interface document is supported to generate.
@ApiDoc is the annotation for distinguishing interface classification, and corresponding Key and name can be set in each@ApiDoc,
Identical Key corresponds to the same classification, to distinguish different classes of interface method;
@ApiOperation in order to make interface document high-visible, but is not desired to again for configuring interface association attributes
Original service code is changed, the present invention can refer in ApiOperation annotation to be incorporated into ginseng class, goes out ginseng class and header head
Category, so that reaching interface document code does not interfere with background function;
Restful is a kind of Api interface protocol, and the present invention supports specified body parameter class, URL parameter class and requesting party
Method etc. can support a variety of request of data agreements simultaneously;
When scanner starting class is for project initiation, start the method for scan interface annotation;
The present invention supports the feature of multilayer customized parameter, is based on recursive traversal mode, first traverses parameter class all properties, such as
It if fruit attribute value is not type of foundation, will continue to continue to traverse by the attribute in the object, be until traversing type of foundation
Only, and by the attribute that traversal comes out parameter queue is all put into, this is that do not have in current industry.
The discrepancy parameter class and header class write, be can in custom parameter class attribute name, type, whether may be used
For empty and request example, document can be allowed to be more clear, will not invade inside business logic codes to project, not influence original
Function.Editor's word document generates class, is that editor generates the word exemplary format come, can be fixed according to customer demand
Make the interface document of different patterns.
In addition, scanner code of the present invention is as follows:
Claims (6)
1. a kind of diversification interface document generation method, it is characterised in that: the method includes the following steps:
Step 1: ApiDoc annotation being added on interface class head based on SpringMvc, such needs is marked to be found by scanner;
Step 2 :@ApiOperation annotation is added, on the Api method for needing to add interface document for marking this method
It needs to be added on interface document;
Step 3: the address interface URL, the title of interface document, the corresponding permission of interface are write on@ApiOperation annotation
Label, description specify into ginseng class, go out the ginseng class and head header class, these attributes, which all allow, scanner typing and to be shown to
On interface document;
Step 4: in project initiation method, ApiLogUtil call method is added, starts to have comment token in scan item
Class and method;
Step 5: edited based on JavaPOI word document generate come format, the pattern of custom interface document;
Step 6: project initiation generates interface document.
2. according to the method described in claim 1, it is characterized by:
The@ApiDoc is the annotation for distinguishing interface classification, and corresponding Key and name can be set in each@ApiDoc,
Identical Key corresponds to the same classification, to distinguish different classes of interface method.
3. according to the method described in claim 1, it is characterized by:
When the starting class of the scanner is used to project initiation, start scan interface annotation.
4. according to the method described in claim 1, it is characterized by: the method supports the feature of multilayer customized parameter, base
In recursive traversal mode, parameter class all properties are first traversed, if attribute value is not type of foundation, by the attribute in the object
Continue to traverse, until traversing type of foundation;And all put the attribute that traversal comes out into parameter queue.
5. according to the method described in claim 1, it is characterized by:
It is described to enter to join class, go out ginseng class and header class, attribute name, type in custom parameter class, whether can be empty and
Request example.
6. according to the method described in claim 1, it is characterized by: edit the word exemplary format of generation in the method,
The interface document of different patterns can be customized according to demand.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811433944.2A CN109683886A (en) | 2018-11-28 | 2018-11-28 | A kind of diversification interface document generation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811433944.2A CN109683886A (en) | 2018-11-28 | 2018-11-28 | A kind of diversification interface document generation method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109683886A true CN109683886A (en) | 2019-04-26 |
Family
ID=66185080
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811433944.2A Withdrawn CN109683886A (en) | 2018-11-28 | 2018-11-28 | A kind of diversification interface document generation method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109683886A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111414194A (en) * | 2020-03-19 | 2020-07-14 | 政采云有限公司 | Interface information generation method and system, electronic equipment and storage medium |
CN111767070A (en) * | 2020-06-30 | 2020-10-13 | 中国平安财产保险股份有限公司 | API document management method and device, computer equipment and storage medium |
CN112764723A (en) * | 2021-01-21 | 2021-05-07 | 奇秦科技(北京)股份有限公司 | System and method for non-intrusively modifying standard product service based on Spring |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103473045A (en) * | 2013-08-27 | 2013-12-25 | 广州华多网络科技有限公司 | Method and device for generating interface documents |
US20150058831A1 (en) * | 2013-08-22 | 2015-02-26 | Peter Warren | Web application development platform with relationship modeling |
CN107301137A (en) * | 2017-07-04 | 2017-10-27 | 福建中金在线信息科技有限公司 | RSET interface realizing methods and device and electronic equipment and computer-readable recording medium |
-
2018
- 2018-11-28 CN CN201811433944.2A patent/CN109683886A/en not_active Withdrawn
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150058831A1 (en) * | 2013-08-22 | 2015-02-26 | Peter Warren | Web application development platform with relationship modeling |
CN103473045A (en) * | 2013-08-27 | 2013-12-25 | 广州华多网络科技有限公司 | Method and device for generating interface documents |
CN107301137A (en) * | 2017-07-04 | 2017-10-27 | 福建中金在线信息科技有限公司 | RSET interface realizing methods and device and electronic equipment and computer-readable recording medium |
Non-Patent Citations (1)
Title |
---|
LIUFEI198613: "springmvc集成swagger实现接口文档自动化生成", 《HTTPS://BLOG.CSDN.NET/LIUFEI198613/ARTICLE/DETAILS/51801908》 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111414194A (en) * | 2020-03-19 | 2020-07-14 | 政采云有限公司 | Interface information generation method and system, electronic equipment and storage medium |
CN111414194B (en) * | 2020-03-19 | 2023-08-11 | 政采云有限公司 | Interface information generation method, system, electronic equipment and storage medium |
CN111767070A (en) * | 2020-06-30 | 2020-10-13 | 中国平安财产保险股份有限公司 | API document management method and device, computer equipment and storage medium |
CN112764723A (en) * | 2021-01-21 | 2021-05-07 | 奇秦科技(北京)股份有限公司 | System and method for non-intrusively modifying standard product service based on Spring |
CN112764723B (en) * | 2021-01-21 | 2021-09-17 | 奇秦科技(北京)股份有限公司 | System and method for non-intrusively modifying standard product service based on Spring |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103778107B (en) | Method and platform for quickly and dynamically generating form based on EXCEL | |
KR100866076B1 (en) | Method and device for management of tree data exchange | |
CN109683886A (en) | A kind of diversification interface document generation method | |
Kehrer et al. | Understanding model evolution through semantically lifting model differences with SiLift | |
JP4861389B2 (en) | Web document editing method and apparatus | |
CN1808377A (en) | Application-generic sequence diagram generator driven by a non-proprietary language | |
US20100293027A1 (en) | Workflow engine for media production and distribution | |
US9229920B1 (en) | Compound undo/redo manager for mixed model edits | |
CN108762743A (en) | Data table operation code generation method and device | |
US7093264B2 (en) | Method and apparatus for assembling Enterprise JavaBeans components | |
JP5609448B2 (en) | Method and structure for substantially automated device capability file generation using XML schema | |
CN110297671A (en) | Client plug-in implementation method, device, computer equipment and storage medium | |
CN104268163B (en) | A kind of realization method and system of webmaster network element configuration interface | |
CN108984632A (en) | A kind of webpage setting method and device | |
JP2008052603A (en) | Table editing device and table editing method | |
CN101923463B (en) | Information processing apparatus and method | |
CN112199373A (en) | Form development method and system | |
CN108920561A (en) | A kind of webpage setting method and device | |
CN111090978B (en) | Document processing method and device and storage medium | |
JP4717592B2 (en) | Document management system, control method and program for document management client | |
CN113822025A (en) | Office file automatic generation method, device, equipment and storage medium | |
CN105808595A (en) | Database generation method and device of specification file | |
JP2012150740A (en) | Program generating device and method | |
CN109510812A (en) | Smart electronics job instruction billboard management system and method | |
CN110221827A (en) | Data processing method and relevant apparatus |
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 | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20190426 |
|
WW01 | Invention patent application withdrawn after publication |