{"id":15095982,"url":"https://github.com/morlay/gin-swagger","last_synced_at":"2025-10-08T00:32:05.534Z","repository":{"id":69524129,"uuid":"83264959","full_name":"morlay/gin-swagger","owner":"morlay","description":"[DEPRECATED]","archived":true,"fork":false,"pushed_at":"2018-03-08T09:17:13.000Z","size":1962,"stargazers_count":44,"open_issues_count":1,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-02T05:22:06.484Z","etag":null,"topics":["docs-generator","gin","gin-gonic","openapi","swagger"],"latest_commit_sha":null,"homepage":"","language":"Go","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/morlay.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-27T03:39:30.000Z","updated_at":"2023-01-28T19:51:50.000Z","dependencies_parsed_at":"2023-04-18T16:20:49.548Z","dependency_job_id":null,"html_url":"https://github.com/morlay/gin-swagger","commit_stats":{"total_commits":86,"total_committers":6,"mean_commits":"14.333333333333334","dds":0.4418604651162791,"last_synced_commit":"b798a72043ca8b29ef8b04d7cca034ac0cb9af0d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Fgin-swagger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Fgin-swagger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Fgin-swagger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Fgin-swagger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morlay","download_url":"https://codeload.github.com/morlay/gin-swagger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235669382,"owners_count":19026815,"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":["docs-generator","gin","gin-gonic","openapi","swagger"],"created_at":"2024-09-25T15:44:31.692Z","updated_at":"2025-10-08T00:31:59.871Z","avatar_url":"https://github.com/morlay.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gin Swagger\n\nPick Swagger from code which wrote by [gin](https://github.com/gin-gonic/gin)\n\n## Rules\n\n### Path \u0026 Method\n\n- [x] pick path and method from `*gin.Engine` or `*gin.RouterGroup`\n- [x] path of `*gin.RouterGroup` will be prefix of path of `*gin.Engine`\n- [x] only support `GET` `POST` `PUT` `PATCH` `HEAD` `DELETE` `OPTIONS`\n- [x] gin-style router will be convert to swagger-style, `:id` =\u003e `{id}`, double check with parameter definitions, undefined path parameter will be use `0` instead.\n\n### Operation\n\n- [x] pick operation in scope of gin-handler (not support anonymous func, we need func name as operationId)\n- [x] name of gin-handler will be `operationId`\n- [x] only support single gin-handler.\n \n#### Parameter\n\n- [x] struct type of variable `req` or `request` in scope of gin-handler will be used for picking parameters.\n- [x] tag `in` of struct field must be defined, expect body parameter, but need to use fieldName `Body`. \n- [x] tag `json` will be used as `name` \n- [x] struct type of anonymous struct field will be picked too.\n- [x] others will be same as Schema\n\n#### Response\n\n- [x] `status` will be picked by gin-context render method.\n- [x] `c.JSON` will set schema by type of return value and with produce `application/json`\n- [x] `c.HTML` will with produce `application/html`\n- [x] `c.Rediect` `c.Data` and `c.Render` will be no responce\n\n#### Schema\n\n- [x] only support `json`\n- [x] basic type will be translated, but `json:\"key,string\"` will force converting to `string`\n- [x] tag `default` will be set the default value, if it not exists, we will set field `required`\n- [x] tag `validate` will be set common validations, for example, `validate:\"@int[0,100)\"` will be `{ \"minimum\": 0, \"exclusiveMinimum\": true, \"maximum\": 100 }`\n- [x] anonymous struct field will be used with `allOf`\n\n##### Enums\n\n- [x] pick `enum` from commented `swagger:enum` type\n\n- [x] string `enum` from const\n\n```go\n// swagger:enum State\ntype State int\n\nconst (\n\tSTATE_UNKNOWN = iota\n\tSTATE__ONE    // one\n\tSTATE__TWO    // two\n\tSTATE__THREE  // three\n)\n``` \nwill be \n```json\n{\n  \"enum\": [\n    \"ONE\",\n    \"TWO\",\n    \"THREE\"\n  ],\n  \"x-enum-labels\": [\n    \"one\",\n    \"two\",\n    \"three\"\n  ],\n  \"x-enum-type\": \"State\"\n}\n```\n\n- [x] `validate:\"@string{ONE,TWO}\"` or `validate:\"@int{1,2}\"` will be used for partial pick enum values;  \n\n##### String format\n\n- [x] pick format from commented `swagger:strfmt \u003cformat-name\u003e` type\n\n#### Definitions\n\n- [x] only collect the named complex type, like struct type, slice type, map type\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorlay%2Fgin-swagger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorlay%2Fgin-swagger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorlay%2Fgin-swagger/lists"}