{"id":39144787,"url":"https://github.com/b1tray3r/go-openapi3","last_synced_at":"2026-01-17T21:33:33.639Z","repository":{"id":282310280,"uuid":"948080470","full_name":"b1tray3r/go-openapi3","owner":"b1tray3r","description":"This repository contains an almost minimal setup for developing a REST service using Echo, OpenAPI and Swagger-UI integration.","archived":false,"fork":false,"pushed_at":"2025-03-13T21:45:25.000Z","size":16,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T22:27:44.644Z","etag":null,"topics":["air","api","echo","example-project","golang","oapi-codegen","openapi3","rest","swagger-ui"],"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/b1tray3r.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":"2025-03-13T18:03:40.000Z","updated_at":"2025-03-13T21:45:29.000Z","dependencies_parsed_at":"2025-03-18T21:02:34.501Z","dependency_job_id":null,"html_url":"https://github.com/b1tray3r/go-openapi3","commit_stats":null,"previous_names":["b1tray3r/go-openapi3"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/b1tray3r/go-openapi3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b1tray3r%2Fgo-openapi3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b1tray3r%2Fgo-openapi3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b1tray3r%2Fgo-openapi3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b1tray3r%2Fgo-openapi3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b1tray3r","download_url":"https://codeload.github.com/b1tray3r/go-openapi3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b1tray3r%2Fgo-openapi3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28518627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T18:55:29.170Z","status":"ssl_error","status_checked_at":"2026-01-17T18:55:03.375Z","response_time":85,"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":["air","api","echo","example-project","golang","oapi-codegen","openapi3","rest","swagger-ui"],"created_at":"2026-01-17T21:33:33.529Z","updated_at":"2026-01-17T21:33:33.609Z","avatar_url":"https://github.com/b1tray3r.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenAPI Restservice with Swagger-UI\n\nThis repository contains an almost minimal setup for developing a REST service using [Echo](https://echo.labstack.com/), [OpenAPI](https://www.openapis.org/) and [Swagger-UI](https://swagger.io/tools/swagger-ui/) integration.\n\nThe generation and build process is using [air](https://github.com/air-verse/air) for easy setup.\n\nThe OpenAPI defintion is defined with code using go in the `internal/openapi/definition.go` file.\n\nDuring the build steps air is going to generate the `openapi3.json` file in the `cmd/swagger` directory.\nAdditionally, the according server interfaces are generated with [oapi-codegen](https://github.com/oapi-codegen/oapi-codegen) into the `pkg/api/` folder.\n\nThe application will serve the Swagger-UI at `swagger/` endpoint.\n\nThe backend is implemented in the `internal/server/server.go`file.\n\n\n## Setup\n\n1. Clone the project\n\n```sh\ngit clone https://github.com/b1tray3r/go-openapi3.git\n```\n\n2. Change the directory\n\n```sh\ncd go-openapi3\n```\n\n3. Install openapi-gen\n\n```shell\ngo install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest\n```\n\n4. Install air\n\n```sh\ngo install github.com/air-verse/air@latest\n```\n\n5. Launch\n\n```sh\nair\n```\n\n### Details\n\nMany things are hardcoded on purpose to keep the repository as barebone as possible.\n\n#### index.html\n\nThis contains the swagger-ui code and requires access to [unpkg](https://unpkg.com/) servers.\n\nThe file is requesting the generated `/swagger/openapi3.json` file to build the GUI.\n\n#### .air.toml\n\nUsing air the complete build pipeline is executed on the fly.\nWhen building the final application you have to execute all `pre_cmd` entries in the `.air.toml` configuration.\n\nPlease note that all `*.gen.go` files are ignored by air.\nIt is important for air to exclude this files, because generating these file(s) will cause air to loop indefinetly.\n\n#### oapi-codegen.yml\n\nThis configuration is responsible to generate the api interfaces and types for echo.\nI am not sure whether this is an optimal configuration, but it seems to work.\n\n## Sources\n\n- Thanks to [plutov](https://github.com/plutov/packagemain/tree/master/oapi-example) for his [Youtube](https://www.youtube.com/watch?v=87au30fl5e4) guide.\n\n- Thanks to [MarioCarrion](https://github.com/MarioCarrion/todo-api-microservice-example/tree/074bbb9f4d0f79e5bced943c10c56013705969a9) for his [Youtube](https://www.youtube.com/watch?v=HwtOAc0M08o) guide.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb1tray3r%2Fgo-openapi3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb1tray3r%2Fgo-openapi3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb1tray3r%2Fgo-openapi3/lists"}