{"id":15284273,"url":"https://github.com/swaggest/swgen","last_synced_at":"2025-10-07T00:31:54.209Z","repository":{"id":50241209,"uuid":"88732844","full_name":"swaggest/swgen","owner":"swaggest","description":"Swagger 2.0 spec from Go code","archived":false,"fork":true,"pushed_at":"2021-05-31T19:48:30.000Z","size":407,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-03T16:12:06.790Z","etag":null,"topics":["json-schema","swagger2"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"lazada/swgen","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swaggest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-19T10:36:12.000Z","updated_at":"2025-03-06T18:04:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/swaggest/swgen","commit_stats":null,"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/swaggest/swgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaggest%2Fswgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaggest%2Fswgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaggest%2Fswgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaggest%2Fswgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swaggest","download_url":"https://codeload.github.com/swaggest/swgen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaggest%2Fswgen/sbom","scorecard":{"id":861517,"data":{"date":"2025-08-11","repo":{"name":"github.com/swaggest/swgen","commit":"a626ba95aef25dc5715fc5204b758418819bf9f0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/26 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/cloc.yml:1","Warn: no topLevel permission defined: .github/workflows/golangci-lint.yml:1","Warn: no topLevel permission defined: .github/workflows/test-unit.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cloc.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/swaggest/swgen/cloc.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cloc.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/swaggest/swgen/cloc.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cloc.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/swaggest/swgen/cloc.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/golangci-lint.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/swaggest/swgen/golangci-lint.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/golangci-lint.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/swaggest/swgen/golangci-lint.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-unit.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/swaggest/swgen/test-unit.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-unit.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/swaggest/swgen/test-unit.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-unit.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/swaggest/swgen/test-unit.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-unit.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/swaggest/swgen/test-unit.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-unit.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/swaggest/swgen/test-unit.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test-unit.yml:73: update your workflow using https://app.stepsecurity.io/secureworkflow/swaggest/swgen/test-unit.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test-unit.yml:89: update your workflow using https://app.stepsecurity.io/secureworkflow/swaggest/swgen/test-unit.yml/master?enable=pin","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T01:26:32.275Z","repository_id":50241209,"created_at":"2025-08-24T01:26:32.275Z","updated_at":"2025-08-24T01:26:32.275Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278250080,"owners_count":25955839,"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","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"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":["json-schema","swagger2"],"created_at":"2024-09-30T14:52:26.341Z","updated_at":"2025-10-07T00:31:53.806Z","avatar_url":"https://github.com/swaggest.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swagger Generator (swgen)\n\n[![Build Status](https://travis-ci.org/swaggest/swgen.svg?branch=master)](https://travis-ci.org/swaggest/swgen)\n[![Coverage Status](https://codecov.io/gh/swaggest/swgen/branch/master/graph/badge.svg)](https://codecov.io/gh/swaggest/swgen)\n[![GoDoc](https://godoc.org/github.com/swaggest/swgen?status.svg)](https://godoc.org/github.com/swaggest/swgen)\n\nSwagger Generator is a library which helps to generate [Swagger Specification](http://swagger.io/specification/) in JSON format on-the-fly.\n\n## OpenAPI 3.0 Support\n\nOpenAPI 3.0 support is available with `openapi3.Reflector`.\n\n```go\n// Add OpenAPI 3.0 reflector to enable proxying to OpenAPI 3.0 Schema.\nopenapi3Reflector := openapi3.Reflector{}\ngen.SetOAS3Proxy(\u0026openapi3Reflector)\n```\n\n## Installation\n\nYou can use `go get` to install the `swgen` package\n\n    go get github.com/swaggest/swgen\n\nThen import it into your own code\n\n```go\nimport \"github.com/swaggest/swgen\"\n```\n\n## Example\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/swaggest/swgen\"\n)\n\n// PetsRequest defines all params for /pets request\ntype PetsRequest struct {\n    Tags  []string `schema:\"tags\" in:\"query\" required:\"-\" description:\"tags to filter by\"`\n    Limit int32    `schema:\"limit\" in:\"query\" required:\"-\" description:\"maximum number of results to return\"`\n}\n\n// Pet contains information of a pet\ntype Pet struct {\n    ID   int64  `json:\"id\"`\n    Name string `json:\"name\"`\n    Tag  string `json:\"tag\"`\n}\n\nfunc main() {\n\tgen := swgen.NewGenerator()\n\tgen.SetHost(\"petstore.swagger.io\").SetBasePath(\"/api\")\n\tgen.SetInfo(\"Swagger Petstore (Simple)\", \"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification\", \"http://helloreverb.com/terms/\", \"2.0\")\n\tgen.SetLicense(\"MIT\", \"http://opensource.org/licenses/MIT\")\n\tgen.SetContact(\"Swagger API team\", \"http://swagger.io\", \"foo@example.com\")\n\tgen.AddSecurityDefinition(\"BasicAuth\", swgen.SecurityDef{Type: swgen.SecurityBasicAuth})\n\n\tpathInf := swgen.PathItemInfo{\n\t\tPath:        \"/pets\",\n\t\tMethod:      \"GET\",\n\t\tTitle:       \"findPets\",\n\t\tDescription: \"Returns all pets from the system that the user has access to\",\n\t\tTag:         \"v1\",\n\t\tDeprecated:  false,\n\t\tSecurity:    []string{\"BasicAuth\"},\n\t\tRequest:     new(PetsRequest), // request object\n\t\tResponse:    new([]Pet),       // response object\n\t}\n\tpathInf.AddExtendedField(\"x-example\", \"example\")\n\n\tgen.SetPathItem(pathInf)\n\n\t// extended field\n\tgen.AddExtendedField(\"x-uppercase-version\", true)\n\n\tdocData, _ := gen.GenDocument()\n\tfmt.Println(string(docData))\n\n\t// output:\n\t// {\"swagger\":\"2.0\",\"info\":{\"title\":\"Swagger Petstore (Simple)\",\"description\":\"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification\",\"termsOfService\":\"http://helloreverb.com/terms/\",\"contact\":{\"name\":\"Swagger API team\",\"url\":\"http://swagger.io\",\"email\":\"foo@example.com\"},\"license\":{\"name\":\"MIT\",\"url\":\"http://opensource.org/licenses/MIT\"},\"version\":\"2.0\"},\"host\":\"petstore.swagger.io\",\"basePath\":\"/api\",\"schemes\":[\"http\",\"https\"],\"paths\":{\"/pets\":{\"get\":{\"tags\":[\"v1\"],\"summary\":\"findPets\",\"description\":\"Returns all pets from the system that the user has access to\",\"parameters\":[{\"description\":\"tags to filter by\",\"type\":\"array\",\"name\":\"tags\",\"in\":\"query\",\"items\":{\"type\":\"string\"},\"collectionFormat\":\"multi\"},{\"description\":\"maximum number of results to return\",\"type\":\"integer\",\"format\":\"int32\",\"name\":\"limit\",\"in\":\"query\"}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/Pet\"}}}},\"security\":[{\"BasicAuth\":[]}],\"x-example\":\"example\"}}},\"definitions\":{\"Pet\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"integer\",\"format\":\"int64\"},\"name\":{\"type\":\"string\"},\"tag\":{\"type\":\"string\"}}}},\"securityDefinitions\":{\"BasicAuth\":{\"type\":\"basic\"}},\"x-uppercase-version\":true}\n}\n```\n\n## License\n\nDistributed under the Apache License, version 2.0.\nPlease see license file in code for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswaggest%2Fswgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswaggest%2Fswgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswaggest%2Fswgen/lists"}