@jayfong/x-server 2.94.1 → 2.95.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -129,9 +129,13 @@ class ApiGenerator {
|
|
|
129
129
|
});
|
|
130
130
|
const requestDataJsonSchema = this.apiDataToJsonSchema(requestData);
|
|
131
131
|
const responseDataJsonSchema = this.apiDataToJsonSchema(responseData);
|
|
132
|
+
const handlerDescriptionDividerIndex = handlerDescription.indexOf('\n\n');
|
|
133
|
+
const apiName = handlerDescriptionDividerIndex === -1 ? handlerDescription : handlerDescription.substring(0, handlerDescriptionDividerIndex);
|
|
134
|
+
const apiDesc = handlerDescriptionDividerIndex === -1 ? '' : handlerDescription.substring(handlerDescriptionDividerIndex + 2);
|
|
132
135
|
apiData.push({
|
|
133
136
|
category: handlerCategory,
|
|
134
|
-
name:
|
|
137
|
+
name: apiName,
|
|
138
|
+
desc: apiDesc,
|
|
135
139
|
path: handlerUrl,
|
|
136
140
|
handlerMethod: handlerMethod,
|
|
137
141
|
method: httpMethod,
|
|
@@ -311,6 +315,7 @@ class ApiGenerator {
|
|
|
311
315
|
data[handle.category].push(handle.handlerMethod === 'GET' ? {
|
|
312
316
|
method: handle.method.toUpperCase(),
|
|
313
317
|
title: handle.name,
|
|
318
|
+
markdown: handle.desc,
|
|
314
319
|
path: path,
|
|
315
320
|
res_body_type: 'json',
|
|
316
321
|
req_body_is_json_schema: false,
|
|
@@ -328,6 +333,7 @@ class ApiGenerator {
|
|
|
328
333
|
} : handle.handlerMethod === 'FILE' ? {
|
|
329
334
|
method: handle.method.toUpperCase(),
|
|
330
335
|
title: handle.name,
|
|
336
|
+
markdown: handle.desc,
|
|
331
337
|
path: path,
|
|
332
338
|
req_body_type: 'form',
|
|
333
339
|
res_body_type: 'json',
|
|
@@ -346,6 +352,7 @@ class ApiGenerator {
|
|
|
346
352
|
} : {
|
|
347
353
|
method: handle.method.toUpperCase(),
|
|
348
354
|
title: handle.name,
|
|
355
|
+
markdown: handle.desc,
|
|
349
356
|
path: path,
|
|
350
357
|
req_body_type: 'json',
|
|
351
358
|
res_body_type: 'json',
|
|
@@ -388,6 +395,7 @@ class ApiGenerator {
|
|
|
388
395
|
[handle.method.toLowerCase()]: {
|
|
389
396
|
tags: [handle.category],
|
|
390
397
|
summary: handle.name,
|
|
398
|
+
description: handle.desc,
|
|
391
399
|
requestBody: {
|
|
392
400
|
content: {
|
|
393
401
|
'application/json': {
|
package/lib/cli/api_generator.js
CHANGED
|
@@ -124,9 +124,13 @@ export class ApiGenerator {
|
|
|
124
124
|
});
|
|
125
125
|
const requestDataJsonSchema = this.apiDataToJsonSchema(requestData);
|
|
126
126
|
const responseDataJsonSchema = this.apiDataToJsonSchema(responseData);
|
|
127
|
+
const handlerDescriptionDividerIndex = handlerDescription.indexOf('\n\n');
|
|
128
|
+
const apiName = handlerDescriptionDividerIndex === -1 ? handlerDescription : handlerDescription.substring(0, handlerDescriptionDividerIndex);
|
|
129
|
+
const apiDesc = handlerDescriptionDividerIndex === -1 ? '' : handlerDescription.substring(handlerDescriptionDividerIndex + 2);
|
|
127
130
|
apiData.push({
|
|
128
131
|
category: handlerCategory,
|
|
129
|
-
name:
|
|
132
|
+
name: apiName,
|
|
133
|
+
desc: apiDesc,
|
|
130
134
|
path: handlerUrl,
|
|
131
135
|
handlerMethod: handlerMethod,
|
|
132
136
|
method: httpMethod,
|
|
@@ -306,6 +310,7 @@ export class ApiGenerator {
|
|
|
306
310
|
data[handle.category].push(handle.handlerMethod === 'GET' ? {
|
|
307
311
|
method: handle.method.toUpperCase(),
|
|
308
312
|
title: handle.name,
|
|
313
|
+
markdown: handle.desc,
|
|
309
314
|
path: path,
|
|
310
315
|
res_body_type: 'json',
|
|
311
316
|
req_body_is_json_schema: false,
|
|
@@ -323,6 +328,7 @@ export class ApiGenerator {
|
|
|
323
328
|
} : handle.handlerMethod === 'FILE' ? {
|
|
324
329
|
method: handle.method.toUpperCase(),
|
|
325
330
|
title: handle.name,
|
|
331
|
+
markdown: handle.desc,
|
|
326
332
|
path: path,
|
|
327
333
|
req_body_type: 'form',
|
|
328
334
|
res_body_type: 'json',
|
|
@@ -341,6 +347,7 @@ export class ApiGenerator {
|
|
|
341
347
|
} : {
|
|
342
348
|
method: handle.method.toUpperCase(),
|
|
343
349
|
title: handle.name,
|
|
350
|
+
markdown: handle.desc,
|
|
344
351
|
path: path,
|
|
345
352
|
req_body_type: 'json',
|
|
346
353
|
res_body_type: 'json',
|
|
@@ -383,6 +390,7 @@ export class ApiGenerator {
|
|
|
383
390
|
[handle.method.toLowerCase()]: {
|
|
384
391
|
tags: [handle.category],
|
|
385
392
|
summary: handle.name,
|
|
393
|
+
description: handle.desc,
|
|
386
394
|
requestBody: {
|
|
387
395
|
content: {
|
|
388
396
|
'application/json': {
|