Repository: BRIKEV/express-jsdoc-swagger
Pull request #224 (2022-06-22 10:45:33)

docs: add alexstaroselsky as a contributor for code
Add @alexstaroselsky as a contributor for code.

This was requested by kevinccbsg [in this comment](https://github.com/BRIKEV/express-jsdoc-swagger/pull/221#issuecomment-1162941680)


Patch:
diff --git a/.all-contributorsrc b/.all-contributorsrc
index 65369c1..2cc4910 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -139,6 +139,15 @@
       "contributions": [
         "code"
       ]
+    },
+    {
+      "login": "alexstaroselsky",
+      "name": "Alexander Staroselsky",
+      "avatar_url": "https://avatars.githubusercontent.com/u/34102969?v=4",
+      "profile": "https://stackoverflow.com/users/5059657/alexander-staroselsky",
+      "contributions": [
+        "code"
+      ]
     }
   ],
   "contributorsPerLine": 7,
diff --git a/README.md b/README.md
index b355f8c..2dfe7b2 100644
--- a/README.md
+++ b/README.md
@@ -325,6 +325,7 @@ You can visit our [documentation](https://brikev.github.io/express-jsdoc-swagger
   </tr>
   <tr>
     <td align="center"><a href="https://github.com/sbingner"><img src="https://avatars.githubusercontent.com/u/354533?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sam Bingner</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=sbingner" title="Code">💻</a></td>
+    <td align="center"><a href="https://stackoverflow.com/users/5059657/alexander-staroselsky"><img src="https://avatars.githubusercontent.com/u/34102969?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alexander Staroselsky</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=alexstaroselsky" title="Code">💻</a></td>
   </tr>
 </table>
 
diff --git a/transforms/components/index.js b/transforms/components/index.js
index 320281b..777fd0b 100644
--- a/transforms/components/index.js
+++ b/transforms/components/index.js
@@ -15,7 +15,7 @@ const getPropertyName = ({ name: propertyName }) => {
 const addTypeApplication = (applications, expression) => {
   if (!applications && !expression) return {};
   return {
-    type: expression.name,
+    type: expression.name.toLowerCase(),
     items: {
       type: applications[0].name,
     },
diff --git a/transforms/paths/schema.js b/transforms/paths/schema.js
index 0e7f472..2d12588 100644
--- a/transforms/paths/schema.js
+++ b/transforms/paths/schema.js
@@ -23,7 +23,7 @@ const getSchema = (entity, message) => (type, enumValues = [], jsonOptions = {})
     const parseItems = formatRefSchema(type.applications);
     schema = {
       ...schema,
-      type: type.expression.name,
+      type: type.expression.name.toLowerCase(),
       items: parseItems.items ? parseItems.items : parseItems,
     };
   }


Test patch:
diff --git a/test/transforms/components/index.test.js b/test/transforms/components/index.test.js
index b336cb3..d5fcfa0 100644
--- a/test/transforms/components/index.test.js
+++ b/test/transforms/components/index.test.js
@@ -647,13 +647,29 @@ describe('parseComponents method', () => {
   });
 
   it('Should parse an album schema with an array of Songs schemas.', () => {
-    const jsodInput = [`
-      /**
-       * Album
-       * @typedef {object} Album
-       * @property {array<Song>} Songs
-       */
-    `];
+    const jsodInput = [
+      [`
+        /**
+         * Album
+         * @typedef {object} Album
+         * @property {array<Song>} Songs
+         */
+      `],
+      [`
+        /**
+         * Album
+         * @typedef {object} Album
+         * @property {Array<Song>} Songs
+         */
+      `],
+      [`
+        /**
+         * Album
+         * @typedef {object} Album
+         * @property {Song[]} Songs
+         */
+      `],
+    ];
     const expected = {
       components: {
         schemas: {
@@ -673,9 +689,11 @@ describe('parseComponents method', () => {
         },
       },
     };
-    const parsedJSDocs = jsdocInfo()(jsodInput);
-    const result = parseComponents({}, parsedJSDocs);
-    expect(result).toEqual(expected);
+    jsodInput.forEach(jsod => {
+      const parsedJSDocs = jsdocInfo()(jsod);
+      const result = parseComponents({}, parsedJSDocs);
+      expect(result).toEqual(expected);
+    });
   });
 
   it('Should parse a SingleAlbum schema with allOf reference of Song.', () => {
diff --git a/test/transforms/paths/parameters.test.js b/test/transforms/paths/parameters.test.js
index c49d3d6..f438c58 100644
--- a/test/transforms/paths/parameters.test.js
+++ b/test/transforms/paths/parameters.test.js
@@ -192,12 +192,26 @@ describe('params tests', () => {
   });
 
   it('should parse jsdoc path params with array of references', () => {
-    const jsodInput = [`
-      /**
-       * GET /api/v1
-       * @param {array<Song>} name.query.required.deprecated - name param description
-       */
-    `];
+    const jsodInput = [
+      [`
+        /**
+         * GET /api/v1
+         * @param {array<Song>} name.query.required.deprecated - name param description
+         */
+      `],
+      [`
+        /**
+         * GET /api/v1
+         * @param {Array<Song>} name.query.required.deprecated - name param description
+         */
+      `],
+      [`
+        /**
+         * GET /api/v1
+         * @param {Song[]} name.query.required.deprecated - name param description
+         */
+      `],
+    ];
     const expected = {
       paths: {
         '/api/v1': {
@@ -225,9 +239,11 @@ describe('params tests', () => {
         },
       },
     };
-    const parsedJSDocs = jsdocInfo()(jsodInput);
-    const result = setPaths({}, parsedJSDocs);
-    expect(result).toEqual(expected);
+    jsodInput.forEach(jsod => {
+      const parsedJSDocs = jsdocInfo()(jsod);
+      const result = setPaths({}, parsedJSDocs);
+      expect(result).toEqual(expected);
+    });
   });
 
   it('should parse jsdoc path params with enum values', () => {