{"id":34167945,"url":"https://github.com/dcrichards/go-to-openapi","last_synced_at":"2026-03-11T07:01:40.662Z","repository":{"id":62973708,"uuid":"262076909","full_name":"DCRichards/go-to-openapi","owner":"DCRichards","description":"Convert Go structs to OpenAPI Schemas (Data Models)","archived":false,"fork":false,"pushed_at":"2020-07-07T15:36:22.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-12-18T06:49:08.772Z","etag":null,"topics":["golang","openapi"],"latest_commit_sha":null,"homepage":"","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/DCRichards.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":"2020-05-07T14:43:01.000Z","updated_at":"2020-07-07T15:36:24.000Z","dependencies_parsed_at":"2022-11-10T05:02:57.436Z","dependency_job_id":null,"html_url":"https://github.com/DCRichards/go-to-openapi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DCRichards/go-to-openapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCRichards%2Fgo-to-openapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCRichards%2Fgo-to-openapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCRichards%2Fgo-to-openapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCRichards%2Fgo-to-openapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DCRichards","download_url":"https://codeload.github.com/DCRichards/go-to-openapi/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCRichards%2Fgo-to-openapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30373507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["golang","openapi"],"created_at":"2025-12-15T10:42:21.185Z","updated_at":"2026-03-11T07:01:40.654Z","avatar_url":"https://github.com/DCRichards.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-to-openapi\n\n\u003e Convert Go structs to [OpenAPI Schemas (Data Models)](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#schemaObject).\n\n## Motivation\n\nDocumenting a large API can be an extremely cumbersome task, especially if it isn't your API or you've simply lost familiarity with it. Go's structs are the ideal tool for figuring out requests and responses without having to query each endpoint, but writing an OpenAPI with them is equally as cumbersome. Enter `go-to-openapi` which reflectively parses any struct and returns the associated schema.\n\n## Usage\n\nHere's a simple example.\n\n```go\nimport (\n        \"fmt\"\n        \"github.com/dcrichards/go-to-openapi/schema\"\n)\n\ntype User struct {\n       \tID         string            `json:\"id\"`\n       \tEmail      string            `json:\"email\"`\n       \tTags       []Tag             `json:\"tags\"`\n       \tProperties map[string]string `json:\"props\"`\n}\n\ntype Tag struct {\n        Name   string `json:\"name\"`\n       \tActive bool   `json:\"active\"`\n}\n\nfunc main() {\n        yml, err := schema.Generate(User{})\n        if err != nil {\n                fmt.Printf(\"Error: %s\", err.Error())\n        }\n\n        log.Println(yml)\n}\n```\nThis will generate the following schema:\n\n```yaml\nschema:\n  type: object\n  properties:\n    email:\n      type: string\n    id:\n      type: string\n    props:\n      type: object\n      properties:\n        example:\n          type: string\n      additionalProperties: true\n    tags:\n      type: array\n      items:\n        type: object\n        properties:\n          active:\n            type: boolean\n          name:\n            type: string\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcrichards%2Fgo-to-openapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcrichards%2Fgo-to-openapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcrichards%2Fgo-to-openapi/lists"}