Browse Source

v1.1.3: swagger schema update

CrazyDoctor 1 month ago
parent
commit
23012a0d59

+ 4 - 0
dist/base/swagger/SwaggerDoc.js

@@ -99,6 +99,10 @@ class SwaggerDoc {
         let res = '';
         let res = '';
         const indent = ' *' + this.repeatStr('\t', level + 1);
         const indent = ' *' + this.repeatStr('\t', level + 1);
         res += indent + `type: ${schema.type}\n`;
         res += indent + `type: ${schema.type}\n`;
+        if (schema.description)
+            res += indent + `description: ${schema.description}\n`;
+        if (schema.example)
+            res += indent + `example: ${schema.example}\n`;
         if (schema.items && schema.items.length > 0) {
         if (schema.items && schema.items.length > 0) {
             res += indent + 'items:\n';
             res += indent + 'items:\n';
             for (const item of schema.items) {
             for (const item of schema.items) {

File diff suppressed because it is too large
+ 0 - 0
dist/base/swagger/SwaggerDoc.js.map


+ 2 - 0
dist/base/swagger/SwaggerSchemaType.d.ts

@@ -1,5 +1,7 @@
 type SwaggerSchema = {
 type SwaggerSchema = {
     type: string;
     type: string;
+    description?: string;
+    example?: string;
     items?: SwaggerSchema[];
     items?: SwaggerSchema[];
     properties?: {
     properties?: {
         [name: string]: SwaggerSchema;
         [name: string]: SwaggerSchema;

+ 7 - 0
lib/base/swagger/SwaggerDoc.ts

@@ -124,6 +124,13 @@ class SwaggerDoc {
 		let res = '';
 		let res = '';
 		const indent = ' *' + this.repeatStr('\t', level + 1);
 		const indent = ' *' + this.repeatStr('\t', level + 1);
 		res += indent + `type: ${schema.type}\n`;
 		res += indent + `type: ${schema.type}\n`;
+
+		if(schema.description)
+			res += indent + `description: ${schema.description}\n`;
+
+		if(schema.example)
+			res += indent + `example: ${schema.example}\n`;
+
 		if(schema.items && schema.items.length > 0) {
 		if(schema.items && schema.items.length > 0) {
 			res += indent + 'items:\n';
 			res += indent + 'items:\n';
 			for(const item of schema.items) {
 			for(const item of schema.items) {

+ 2 - 0
lib/base/swagger/SwaggerSchemaType.ts

@@ -1,5 +1,7 @@
 type SwaggerSchema = {
 type SwaggerSchema = {
     type: string,
     type: string,
+    description?: string,
+    example?: string,
     items?: SwaggerSchema[],
     items?: SwaggerSchema[],
     properties?: { [name: string] : SwaggerSchema }
     properties?: { [name: string] : SwaggerSchema }
 };
 };

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "org.crazydoctor.expressts",
   "name": "org.crazydoctor.expressts",
-  "version": "1.1.2",
+  "version": "1.1.3",
   "devDependencies": {
   "devDependencies": {
     "@types/express-session": "^1.17.7",
     "@types/express-session": "^1.17.7",
     "@types/node": "^20.4.9",
     "@types/node": "^20.4.9",

Some files were not shown because too many files changed in this diff