{"id":33314054,"url":"https://github.com/yumin-chen/gatsby-plugin-swagger-jsdoc","last_synced_at":"2026-06-11T06:31:34.395Z","repository":{"id":42591262,"uuid":"510756114","full_name":"yumin-chen/gatsby-plugin-swagger-jsdoc","owner":"yumin-chen","description":"A Gatsby plugin to automatically generate Swagger OpenAPI spec from JSDoc-style comments","archived":false,"fork":false,"pushed_at":"2022-07-10T19:56:18.000Z","size":63,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-19T11:03:18.372Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yumin-chen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-05T13:49:52.000Z","updated_at":"2024-12-07T10:49:33.000Z","dependencies_parsed_at":"2022-09-26T16:22:11.245Z","dependency_job_id":null,"html_url":"https://github.com/yumin-chen/gatsby-plugin-swagger-jsdoc","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/yumin-chen/gatsby-plugin-swagger-jsdoc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yumin-chen%2Fgatsby-plugin-swagger-jsdoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yumin-chen%2Fgatsby-plugin-swagger-jsdoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yumin-chen%2Fgatsby-plugin-swagger-jsdoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yumin-chen%2Fgatsby-plugin-swagger-jsdoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yumin-chen","download_url":"https://codeload.github.com/yumin-chen/gatsby-plugin-swagger-jsdoc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yumin-chen%2Fgatsby-plugin-swagger-jsdoc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34186385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-19T11:01:08.033Z","updated_at":"2026-06-11T06:31:34.390Z","avatar_url":"https://github.com/yumin-chen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gatsby-plugin-swagger-jsdoc\n\nProvides drop-in support for generating a [Swagger UI](https://swagger.io/tools/swagger-ui/) docs page for your REST API backend, automatically generated from JSDoc-style comments.\n\nThis plugin uses [swagger-jsdoc](https://github.com/Surnet/swagger-jsdoc) to generate the [OpenAPI Specification](https://swagger.io/specification/) definition required by Swagger UI, and then renders the result using the official [swagger-ui-react](https://www.npmjs.com/package/swagger-ui-react) package.\n\n## Install\n\n`npm install gatsby-plugin-swagger-jsdoc`\n\n## How to use\n\nAdd in your `gatsby-config.js`:\n\n```javascript\nplugins: [\n  {\n    resolve: 'gatsby-plugin-swagger-jsdoc',\n    options: {\n      uiRoute: '/api', // Path to your desired API docs page\n      source: [`${__dirname}/src/api/**/*.js`], // Recursively scan `api` folder\n      definition: {\n        info: {\n          title: 'Your API Title',\n          description: 'Your API description',\n          version: '1.0.0',\n        },\n      },\n    },\n  },\n];\n```\n\nNow you can add your JSDoc-style comments to your source code, and your API docs page will be built automatically. You could follow the sample JSDoc in [examples](#examples) below.\n\n## Configuration options\n\n**`uiRoute`** [array|string][required]\n\nThe path to your desired API docs page, where the generated Swagger UI is shown. This page will be auto-generated by this plugin.\n\n**`source`** [array|string][optional]\n\nPaths of the source files to scan for `@openapi` annotations. By default, it scans the `api` folder and all its subfolders (`['/src/api/**/*.js']`). You can change the value to scan any files, but only JSDoc-style comments are scanned. `**/*` means recursively scan subfolders.\n\n**`definition`** [object][optional]\n\nExtra properties to pass down to Swagger spec definition. For example, you could put your API info definition here:\n\n```javascript\ndefinition: {\n  info: {\n    title: 'Your API Title',\n    description: 'Your API description',\n    version: '1.0.0'\n  }\n}\n```\n\n## Examples\n\nAdd `@openapi` annotated JSDoc-style comments to any source file you wish, as long as your source file is listed under the `source` option:\n\n```javascript\n// src/api/letters/[value].js\nconst handler = async (req, res) =\u003e {\n  switch (req.method) {\n    case 'GET':\n      /**\n       * @openapi\n       * /api/letters/{value}:\n       *   get:\n       *     summary: Get details of a letter by value.\n       *     description: Returns the details information about a letter.\n       *     tags:\n       *       - Letters\n       *     parameters:\n       *       - name: value\n       *         in: path\n       *         description: Value of the letter\n       *         schema:\n       *           type: string\n       *     responses:\n       *       200:\n       *         description: Success\n       *         content:\n       *           application/json:\n       *             schema:\n       *               type: object\n       *               properties:\n       *                 value:\n       *                   type: string\n       *                 name:\n       *                   type: string\n       *                 greekAlt:\n       *                   type: string\n       */\n\n      // You could generate a static .json result by plugin `gatsby-plugin-copy-files`,\n      // or using GraphQL query by plugin `gatsby-plugin-json-output`.\n\n      return res.sendFile(`api/letters/${req.params.value}.json`);\n\n    case 'POST':\n    /**\n     * @openapi\n     * /api/letters:\n     *   post:\n     *     summary: Add a letter.\n     *     description: This API will make changes and push changes to git remote\n     *     tags:\n     *       - Letters\n     *     responses:\n     *       200:\n     *         description: OK\n     */\n\n    // ... YOUR POST METHOD\n\n    default:\n      return res.sendStatus(405);\n  }\n};\n\nexport default handler;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyumin-chen%2Fgatsby-plugin-swagger-jsdoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyumin-chen%2Fgatsby-plugin-swagger-jsdoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyumin-chen%2Fgatsby-plugin-swagger-jsdoc/lists"}