ApiFormatMd lightweight Java interface document generation tool
characteristic
- Execute Java code completely based on native code without reference to additional dependencies
- Generate MarkDown format documents. You can use ShowDoc to generate online documents
Configuration item
main.py
- Author = 'River fire is like a firefly' (corresponding to the author information of Md document)
- Load the class root directory root_path = r"/Users/xxx" (specify the root directory of the Java project, and the program uses this as the starting point to traverse the java files)
- Generate md file directory write_path = r"/Users/xxx/Desktop" (Md document write path)
param.txt
- Parameter param Txt (refer to the contents of the file for details of the controller layer interface information)
rely on
How to use
Method 1: generate files locally
- Install Python 3 environment locally
- clone the project to the local
- Modify main py ‘author’ ‘root_path’ 'write_path 'configuration (first use configuration)
- API information is written into param Txt file
- Execute Python 3 main If the PY terminal outputs' success', the execution is successful
Method 2: generate documents to showDoc
- Execute python3 request based on the configuration of mode 1_ show_ doc.py
- Open https://www.showdoc.com.cn/2040347871634336/ View document
- If an error is reported, ModuleNotFoundError: No module named 'requests', you need to import the request package and execute pip3 install requests
Method 3: write the utools plug-in to generate a document to showDoc with one click
- utools installs one-step plug-ins
- Create your own plug-in

- Copy the interface to utools to generate documents
- Copy interface

- Paste to utools

- Success prompt (the document address has been copied to the pasteboard)

- Browser open document

example
java interface
view code
@RequestMapping(value = "/v1/test/{userId}", method = RequestMethod.POST)
public JsonResult<List<Map<InvoiceVO.Extend, InvoiceVO>>> test(
@PathVariable(value = "userId") int userId,
@RequestParam(value = "roleCode", required = true) String roleCode,
@RequestBody QuoteStrategyRule quoteStrategyRule) {
return new JsonResult<>();
}
Quotestrategyrule (parameter)
package com.peng.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("quote_strategy_rule")
public class QuoteStrategyRule implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* Policy ID
*/
private Long quoteStrategyId;
/**
* Channel ID
*/
private Long resellerChannelId;
/**
* Category 1: life service; 2 hotel business; (3) air fare
*/
private Byte quoteStrategyCategory;
/**
* Reference ID, type 1 is 0; Type 2 is a large class enumeration value; Type 3 is a subclass enumeration value; Commodity ID of type 4; Type 5 is the specification ID; Type 6 is the specification ID
*/
private Byte type;
/**
* Type 1 is classification name; Type 2 is [category name > category name];
* Type 3 is [classification name > category name > sub category name];
* Type 4 is [classification name > commodity id]; Type 5 is [classification name > commodity id > specification id];
* Type 6 is [classification name > commodity ID > specification ID > start time ~ end time]
*/
private String name;
/**
* Reference ID, type 1 is 0; Type 2 is a large class enumeration value; Type 3 is a subclass enumeration value; Commodity ID of type 4; Type 5 is the specification ID; Type 6 is the specification ID
*/
private Long refId;
/**
* Effective time: when the type is 6, it has a value; otherwise, it is null. The format is yyyy MM DD HH: mm: SS
*/
private Date startDate;
/**
* Expiration time: if the type is 6, it has a value; otherwise, it is nu. The format is yyyy MM DD HH: mm: SS
*/
private Date endDate;
/**
* Mark up type 1 percentage 2 fixed amount
*/
private Byte priceType;
/**
* Markup percentage. When the markup type is 1, this field has a value
*/
private Integer rate;
/**
* Markup amount: when the markup type is 2, this field has a value
*/
private Integer amount;
/**
* Creation time:
*/
private Date createTime;
/**
* Update time:
*/
private Date updateTime;
/**
* Operator
*/
private String operator;
}
Invoicevo (return principal)
@Data
public class InvoiceVO extends Invoice {
//Invoice No. - sub
private Long invoiceNo;
//Invoice title - sub
private String invoiceTitle;
/**
* Invoice type - sub
*/
private InvoiceEnum invoiceEnum;
//Extended information
private ExtendSub extendSub;
@Data
public static class Extend {
//Title - parent
private String title;
//Content - parent
private String content;
}
@Data
public static class ExtendSub extends Extend {
//spu set - sub
private List<Spu> spuList;
//spu information - sub
private Spu spu;
/**
* spu Map-son
*/
private Map<String, Spu> spuMap;
//Channel enumeration
private SpecialChannelEnum specialChannelEnum;
}
}
Invoice (InvoiceVO parent class)
package com.peng.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
@JsonInclude(value = JsonInclude.Include.NON_NULL)//Fields that are NULL are not returned as (JSON)
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("trade_invoice")
public class Invoice implements Serializable {
@TableId(value = "invoice_id", type = IdType.AUTO)
private Long invoiceId;
/**
* Invoice header type 1: individual 2: Company
*/
private Byte invoiceTitleType;
/**
* Invoice type 1: domestic paper invoice 2: domestic electronic invoice 3: international electronic invoice
*/
private Byte invoiceType;
/**
* Personal name:
*/
private String name;
/**
* Unit name:
*/
private String companyName;
/**
* Invoice status 1: in process 2: invoiced
*/
private Byte status;
/**
* Taxpayer identification number
*/
private String taxRegisterNumber;
/**
* Invoice No.:
*/
private String invoiceCode;
/**
* Invoice amount
*/
private Long invoiceAmount;
/**
* Registered address:
*/
private String registerAddress;
/**
* Company registration telephone:
*/
private String registerPhone;
/**
* Bank of deposit
*/
private String bankName;
/**
* Bank card number
*/
private String bankNo;
/**
* Recipient name:
*/
private String contactName;
/**
* Recipient's mobile number
*/
private String contactPhone;
/**
* Addressee address:
*/
private String contactAddress;
/**
* Recipient mailbox
*/
private String contactEmail;
/**
* courier number
*/
private String expressNo;
/**
* Courier Services Company
*/
private String expressName;
/**
* Invoice electronic file address
*/
private String fileUrl;
/**
* Invoice electronic file address
*/
private String filePath;
/**
* Actual supplier id
*/
private Integer supplierId;
/**
* ownerId
*/
private Integer ownerId;
/**
* userId
*/
private Integer userId;
/**
* remarks
*/
private String remark;
/**
* Delete identity
*/
private Boolean yn;
/**
* Creation time:
*/
private Date createTime;
/**
* Update time:
*/
private Date updateTime;
/**
* Created by:
*/
private String createPin;
/**
* Updated by:
*/
private String updatePin;
}
Spu(InvoiceVO.ExtendSub dependency)
@Data
public class Spu implements Serializable {
private static final long serialVersionUID = 128833531741299945L;
/**
* Primary key ID
*/
private long id;
/**
* Commodity category
*/
private byte productType;
/**
* Commodity subcategory
*/
private int productSubType;
/**
* spu Chinese Name:
*/
private String nameCn;
/**
* spu English name
*/
private String nameEn;
/**
* poiId,According to poi_id order comma separated, eg: 1,3,12
*/
private String poiIds;
/****** Business field********/
/**
* name displayed after multilingual processing, added in v1.5.1
*/
private String name;
/**
* Created by:
*/
private String createPin;
/**
* Updated by:
*/
private String updatePin;
//"key": "collection"
private List<Key> keyList;
}
Key (Spu,Key dependent)
@Data
public class Key implements Serializable {
private static final long serialVersionUID = 7585869752216827433L;
private Integer pageSize;
/**
* Element category
*/
private byte type;
/**
* Element name
*/
private String name;
/****** Business field*******/
/**
* Feature name multilingual map
* Map<languageCode, value>
*/
private Map<String, String> names;
private List<Key> keyList;
}
Generate content
View content
Interface description
name | describe |
---|
function | I can't find my name. Use this |
person in charge | The river is like a firefly |
HTTP request address
- Address: http://domain//v1/test/{userId}
Request mode:
Parameter description
Request parameter description
Parameter name | type | Required | Example: | explain |
---|
roleCode | String | - | - | - |
quoteStrategyRule | QuoteStrategyRule | - | - | - |
userId | int | - | - | - |
Return parameter description
Parameter name | type | Example: | explain |
---|
code | String | "0" | Status code (non-0 is abnormal) |
message | String | Request succeeded | Information description |
data | JsonResult<List<Map<InvoiceVO.Extend,InvoiceVO>>> | - | - |
Supplementary entity description
QuoteStrategyRule
field | type | Required | explain | remarks |
---|
id | Long | - | - | - |
quoteStrategyId | Long | - | - | Policy ID |
resellerChannelId | Long | - | - | Channel ID |
quoteStrategyCategory | Byte | - | - | Category 1: life service; 2 hotel business; (3) air fare |
type | Byte | - | - | Reference ID, type 1 is 0; Type 2 is a large class enumeration value; Type 3 is a subclass enumeration value; Commodity ID of type 4; Type 5 is the specification ID; Type 6 is the specification ID |
name | String | - | - | Type 1 is classification name; Type 2 is [category name > category name];, Type 3 is [classification name > category name > sub category name];, Type 4 is [classification name > commodity id]; Type 5 is [classification name > commodity id > specification id];, Type 6 is [classification name > commodity id > specification id > start time ~ end time] |
refId | Long | - | - | Reference ID, type 1 is 0; Type 2 is a large class enumeration value; Type 3 is a subclass enumeration value; Commodity ID of type 4; Type 5 is the specification ID; Type 6 is the specification ID |
startDate | Date | - | - | Effective time: when the type is 6, it has a value; otherwise, it is null. The format is yyyy MM DD HH: mm: SS |
endDate | Date | - | - | Expiration time: if the type is 6, it has a value; otherwise, it is nu. The format is yyyy MM DD HH: mm: SS |
priceType | Byte | - | - | Mark up type 1 percentage 2 fixed amount |
rate | Integer | - | - | Markup percentage. When the markup type is 1, this field has a value |
amount | Integer | - | - | Markup amount: when the markup type is 2, this field has a value |
createTime | Date | - | - | Creation time: |
updateTime | Date | - | - | Update time: |
operator | String | - | - | Operator |
InvoiceVO
field | type | Required | explain | remarks |
---|
invoiceId | Long | - | - | - |
invoiceTitleType | Byte | - | - | Invoice header type 1: individual 2: Company |
invoiceType | Byte | - | - | Invoice type 1: domestic paper invoice 2: domestic electronic invoice 3: international electronic invoice |
name | String | - | - | Personal name: |
companyName | String | - | - | Unit name: |
status | Byte | - | - | Invoice status 1: in process 2: invoiced |
taxRegisterNumber | String | - | - | Taxpayer identification number |
invoiceCode | String | - | - | Invoice No.: |
invoiceAmount | Long | - | - | Invoice amount |
registerAddress | String | - | - | Registered address: |
registerPhone | String | - | - | Company registration telephone: |
bankName | String | - | - | Bank of deposit |
bankNo | String | - | - | Bank card number |
contactName | String | - | - | Recipient name: |
contactPhone | String | - | - | Recipient's mobile number |
contactAddress | String | - | - | Addressee address: |
contactEmail | String | - | - | Recipient mailbox |
expressNo | String | - | - | courier number |
expressName | String | - | - | Courier Services Company |
fileUrl | String | - | - | Invoice electronic file address |
filePath | String | - | - | Invoice electronic file address |
supplierId | Integer | - | - | Actual supplier id |
ownerId | Integer | - | - | ownerId |
userId | Integer | - | - | userId |
remark | String | - | - | remarks |
yn | Boolean | - | - | Delete identity |
createTime | Date | - | - | Creation time: |
updateTime | Date | - | - | Update time: |
createPin | String | - | - | Created by: |
updatePin | String | - | - | Updated by: |
invoiceNo | Long | - | - | Invoice No. - sub |
invoiceTitle | String | - | - | Invoice title - sub |
invoiceEnum | InvoiceEnum | - | - | Invoice type - sub |
extendSub | ExtendSub | - | - | Extended information |
JsonResult
field | type | Required | explain | remarks |
---|
code | Integer | - | - | No exception if code is "0" |
msg | String | - | - | msg |
data | T | - | - | data return body object |
Extend
field | type | Required | explain | remarks |
---|
title | String | - | - | Title - parent |
content | String | - | - | Content - parent |
InvoiceEnum
enum InvoiceEnum {
PERSON(1, "Head to individual"),
COMPANY(2, "Header is the unit"),
BEING(1, "Invoice status processing"),
COMPLETE(2, "Invoice status completed"),
PAPER(1, "Paper invoice"),
ELECTRONIC(2, "Electronic invoice");
ExtendSub
field | type | Required | explain | remarks |
---|
title | String | - | - | Title - parent |
content | String | - | - | Content - parent |
spuList | List<Spu> | - | - | spu set - sub |
spu | Spu | - | - | spu information - sub |
spuMap | Map<String,Spu> | - | - | spu Map sub |
specialChannelEnum | SpecialChannelEnum | - | - | Channel enumeration |
Spu
field | type | Required | explain | remarks |
---|
id | long | - | - | Primary key ID |
productType | byte | - | - | Commodity category |
productSubType | int | - | - | Commodity subcategory |
nameCn | String | - | - | spu Chinese name |
nameEn | String | - | - | spu English name |
poiIds | String | - | - | poiId, according to poi_id order comma separated, eg: 1,3,12 |
name | String | - | - | Business field, name displayed after multilingual processing, added in v1.5.1 |
createPin | String | - | - | Created by: |
updatePin | String | - | - | Updated by: |
keyList | List<Key> | - | - | "key": "collection" |
SpecialChannelEnum
enum SpecialChannelEnum implements CommonEnum{
DEFAULT("DEFAULT", "Default channel"),
SASS("SASS", "SASS platform"),
UNKNOWN("UNKNOWN", "UNKNOWN"),
;
Key
field | type | Required | explain | remarks |
---|
pageSize | Integer | - | - | - |
type | byte | - | - | Element category |
name | String | - | - | Element name |
names | Map<String,String> | - | - | Business field, element name multilingual map, map < languagecode, value > |
keyList | List<Key> | - | - | - |