Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.

Commit 2e6eb3d

Browse files
committed
feat(markdown): Add the 'Example' field to the markdown document parameter
Change template ApiDoc.md and AllInOne.md,Add the 'Example' field to the markdown document parameter Closes #971
1 parent 42e8714 commit 2e6eb3d

File tree

2 files changed

+41
-32
lines changed

2 files changed

+41
-32
lines changed

src/main/resources/template/AllInOne.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,48 +44,53 @@ for(doc in api.list){
4444
**Content-Type:** ${doc.contentType}
4545

4646
**Description:** ${doc.detail}
47-
<%if(isNotEmpty(doc.headers)){%>
47+
<%if(isNotEmpty(doc.requestHeaders)){%>
4848

4949
**Request-headers:**
5050

51-
| Header | Type | Required | Description | Since |
52-
|--------|------|----------|-------------|-------|
53-
${doc.headers}
51+
| Header | Type | Required | Description | Since | Example |
52+
|--------|------|----------|-------------|-------|---------|
53+
<%
54+
for(param in doc.requestHeaders){
55+
%>
56+
|${param.name}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.since}|${param.value}|
5457
<%}%>
58+
<%}%>
59+
5560
<%if(isNotEmpty(doc.pathParams)){%>
5661

5762
**Path-parameters:**
5863

59-
| Parameter | Type | Required | Description | Since |
60-
|-----------|------|----------|-------------|-------|
64+
| Parameter | Type | Required | Description | Since | Example |
65+
|-----------|------|----------|-------------|-------|---------|
6166
<%
6267
for(param in doc.pathParams){
6368
%>
64-
|${param.field}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.version}|
69+
|${param.field}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.version}|${param.value}|
6570
<%}%>
6671
<%}%>
6772
<%if(isNotEmpty(doc.queryParams)){%>
6873

6974
**Query-parameters:**
7075

71-
| Parameter | Type | Required | Description | Since |
72-
|-----------|------|----------|-------------|-------|
76+
| Parameter | Type | Required | Description | Since | Example |
77+
|-----------|------|----------|-------------|-------|---------|
7378
<%
7479
for(param in doc.queryParams){
7580
%>
76-
|${param.field}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.version}|
81+
|${param.field}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.version}|${param.value}|
7782
<%}%>
7883
<%}%>
7984
<%if(isNotEmpty(doc.requestParams)){%>
8085

8186
**Body-parameters:**
8287

83-
| Parameter | Type | Required | Description | Since |
84-
|-----------|------|----------|-------------|-------|
88+
| Parameter | Type | Required | Description | Since | Example |
89+
|-----------|------|----------|-------------|-------|---------|
8590
<%
8691
for(param in doc.requestParams){
8792
%>
88-
|${param.field}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.version}|
93+
|${param.field}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.version}|${param.value}|
8994
<%}%>
9095
<%}%>
9196

@@ -98,12 +103,12 @@ ${doc.requestUsage}
98103
<%if(isNotEmpty(doc.responseParams)){%>
99104
**Response-fields:**
100105

101-
| Field | Type | Description | Since |
102-
|-------|------|-------------|-------|
106+
| Field | Type | Description | Since | Example |
107+
|-------|------|-------------|-------|---------|
103108
<%
104109
for(param in doc.responseParams){
105110
%>
106-
|${param.field}|${param.type}|${lineBreaksToBr(param.desc)}|${param.version}|
111+
|${param.field}|${param.type}|${lineBreaksToBr(param.desc)}|${param.version}|${param.value}|
107112
<%}%>
108113
<%}%>
109114

src/main/resources/template/ApiDoc.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,47 +21,51 @@ for(doc in list){
2121

2222
**Description:** ${doc.detail}
2323

24-
<%if(isNotEmpty(doc.headers)){%>
24+
<%if(isNotEmpty(doc.requestHeaders)){%>
2525
**Request-headers:**
2626

27-
| Header | Type | Required | Description | Since |
28-
|--------|------|----------|-------------|-------|
29-
${doc.headers}
27+
| Header | Type | Required | Description | Since | Example |
28+
|--------|------|----------|-------------|-------|---------|
29+
<%
30+
for(param in doc.requestHeaders){
31+
%>
32+
|${param.name}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.since}|${param.value}|
33+
<%}%>
3034
<%}%>
3135

3236
<%if(isNotEmpty(doc.pathParams)){%>
3337
**Path-parameters:**
3438

35-
| Parameter | Type | Required | Description | Since |
36-
|-----------|------|----------|-------------|-------|
39+
| Parameter | Type | Required | Description | Since | Example |
40+
|-----------|------|----------|-------------|-------|---------|
3741
<%
3842
for(param in doc.pathParams){
3943
%>
40-
|${param.field}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.version}|
44+
|${param.field}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.version}|${param.value}|
4145
<%}%>
4246
<%}%>
4347

4448
<%if(isNotEmpty(doc.queryParams)){%>
4549
**Query-parameters:**
4650

47-
| Parameter | Type | Required | Description | Since |
48-
|-----------|------|----------|-------------|-------|
51+
| Parameter | Type | Required | Description | Since | Example |
52+
|-----------|------|----------|-------------|-------|---------|
4953
<%
5054
for(param in doc.queryParams){
5155
%>
52-
|${param.field}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.version}|
56+
|${param.field}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.version}|${param.value}|
5357
<%}%>
5458
<%}%>
5559

5660
<%if(isNotEmpty(doc.requestParams)){%>
5761
**Body-parameters:**
5862

59-
| Parameter | Type | Required | Description | Since |
60-
|-----------|------|----------|-------------|-------|
63+
| Parameter | Type | Required | Description | Since | Example |
64+
|-----------|------|----------|-------------|-------|---------|
6165
<%
6266
for(param in doc.requestParams){
6367
%>
64-
|${param.field}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.version}|
68+
|${param.field}|${param.type}|${param.required}|${lineBreaksToBr(param.desc)}|${param.version}|${param.value}|
6569
<%}%>
6670
<%}%>
6771

@@ -75,12 +79,12 @@ ${doc.requestUsage}
7579

7680
**Response-fields:**
7781

78-
| Field | Type | Description | Since |
79-
|-------|------|-------------|-------|
82+
| Field | Type | Description | Since | Example |
83+
|-------|------|-------------|-------|---------|
8084
<%
8185
for(param in doc.responseParams){
8286
%>
83-
|${param.field}|${param.type}|${lineBreaksToBr(param.desc)}|${param.version}|
87+
|${param.field}|${param.type}|${lineBreaksToBr(param.desc)}|${param.version}|${param.value}|
8488
<%}%>
8589
<%}%>
8690

0 commit comments

Comments
 (0)