{"id":16728275,"url":"https://github.com/tmc/go2oapi","last_synced_at":"2025-04-10T11:02:39.369Z","repository":{"id":205943276,"uuid":"715452078","full_name":"tmc/go2oapi","owner":"tmc","description":"Go to OpenAPI converter","archived":false,"fork":false,"pushed_at":"2023-11-07T18:45:14.000Z","size":13,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T09:47:11.985Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/tmc.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-07T07:06:17.000Z","updated_at":"2025-03-03T21:31:47.000Z","dependencies_parsed_at":"2024-06-21T15:18:34.022Z","dependency_job_id":"32f94a80-de65-4205-a83d-fd11e743a3d9","html_url":"https://github.com/tmc/go2oapi","commit_stats":null,"previous_names":["tmc/go2oapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmc%2Fgo2oapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmc%2Fgo2oapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmc%2Fgo2oapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmc%2Fgo2oapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmc","download_url":"https://codeload.github.com/tmc/go2oapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248206963,"owners_count":21065190,"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":[],"created_at":"2024-10-12T23:09:36.407Z","updated_at":"2025-04-10T11:02:39.329Z","avatar_url":"https://github.com/tmc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go2oapi - Go to OpenAPI Converter\n\ngo2oapi is a tool for converting Go function declarations into OpenAPI (Swagger) definitions.\n\nIt parses your Go source files, identifies function parameters, and generates associated OpenAPI\ndefinitions suitable for use in [OpenAI Function\nCalling](https://platform.openai.com/docs/guides/function-calling).\n\n## Features\n\n- **Automated Parsing**: Automatically parses Go source files to find function declarations.\n- **Rich OpenAPI Definitions**: Creates comprehensive OpenAPI definitions including types, descriptions, and enums.\n- **Error Handling**: Provides clear error messages for unsupported types and parsing issues.\n- **Reflection-Free**: Operates without the need for Go reflection, ensuring type safety and straightforward code.\n\n## Installation\n\nYou can directly install the cli version of the tool via `go get` (presuming you have go installed correctly).\n\n```bash\ngo get github.com/tmc/go2oapi/cmd/go2oapi\n```\n\n## Usage\n\nYou can use go2oapi either as a package or a command line tool.\n\n### Usage as a library\n\n```go\npackage main\n\nimport (\n    \"github.com/tmc/go2oapi\"\n    \"log\"\n)\n\nfunc main() {\n    details, err := go2oapi.ParseFunction(\"path/to/your/go/program/\", \"YourFunctionName\")\n    if err != nil {\n        log.Fatalf(\"Error parsing function: %s\\n\", err)\n    }\n\n    // Use `details` for further processing or output\n}\n```\n\n### go2oapi command line\n\nTo generate the OpenAPI tool signature for `strings.Join`:\n```\n$ go2oapi -src $(go env GOROOT)/src/strings -func Join\n{\n  \"name\": \"Join\",\n  \"description\": \"Join concatenates the elements of its first argument to create a single string. The separator string sep is placed between elements in the resulting string.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"elems\": {\n        \"type\": \"array\",\n        \"items\": {\n          \"type\": \"string\"\n        }\n      },\n      \"sep\": {\n        \"type\": \"string\"\n      }\n    },\n    \"required\": [\n      \"elems\",\n      \"sep\"\n    ]\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmc%2Fgo2oapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmc%2Fgo2oapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmc%2Fgo2oapi/lists"}