{"id":33295187,"url":"https://github.com/nyxstack/openapi","last_synced_at":"2025-11-18T02:03:10.535Z","repository":{"id":324430674,"uuid":"1097206119","full_name":"nyxstack/openapi","owner":"nyxstack","description":"OpenAPI package providing Go types to build full OpenAPI 3.1.0 specs programmatically. Define paths, operations, schemas, servers, security, and components in code, then export JSON or YAML. Supports complex schemas, callbacks, authentication, and reusable components for complete API documentation.","archived":false,"fork":false,"pushed_at":"2025-11-15T19:21:55.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-15T20:34:45.867Z","etag":null,"topics":["api-spec","apidocs","automation","documentation","generator","go","golang","json-schema","nyx","openapi","routes","scalar","schema","spec","swager"],"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/nyxstack.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":"security.go","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-11-15T18:23:17.000Z","updated_at":"2025-11-15T18:38:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nyxstack/openapi","commit_stats":null,"previous_names":["nyxstack/openapi"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nyxstack/openapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyxstack%2Fopenapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyxstack%2Fopenapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyxstack%2Fopenapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyxstack%2Fopenapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nyxstack","download_url":"https://codeload.github.com/nyxstack/openapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyxstack%2Fopenapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284988465,"owners_count":27095952,"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-11-18T02:00:05.759Z","response_time":61,"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":["api-spec","apidocs","automation","documentation","generator","go","golang","json-schema","nyx","openapi","routes","scalar","schema","spec","swager"],"created_at":"2025-11-18T02:01:22.450Z","updated_at":"2025-11-18T02:03:10.520Z","avatar_url":"https://github.com/nyxstack.png","language":"Go","readme":"# OpenAPI Package\n\nGo types and utilities for building OpenAPI 3.1.0 specifications programmatically.\n\n## Features\n\n### Supported OpenAPI 3.1.0 Features\n\n- ✅ **Complete Specification Support** - All OpenAPI 3.1.0 objects implemented\n- ✅ **JSON Schema Integration** - Full schema validation and documentation\n- ✅ **Multiple Content Types** - JSON, XML, form data, file uploads\n- ✅ **Authentication Schemes** - API keys, OAuth2, HTTP auth\n- ✅ **Response Linking** - Connect operations through links\n- ✅ **Webhooks \u0026 Callbacks** - Document async operations\n- ✅ **Examples \u0026 Descriptions** - Rich documentation with examples\n\n## Installation\n\n```bash\ngo get github.com/nyxstack/openapi\n```\n\n## Overview\n\nThis package provides Go types that represent the complete OpenAPI 3.1.0 specification. You use these types to programmatically build OpenAPI documents, then marshal them to JSON or YAML format.\n\n## Usage\n\n### Basic Document Creation\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/nyxstack/openapi\"\n)\n\nfunc main() {\n    // Create a new OpenAPI document\n    doc := openapi.NewDocument(\"My API\", \"1.0.0\")\n    \n    // Add metadata\n    doc.WithInfo(\"A sample API\", \"\").\n        WithContact(\"API Team\", \"https://example.com\", \"team@example.com\").\n        WithLicense(\"MIT\", \"https://opensource.org/licenses/MIT\")\n    \n    // Add a server\n    doc.AddServer(\"https://api.example.com\", \"Production server\")\n    \n    // Build a simple operation\n    operation := openapi.NewOperation(\"getUser\", \"Get User\", \"Retrieve user by ID\")\n    operation.WithPathParameter(\"id\", \"User ID\", openapi.StringSchema(\"\"))\n    operation.WithOkResponse(\"User found\", userSchema())\n    \n    // Add the operation to a path\n    doc.AddOperation(\"/users/{id}\", \"GET\", operation)\n    \n    // Marshal to JSON\n    jsonBytes, err := doc.ToJSON()\n    if err != nil {\n        panic(err)\n    }\n    \n    fmt.Println(string(jsonBytes))\n}\n\nfunc userSchema() *openapi.Schema {\n    return openapi.NewObjectSchema().\n        WithRequiredProperty(\"id\", openapi.StringSchema(\"\")).\n        WithProperty(\"name\", openapi.StringSchema(\"\")).\n        WithProperty(\"email\", openapi.EmailSchema())\n}\n```\n\n### Building Complex Schemas\n\n```go\n// Create reusable schemas\ndoc.AddSchema(\"User\", *openapi.NewObjectSchema().\n    WithRequiredProperty(\"id\", openapi.StringSchema(\"\")).\n    WithRequiredProperty(\"email\", openapi.EmailSchema()).\n    WithProperty(\"name\", openapi.StringSchema(\"\")))\n\n// Reference schemas in operations\nschema := \u0026openapi.Schema{\n    Ref: \"#/components/schemas/User\",\n}\n```\n\n### Authentication\n\n```go\n// Add Bearer token auth\ndoc.AddSecurityScheme(\"bearerAuth\", openapi.SecurityScheme{\n    Type:         \"http\",\n    Scheme:       \"bearer\",\n    BearerFormat: \"JWT\",\n})\n\n// Apply to operations\noperation.Security = []openapi.SecurityRequirement{\n    {\"bearerAuth\": []string{}},\n}\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyxstack%2Fopenapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnyxstack%2Fopenapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyxstack%2Fopenapi/lists"}