{"id":13786737,"url":"https://github.com/go-oas/docs","last_synced_at":"2025-04-12T06:30:36.132Z","repository":{"id":54670024,"uuid":"333859606","full_name":"go-oas/docs","owner":"go-oas","description":"Automatically generate RESTful API documentation for GO projects - aligned with Open API Specification standard","archived":false,"fork":false,"pushed_at":"2023-05-05T18:25:43.000Z","size":3334,"stargazers_count":45,"open_issues_count":9,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T01:51:09.642Z","etag":null,"topics":["api-documentation","go","golang","oas","oas3","openapi-specification","swagger-api","swagger-ui","swaggo"],"latest_commit_sha":null,"homepage":"https://t.me/go_oas","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/go-oas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"patreon":"kaynetik"}},"created_at":"2021-01-28T18:51:47.000Z","updated_at":"2025-03-24T22:34:43.000Z","dependencies_parsed_at":"2024-01-08T16:21:10.083Z","dependency_job_id":null,"html_url":"https://github.com/go-oas/docs","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-oas%2Fdocs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-oas%2Fdocs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-oas%2Fdocs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-oas%2Fdocs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-oas","download_url":"https://codeload.github.com/go-oas/docs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248529137,"owners_count":21119450,"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":["api-documentation","go","golang","oas","oas3","openapi-specification","swagger-api","swagger-ui","swaggo"],"created_at":"2024-08-03T19:01:31.866Z","updated_at":"2025-04-12T06:30:36.074Z","avatar_url":"https://github.com/go-oas.png","language":"Go","readme":"# docs\n\n### Automatically generate RESTful API documentation for GO projects - aligned with [Open API Specification standard](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md).\n\n\u003cimg align=\"right\" width=\"180px\" src=\"https://raw.githubusercontent.com/kaynetik/dotfiles/master/svg-resources/go-grpc-web.svg\"\u003e\n\n![GolangCI](https://github.com/go-oas/docs/workflows/golangci/badge.svg?branch=main)\n![Build](https://github.com/go-oas/docs/workflows/Build/badge.svg?branch=main)\n[![Version](https://img.shields.io/badge/version-v1.0.5-success.svg)](https://github.com/go-oas/docs/releases)\n[![Go Report Card](https://goreportcard.com/badge/github.com/go-oas/docs)](https://goreportcard.com/report/github.com/go-oas/docs)\n[![Coverage Status](https://coveralls.io/repos/github/go-oas/docs/badge.svg?branch=main)](https://coveralls.io/github/go-oas/docs?branch=main)\n[![codebeat badge](https://codebeat.co/badges/32b86556-84e3-4db9-9f11-923d12994f90)](https://codebeat.co/projects/github-com-go-oas-docs-main)\n[![Go Reference](https://pkg.go.dev/badge/github.com/go-oas/docs.svg)](https://pkg.go.dev/github.com/go-oas/docs)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://awesome-go.com)\n\ngo-OAS Docs converts structured OAS3 (Swagger3) objects into the Open API Specification \u0026 automatically serves it on\nchosen route and port. It's extremely flexible and simple, so basically it can be integrated into any framework or\nexisting project.\n\nWe invite anyone interested to join our **[GH Discussions board](https://github.com/go-oas/docs/discussions)**. Honest\nfeedback will enable us to build better product and at the same time not waste valuable time and effort on something\nthat might not fit intended usage. So if you can, please spare few minutes to give your opinion of what should be done\nnext, or what should be the priority for our roadmap. :muscle: :tada:\n\n----\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n- [How to use](#how-to-use)\n    * [Examples](#examples)\n- [Contact](#contact)\n- [The current roadmap (planned features)](#roadmap)\n\n## Getting Started\n\n1. Download **_docs_** by using:\n   ```sh\n   $ go get -u github.com/go-oas/docs\n   ``` \n2. Add one line annotation to the handler you wish to use in the following\n   format: `// @OAS \u003cFUNC_NAME\u003e \u003cROUTE\u003e \u003cHTTP_METHOD\u003e`\n   Examples:\n   ```\n   // @OAS handleCreateUser /users POST\n   // @OAS handleGetUser /users GET\n   ```\n3. Declare all required documentation elements that are shared. Or reuse ones that already exist in the examples\n   directory.\n4. Declare specific docs elements per route.\n\n----\n\n## How to use\n\nFor more explicit example, please refer to [docs/examples](https://github.com/go-oas/docs/examples)\n\nAdd OAS TAG to your existing handler that handles fetching of a User:\n\n```go\npackage users\n\nimport \"net/http\"\n\n// @OAS handleGetUser /users GET\nfunc (s *service) handleGetUser() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t}\n}\n```\n\nCreate a unique API documentation function for that endpoint:\n\n```go\npackage main\n\nimport \"github.com/go-oas/docs\"\n\nfunc handleGetUserRoute(oasPathIndex int, oas *docs.OAS) {\n\tpath := oas.GetPathByIndex(oasPathIndex)\n\n\tpath.Summary = \"Get a User\"\n\tpath.OperationID = \"getUser\"\n\tpath.RequestBody = docs.RequestBody{}\n\tpath.Responses = docs.Responses{\n\t\tgetResponseOK(),\n\t}\n\n\tpath.Tags = append(path.Tags, \"pet\")\n}\n```\n\nBear in mind that creating a unique function per endpoint handler is not required, but simply provides good value in\nusability of shared documentation elements.\n\nOnce you created the function, simply register it for parsing by using `AttachRoutes()` defined upon `OAS` structure.\nE.g.:\n\n```go\n\npackage main\n\nimport (\n\t\"github.com/go-oas/docs\"\n)\n\nfunc main() {\n\tapiDoc := docs.New()\n\tapiDoc.AttachRoutes([]interface{}{\n\t\thandleGetUserRoute,\n\t})\n```\n\nIf this approach is too flexible for you, you are always left with the possibility to create your own attacher - or any\nother parts of the system for that matter.\n\n### Examples\n\nTo run examples, and checkout hosted documentation via Swagger UI, issue the following command:\n\n```sh\n$ go run ./examples/file_output/*.go\n# or uncomment line 40 and comment line 38 in internal/dist/index.html before running:\n$ go run ./examples/stream_output/*.go\n```\n\nAnd navigate to `http://localhost:3005/docs/api/` in case that you didn't change anything before running the example\nabove.\n\n----\n\n## Contact\n\nCheck out the current [Project board](https://github.com/go-oas/docs/projects/1) or\nour **[GH Discussions board](https://github.com/go-oas/docs/discussions)** for more information.\n\nYou can join our Telegram group at: [https://t.me/go_oas](https://t.me/go_oas)\n\n## Roadmap\n\n| Feature (GH issues)                                             | Description                                                                              | Release |\n| --------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ------- |\n| [Validation](https://github.com/go-oas/docs/issues/17)          | Add validation to all structures based on OAS3.0.3                                       | v1.1.0  |\n| [CLI](https://github.com/go-oas/docs/issues/18)                 | Add CLI support - make it CLI friendly                                                   | v1.2.0  |\n| [Postman](https://github.com/go-oas/docs/issues/19)             | Add postman support via PM API                                                           | v1.3.0  |\n| [ReDoc](https://github.com/go-oas/docs/issues/20)               | Add ReDoc support as an alternative to SwaggerUI                                         | v1.4.0  |\n| [E2E Auto-generation](https://github.com/go-oas/docs/issues/21) | Go tests conversion to Cypress/Katalon suites (convert mocked unit tests into e2e tests) | v1.5.0  |\n\n","funding_links":["https://patreon.com/kaynetik"],"categories":["Go Tools","Go 工具","Libraries for creating HTTP middlewares"],"sub_categories":["Routers","路由器"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-oas%2Fdocs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-oas%2Fdocs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-oas%2Fdocs/lists"}