{"id":18935905,"url":"https://github.com/darmikon/swagger-ui-koa","last_synced_at":"2025-07-12T07:02:46.032Z","repository":{"id":46774180,"uuid":"97155867","full_name":"Darmikon/swagger-ui-koa","owner":"Darmikon","description":"Swagger UI module for koa 2","archived":false,"fork":false,"pushed_at":"2021-09-26T21:29:31.000Z","size":478,"stargazers_count":8,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-05T00:39:04.145Z","etag":null,"topics":["koa","koa2","nodejs","swagger","swagger-jsdoc","swagger-ui"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/Darmikon.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":"2017-07-13T19:00:57.000Z","updated_at":"2020-11-11T02:26:17.000Z","dependencies_parsed_at":"2022-09-26T18:20:39.145Z","dependency_job_id":null,"html_url":"https://github.com/Darmikon/swagger-ui-koa","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Darmikon/swagger-ui-koa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darmikon%2Fswagger-ui-koa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darmikon%2Fswagger-ui-koa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darmikon%2Fswagger-ui-koa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darmikon%2Fswagger-ui-koa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Darmikon","download_url":"https://codeload.github.com/Darmikon/swagger-ui-koa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darmikon%2Fswagger-ui-koa/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264951976,"owners_count":23687993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["koa","koa2","nodejs","swagger","swagger-jsdoc","swagger-ui"],"created_at":"2024-11-08T12:04:56.954Z","updated_at":"2025-07-12T07:02:46.012Z","avatar_url":"https://github.com/Darmikon.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swagger UI Koa 2\n\nForked from [swagger-ui-express](https://github.com/scottie1984/swagger-ui-express)\n\nAdds middleware to your koa app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.\n\nUpdated to Swagger 3.0.17\n\n## Usage\n\nIn app's `package.json`\n\n    \"swagger-ui-koa\": \"latest\" // or desired version\n\nSetup `swagger-app-wrapper.js`\n```javascript\nimport swaggerUi from 'swagger-ui-koa';\nimport swaggerJSDoc from 'swagger-jsdoc';\nimport convert from 'koa-convert';\nimport mount from 'koa-mount';\n//import swaggerDocument from './swagger.json'; //also can be used\n\nexport default function (app) {\n  //without jsdoc from swagger.json\n  //app.use(swaggerUi.serve); //serve swagger static files\n  //app.use(convert(mount('/swagger', swaggerUi.setup(swaggerDocument)))); //mount endpoint for access\n\n  //with jsdoc\n  const options = {\n    swaggerDefinition: {\n      info: {\n        title: 'API', // Title (required)\n        version: '2.0.0', // Version (required)\n      },\n    },\n    apis: [\n      './src/module/swagger/swagger.yaml',\n      './src/routes/*.js', // Path to the API docs from root\n      './src/module/swagger/parameters.yaml'\n    ],\n  };\n  // Initialize swagger-jsdoc -\u003e returns validated swagger spec in json format\n  const swaggerSpec = swaggerJSDoc(options);\n  app.use(swaggerUi.serve); //serve swagger static files\n  app.use(convert(mount('/swagger', swaggerUi.setup(swaggerSpec)))); //mount endpoint for access\n}\n\n```\n\nOpen http://`\u003capp_host\u003e`:`\u003capp_port\u003e`/swagger in your browser to view the documentation.\n\n### [swagger-jsdoc](https://www.npmjs.com/package/swagger-jsdoc)\n\n### Swagger Explorer\n\nBy default the Swagger Explorer bar is hidden, to display it pass true as the second parameter to the setup function:\n\n```javascript\nconst express = require('express');\nconst app = express();\nconst swaggerUi = require('swagger-ui-express');\nconst swaggerDocument = require('./swagger.json');\n\nvar showExplorer = true;\n  ...\n  swaggerUi.setup(swaggerDocument, showExplorer)\n  ...\n```\n\n### Custom swagger options\n\nTo pass custom options e.g. validatorUrl, to the SwaggerUi client pass an object as the third parameter:\n\n```javascript\n\nvar showExplorer = true;\nvar options = {\n\tvalidatorUrl : null\n};\n...\nswaggerUi.setup(swaggerDocument, showExplorer, options));\n...\n```\n\n### Custom CSS styles\n\nTo customize the style of the swagger page, you can pass custom CSS as the fourth parameter.\n\nE.g. to hide the swagger header:\n\n```javascript\nvar showExplorer = false;\nvar options = {};\nvar customCss = '#header { display: none }';\n\n...\nswaggerUi.setup(swaggerDocument, showExplorer, options, customCss));\n...\n```\n\n## Requirements\n* Koa 2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarmikon%2Fswagger-ui-koa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarmikon%2Fswagger-ui-koa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarmikon%2Fswagger-ui-koa/lists"}