Commit 8208ecbc authored by duanledexianxianxian's avatar duanledexianxianxian 😁

生成markdown api文档

parent a5e6d864
......@@ -94,7 +94,7 @@ public abstract class TypeDescription {
condition.append("required=").append(required);
}
return Lists.newArrayList(new Row(key, type, condition.toString(), def, remark));
return Lists.newArrayList(new Row(key, type,false, condition.toString(), def, remark));
}
}
......@@ -23,16 +23,20 @@ public class Row {
* The Type.
*/
String type;
/**
* 是否必填.
*/
Boolean required;
/**
* The Condition.
*/
String condition;
/**
* The Def.
* 默认值.
*/
String def;
/**
* The Remark.
* 说明.
*/
String remark;
......
......@@ -12,24 +12,25 @@
# ${bookValue.name}
</#if>
<#-- ---------- BEGIN 循环遍历chapter ---------->
<#list bookValue.chapters>
<#items as chapter>
<#assign chapterIndex=0>
<#list bookValue.chapters as chapter>
<#if !chapter.isIgnore()>
<#assign chapterIndex++>
<#-- 章节名称-->
## ${chapter?counter}. ${chapter.name}
## ${chapterIndex}. ${chapter.name}
<#-- 章节描述-->
<#if chapter.description??>
${chapter.description}
</#if>
<#-- ---------- BEGIN 循环遍历section ---------->
<#list chapter.sections>
<#items as section>
<#assign sectionIndex=0>
<#list chapter.sections as section>
<#if !section.isIgnore()>
<#assign sectionIndex++/>
<#-- 接口名称-->
### ${chapter?counter}.${section?counter} ${section.name}
### ${chapterIndex}.${sectionIndex} ${section.name}
<#-- 接口描述-->
<#if section.description??>
......@@ -56,10 +57,10 @@ ${section.getParameterString()}
<#if section.requestRows?? && (section.requestRows?size>0)>
**Query**
| Field | Type | Condition | Default | Description |
| :------- | :----- | :-------- | :------ | :---------- |
| Field | Type | Required | Condition | Default | Description |
| :------- | :----- | :-------- |:-------- | :------ | :---------- |
<#list section.requestRows as rowKey,rowValue>
| ${rowValue.key!''} | ${rowValue.type!''} | ${rowValue.condition!''} | ${rowValue.def!''} | ${rowValue.remark!''} |
| ${rowValue.key!''} | ${rowValue.type!''} | ${rowValue.required?string('true','false')} | ${rowValue.condition!''} | ${rowValue.def!''} | ${rowValue.remark!''} |
</#list>
</#if>
<#-- 响应-->
......@@ -78,10 +79,10 @@ ${section.getResponseString()}
| ${rowValue.key!''} | ${rowValue.type!''} | ${rowValue.remark!''} |
</#list>
</#if>
</#items>
</#if>
</#list>
<#------------ END 循环遍历section ---------->
</#items>
</#if>
</#list>
<#------------ END 循环遍历chapter ---------->
</#list>
......
......@@ -159,6 +159,8 @@ public class SpringParser implements ParserStrategy {
Row row = new Row();
row.setKey(parameter.getNameAsString());
row.setType(parameter.getType().toString());
// 路径参数必填
row.setRequired(true);
section.getParamTag(row.getKey()).ifPresent(tag -> row.setRemark(tag.getContent()));
section.addRequestRow(row);
}
......
......@@ -10,17 +10,35 @@ import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* The type User.
*/
@Setter
@Getter
public class User {
/**
* 用户编号.
*/
int id;
/**
* 用户名称.
*/
@NotBlank
String name;
/**
* 用户年龄.
*/
@Min(1)
@NotNull
Integer age;
/**
* 创建时间.
*/
Date createAt;
/**
* 性别.
*/
@NotBlank
@JsonProperty("Sex")
String sex;
......
......@@ -6,6 +6,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
/**
* @ignore
* @index 3
*/
@Controller
......
......@@ -4,6 +4,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ignore
* will be ignore
*/
@RestController
......
......@@ -14,6 +14,7 @@ import java.util.List;
import java.util.Map;
/**
* @ignore
* @index 4
*/
@Controller
......
......@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @ignore
* 用户模块(标题)
* 用户示例模块文字描述(详情)
* 支持多行文字
......
......@@ -8,7 +8,7 @@ import java.util.concurrent.atomic.AtomicLong;
/**
* 欢迎使用Apiggs
*
* @ignore
* @author fengyuchenglun
* @version 1.0.0
* @index 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment