{"_id":"@ahmedrowaihi/openapi-go","_rev":"7-198c801b823df10b69d23491d32c356e","name":"@ahmedrowaihi/openapi-go","dist-tags":{"latest":"2.0.0"},"versions":{"0.1.0":{"name":"@ahmedrowaihi/openapi-go","version":"0.1.0","keywords":["openapi","go","golang","net-http","codegen","sdk","client"],"author":{"name":"Ahmed Rowaihi","email":"ahmedrowaihi@gmail.com"},"license":"MIT","_id":"@ahmedrowaihi/openapi-go@0.1.0","maintainers":[{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"}],"homepage":"https://github.com/ahmedrowaihi/contract-kit/tree/main/packages/openapi-go","bugs":{"url":"https://github.com/ahmedrowaihi/contract-kit/issues"},"dist":{"shasum":"be00e8ce94eef48f979bc09fff6ed82ea0008261","tarball":"https://registry.npmjs.org/@ahmedrowaihi/openapi-go/-/openapi-go-0.1.0.tgz","fileCount":275,"integrity":"sha512-0DU4SO53Te41iL4sT2o7bE5fW8lBNeO9Bo4SRQ4AKqzP3lIHnp5S+hD76zUwiA04wzI5K+BjywLIdRdwfaFVUg==","signatures":[{"sig":"MEQCICvPSqa7ua1tr5W63FGxwGoFsETeEw8j0oGxol7XTcSxAiBZjDycElqr6u0IqsKZvLjG6AqfrL/DzAdXer5AY42eJQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmedrowaihi%2fopenapi-go@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":333331},"main":"./dist/index.js","type":"module","_from":"file:ahmedrowaihi-openapi-go-0.1.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"dev":"tsc --watch","test":"tsc && node --test tests/*.test.ts","build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"},"_resolved":"/tmp/9727fdcbc3485d97a379fe44fc30a2c7/ahmedrowaihi-openapi-go-0.1.0.tgz","_integrity":"sha512-0DU4SO53Te41iL4sT2o7bE5fW8lBNeO9Bo4SRQ4AKqzP3lIHnp5S+hD76zUwiA04wzI5K+BjywLIdRdwfaFVUg==","repository":{"url":"git+https://github.com/ahmedrowaihi/contract-kit.git","type":"git","directory":"packages/openapi-go"},"_npmVersion":"10.8.2","description":"Generate idiomatic Go (net/http + encoding/json + context.Context) client SDKs from an OpenAPI 3.x spec.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"@hey-api/json-schema-ref-parser":"^1.4.1"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^22","@hey-api/shared":"^0.4.2","@hey-api/spec-types":"^0.2.0","@ahmedrowaihi/tsconfig":"0.0.0","@ahmedrowaihi/openapi-tools":"1.2.0"},"peerDependencies":{"@hey-api/shared":">=0.3.0","@hey-api/spec-types":">=0.2.0","@ahmedrowaihi/openapi-tools":">=1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/openapi-go_0.1.0_1777525859333_0.13471751624813066","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @ir-kit/openapi-go. See https://github.com/ir-kit/ir-kit for migration."},"0.1.1":{"name":"@ahmedrowaihi/openapi-go","version":"0.1.1","keywords":["openapi","go","golang","net-http","codegen","sdk","client"],"author":{"name":"Ahmed Rowaihi","email":"ahmedrowaihi@gmail.com"},"license":"MIT","_id":"@ahmedrowaihi/openapi-go@0.1.1","maintainers":[{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"}],"homepage":"https://github.com/ahmedrowaihi/contract-kit/tree/main/packages/openapi-go","bugs":{"url":"https://github.com/ahmedrowaihi/contract-kit/issues"},"dist":{"shasum":"e8ecc84d8793e5c8ea51bc92196d7208bc472193","tarball":"https://registry.npmjs.org/@ahmedrowaihi/openapi-go/-/openapi-go-0.1.1.tgz","fileCount":271,"integrity":"sha512-hRPR3m4pqppBbzEF4/sSGFVDpVOdXQEny24KV16P3hdLkEjAwphvXKQYGuOrT5tSZKvE+6Y5pYBBDXTQRXF1uA==","signatures":[{"sig":"MEYCIQDUXrniGK2ZWwRMSYqGZ51lUFonxZf1bmQyamSp8t+gwwIhALp/pc1F9kMBjGjLMinB6vD+7quuPTxXfo1orSJ/nGK5","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmedrowaihi%2fopenapi-go@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":326058},"main":"./dist/index.js","type":"module","_from":"file:ahmedrowaihi-openapi-go-0.1.1.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"dev":"tsc --watch","test":"tsc && node --test tests/*.test.ts","build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"},"_resolved":"/tmp/d6dc55775a169872a8eb77cc321d368e/ahmedrowaihi-openapi-go-0.1.1.tgz","_integrity":"sha512-hRPR3m4pqppBbzEF4/sSGFVDpVOdXQEny24KV16P3hdLkEjAwphvXKQYGuOrT5tSZKvE+6Y5pYBBDXTQRXF1uA==","repository":{"url":"git+https://github.com/ahmedrowaihi/contract-kit.git","type":"git","directory":"packages/openapi-go"},"_npmVersion":"10.8.2","description":"Generate idiomatic Go (net/http + encoding/json + context.Context) client SDKs from an OpenAPI 3.x spec.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"@ahmedrowaihi/oas-core":"0.1.0","@hey-api/json-schema-ref-parser":"^1.4.1"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^22","@hey-api/shared":"^0.4.2","@hey-api/spec-types":"^0.2.0","@ahmedrowaihi/tsconfig":"0.0.0","@ahmedrowaihi/openapi-tools":"1.2.0"},"peerDependencies":{"@hey-api/shared":">=0.3.0","@hey-api/spec-types":">=0.2.0","@ahmedrowaihi/openapi-tools":">=1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/openapi-go_0.1.1_1777528717688_0.13109193290309795","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @ir-kit/openapi-go. See https://github.com/ir-kit/ir-kit for migration."},"0.2.0":{"name":"@ahmedrowaihi/openapi-go","version":"0.2.0","keywords":["openapi","go","golang","net-http","codegen","sdk","client"],"author":{"name":"Ahmed Rowaihi","email":"ahmedrowaihi@gmail.com"},"license":"MIT","_id":"@ahmedrowaihi/openapi-go@0.2.0","maintainers":[{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"}],"homepage":"https://github.com/ahmedrowaihi/contract-kit/tree/main/packages/openapi-go","bugs":{"url":"https://github.com/ahmedrowaihi/contract-kit/issues"},"dist":{"shasum":"a115eed9b8fea129fcf515703ea7153bb6fa762f","tarball":"https://registry.npmjs.org/@ahmedrowaihi/openapi-go/-/openapi-go-0.2.0.tgz","fileCount":271,"integrity":"sha512-mekaH1KiUGe3trgK2DgcMJO2QzLTw8Qbt3Iu137+WEDAOt0GOtnv0aAc9PsCtb1uVSpd75blGXr+uImGWGUu8w==","signatures":[{"sig":"MEYCIQD+nxpsMrGRatCmhsJ/nyYi6Wuap7cT1rdma7Kv82PLuwIhAI4XYzFIlrU8JJijA1439DvZo5Ye5tLtNrMEHGQc0y4y","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmedrowaihi%2fopenapi-go@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":326938},"main":"./dist/index.js","type":"module","_from":"file:ahmedrowaihi-openapi-go-0.2.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"},"_resolved":"/tmp/000894d08029f5d8c077d10ab8ddc133/ahmedrowaihi-openapi-go-0.2.0.tgz","_integrity":"sha512-mekaH1KiUGe3trgK2DgcMJO2QzLTw8Qbt3Iu137+WEDAOt0GOtnv0aAc9PsCtb1uVSpd75blGXr+uImGWGUu8w==","repository":{"url":"git+https://github.com/ahmedrowaihi/contract-kit.git","type":"git","directory":"packages/openapi-go"},"_npmVersion":"10.8.2","description":"Generate idiomatic Go (net/http + encoding/json + context.Context) client SDKs from an OpenAPI 3.x spec.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"@ahmedrowaihi/oas-core":"1.0.0","@ahmedrowaihi/codegen-core":"0.2.0","@hey-api/json-schema-ref-parser":"^1.4.1"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.0","@types/node":"^22","@hey-api/shared":"^0.4.2","@hey-api/spec-types":"^0.2.0","@ahmedrowaihi/tsconfig":"0.0.0","@ahmedrowaihi/openapi-tools":"1.2.0"},"peerDependencies":{"@hey-api/shared":">=0.3.0","@hey-api/spec-types":">=0.2.0","@ahmedrowaihi/openapi-tools":">=1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/openapi-go_0.2.0_1777621361681_0.819904147430156","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @ir-kit/openapi-go. See https://github.com/ir-kit/ir-kit for migration."},"0.2.1":{"name":"@ahmedrowaihi/openapi-go","version":"0.2.1","keywords":["openapi","go","golang","net-http","codegen","sdk","client"],"author":{"name":"Ahmed Rowaihi","email":"ahmedrowaihi@gmail.com"},"license":"MIT","_id":"@ahmedrowaihi/openapi-go@0.2.1","maintainers":[{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"}],"homepage":"https://github.com/ahmedrowaihi/contract-kit/tree/main/packages/openapi/go","bugs":{"url":"https://github.com/ahmedrowaihi/contract-kit/issues"},"dist":{"shasum":"e3be37d5372ad2aa3b86eb8f5e037cc14981ce2a","tarball":"https://registry.npmjs.org/@ahmedrowaihi/openapi-go/-/openapi-go-0.2.1.tgz","fileCount":271,"integrity":"sha512-BAVme+djc8O28z9LvSLt59VtftfNYKGwPekp2V4ChDpsFXRhRwm4d0v+07tk+zEDbSSeFcXZBoYmx7hh+m8k8A==","signatures":[{"sig":"MEUCIDqJzo4WXYuR5ioM20dp8JUa2wCc/NeqT8qEHPj4epLiAiEA3jqmTnWE5FuaS0zJoOE3GraPMna/QeRC9akjrBZ0/jU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmedrowaihi%2fopenapi-go@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":326992},"main":"./dist/index.js","type":"module","_from":"file:ahmedrowaihi-openapi-go-0.2.1.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"},"_resolved":"/tmp/d0d8cef4814017e57d6a99cfb4bec0f3/ahmedrowaihi-openapi-go-0.2.1.tgz","_integrity":"sha512-BAVme+djc8O28z9LvSLt59VtftfNYKGwPekp2V4ChDpsFXRhRwm4d0v+07tk+zEDbSSeFcXZBoYmx7hh+m8k8A==","repository":{"url":"git+https://github.com/ahmedrowaihi/contract-kit.git","type":"git","directory":"packages/openapi/go"},"_npmVersion":"10.8.2","description":"Generate idiomatic Go (net/http + encoding/json + context.Context) client SDKs from an OpenAPI 3.x spec.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"@ahmedrowaihi/codegen-core":"0.2.1","@ahmedrowaihi/openapi-core":"2.0.0","@hey-api/json-schema-ref-parser":"^1.4.1"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.0","@types/node":"^22","@hey-api/shared":"^0.4.2","@hey-api/spec-types":"^0.2.0","@ahmedrowaihi/tsconfig":"0.0.0","@ahmedrowaihi/openapi-tools":"1.2.1"},"peerDependencies":{"@hey-api/shared":">=0.3.0","@hey-api/spec-types":">=0.2.0","@ahmedrowaihi/openapi-tools":">=1.2.1"},"_npmOperationalInternal":{"tmp":"tmp/openapi-go_0.2.1_1777638932686_0.5065168093557251","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @ir-kit/openapi-go. See https://github.com/ir-kit/ir-kit for migration."},"1.0.0":{"name":"@ahmedrowaihi/openapi-go","version":"1.0.0","keywords":["openapi","go","golang","net-http","codegen","sdk","client"],"author":{"name":"Ahmed Rowaihi","email":"ahmedrowaihi@gmail.com"},"license":"MIT","_id":"@ahmedrowaihi/openapi-go@1.0.0","maintainers":[{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"}],"homepage":"https://github.com/ahmedrowaihi/contract-kit/tree/main/packages/openapi/go","bugs":{"url":"https://github.com/ahmedrowaihi/contract-kit/issues"},"dist":{"shasum":"263192862032c9b874e22788dec1c730e71d5893","tarball":"https://registry.npmjs.org/@ahmedrowaihi/openapi-go/-/openapi-go-1.0.0.tgz","fileCount":271,"integrity":"sha512-J9ak3uKY28pnqtc40Fk5xVTM0rfjJPNWfIWMVtaUCuG2BkgYz+1wMLZAW5mDh9qt0yfxw80A+WrPUe32TmcFNg==","signatures":[{"sig":"MEUCIFEhH1u0aQr6upTUvbnSbb4wy44cUxVBiXs1XxpqUHMqAiEA+tt5s195SPlrprYtZeyDBTlYPmPk8KnCebm4/ZIT8cM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmedrowaihi%2fopenapi-go@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":327024},"main":"./dist/index.js","type":"module","_from":"file:ahmedrowaihi-openapi-go-1.0.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"vitest run --passWithNoTests","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"},"_resolved":"/tmp/11076f2f5243f9d0536383d246cec0a0/ahmedrowaihi-openapi-go-1.0.0.tgz","_integrity":"sha512-J9ak3uKY28pnqtc40Fk5xVTM0rfjJPNWfIWMVtaUCuG2BkgYz+1wMLZAW5mDh9qt0yfxw80A+WrPUe32TmcFNg==","repository":{"url":"git+https://github.com/ahmedrowaihi/contract-kit.git","type":"git","directory":"packages/openapi/go"},"_npmVersion":"10.8.2","description":"Generate idiomatic Go (net/http + encoding/json + context.Context) client SDKs from an OpenAPI 3.x spec.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"@ahmedrowaihi/codegen-core":"0.2.1","@ahmedrowaihi/openapi-core":"2.0.0","@hey-api/json-schema-ref-parser":"^1.4.1"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.0","@types/node":"^22","@hey-api/shared":"^0.4.2","@hey-api/spec-types":"^0.2.0","@ahmedrowaihi/tsconfig":"0.0.0","@ahmedrowaihi/openapi-tools":"1.3.0"},"peerDependencies":{"@hey-api/shared":">=0.3.0","@hey-api/spec-types":">=0.2.0","@ahmedrowaihi/openapi-tools":">=1.3.0"},"_npmOperationalInternal":{"tmp":"tmp/openapi-go_1.0.0_1778885511471_0.6071192192014652","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @ir-kit/openapi-go. See https://github.com/ir-kit/ir-kit for migration."},"2.0.0":{"name":"@ahmedrowaihi/openapi-go","version":"2.0.0","keywords":["openapi","go","golang","net-http","codegen","sdk","client"],"author":{"name":"Ahmed Rowaihi","email":"ahmedrowaihi@gmail.com"},"license":"MIT","_id":"@ahmedrowaihi/openapi-go@2.0.0","maintainers":[{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"}],"homepage":"https://github.com/ahmedrowaihi/contract-kit/tree/main/packages/openapi/go","bugs":{"url":"https://github.com/ahmedrowaihi/contract-kit/issues"},"dist":{"shasum":"a247f61c452ee8c3a1b829979ee27a721aa684cb","tarball":"https://registry.npmjs.org/@ahmedrowaihi/openapi-go/-/openapi-go-2.0.0.tgz","fileCount":271,"integrity":"sha512-D8VsFPhSvAQj3gxR5etbBvc1U4lNjePVF8J2B3HNQED4lSKd+MDnHukUUilS090BfcLYEhKkN1JL4qz1XJfdgw==","signatures":[{"sig":"MEUCIQCT7admdMAutFrtN2YDbCU5vJmcWO01GLZg27BYWlyHnAIgV93azu81PGvqkA4GR1lUhAhNoyVTd8ka2xpdo6yeSKo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmedrowaihi%2fopenapi-go@2.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":326583},"main":"./dist/index.js","type":"module","_from":"file:ahmedrowaihi-openapi-go-2.0.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"vitest run --passWithNoTests","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"},"_resolved":"/tmp/d419c76e2d8ffade1935c246b0fbe39e/ahmedrowaihi-openapi-go-2.0.0.tgz","_integrity":"sha512-D8VsFPhSvAQj3gxR5etbBvc1U4lNjePVF8J2B3HNQED4lSKd+MDnHukUUilS090BfcLYEhKkN1JL4qz1XJfdgw==","repository":{"url":"git+https://github.com/ahmedrowaihi/contract-kit.git","type":"git","directory":"packages/openapi/go"},"_npmVersion":"10.8.2","description":"Generate idiomatic Go (net/http + encoding/json + context.Context) client SDKs from an OpenAPI 3.x spec.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"@ahmedrowaihi/codegen-core":"0.2.1","@ahmedrowaihi/openapi-core":"2.0.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.0","@types/node":"^22","@hey-api/shared":"^0.4.2","@hey-api/spec-types":"^0.2.0","@ahmedrowaihi/tsconfig":"0.0.0","@ahmedrowaihi/openapi-tools":"1.4.0"},"peerDependencies":{"@hey-api/shared":">=0.3.0","@hey-api/spec-types":">=0.2.0","@ahmedrowaihi/openapi-tools":">=1.4.0"},"_npmOperationalInternal":{"tmp":"tmp/openapi-go_2.0.0_1778901872519_0.5977597640849666","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @ir-kit/openapi-go. See https://github.com/ir-kit/ir-kit for migration."}},"time":{"created":"2026-04-30T05:10:59.203Z","modified":"2026-05-21T09:19:05.944Z","0.1.0":"2026-04-30T05:10:59.479Z","0.1.1":"2026-04-30T05:58:37.839Z","0.2.0":"2026-05-01T07:42:41.824Z","0.2.1":"2026-05-01T12:35:32.854Z","1.0.0":"2026-05-15T22:51:51.639Z","2.0.0":"2026-05-16T03:24:32.698Z"},"bugs":{"url":"https://github.com/ahmedrowaihi/contract-kit/issues"},"author":{"name":"Ahmed Rowaihi","email":"ahmedrowaihi@gmail.com"},"license":"MIT","homepage":"https://github.com/ahmedrowaihi/contract-kit/tree/main/packages/openapi/go","keywords":["openapi","go","golang","net-http","codegen","sdk","client"],"repository":{"url":"git+https://github.com/ahmedrowaihi/contract-kit.git","type":"git","directory":"packages/openapi/go"},"description":"Generate idiomatic Go (net/http + encoding/json + context.Context) client SDKs from an OpenAPI 3.x spec.","maintainers":[{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"}],"readme":"# @ahmedrowaihi/openapi-go\n\nGenerate idiomatic Go client SDKs from an OpenAPI 3.x spec — `encoding/json` structs, typed-string enums, per-tag interfaces with `context.Context` first-arg + `*WithResponse` companions, and a `net/http`-backed impl struct. Per-call `RequestOptions`, composable interceptors, typed `APIError`, multipart + form-urlencoded wire encoding, multi-2xx sealed-style returns, and per-op security auto-wiring all included. Zero runtime dependencies — stdlib only.\n\nBuilt on the [`@hey-api`](https://github.com/hey-api/openapi-ts) toolchain (`@hey-api/json-schema-ref-parser` for spec loading, `@hey-api/shared` IR for normalization). 2.0 / 3.0 / 3.1 inputs all produce the same output.\n\nSibling package to [`@ahmedrowaihi/openapi-kotlin`](../openapi-kotlin) and [`@ahmedrowaihi/openapi-swift`](../openapi-swift). Part of [contract-kit](https://github.com/ahmedrowaihi/contract-kit). Companion to the [`petstore-sdk` example](../../examples/petstore-sdk).\n\n## Install\n\n```bash\npnpm add @ahmedrowaihi/openapi-go @ahmedrowaihi/openapi-tools @hey-api/shared @hey-api/spec-types\n```\n\n## Usage\n\n```ts\nimport { generate } from \"@ahmedrowaihi/openapi-go\";\n\nawait generate({\n  input: \"https://api.example.com/openapi.json\",\n  output: \"./sdk-go\",\n  packageName: \"petstore\",\n});\n```\n\nReads any of: a filesystem path, an http(s) URL, or a pre-parsed object. YAML and JSON are both supported. External `$ref`s are bundled inline.\n\n## Output\n\n### Schemas → structs / typed-string enums / type aliases\n\n```go\ntype Pet struct {\n    Id        *int64    `json:\"id,omitempty\"`\n    Name      string    `json:\"name\"`\n    Category  *Category `json:\"category,omitempty\"`\n    PhotoUrls []string  `json:\"photoUrls\"`\n    Tags      []Tag     `json:\"tags,omitempty\"`\n    Status    *PetStatus `json:\"status,omitempty\"`\n}\n\ntype PetStatus string\n\nconst (\n    PetStatusAvailable PetStatus = \"available\"\n    PetStatusPending   PetStatus = \"pending\"\n    PetStatusSold      PetStatus = \"sold\"\n)\n```\n\nOptional fields use pointer types (`*int64`, `*Category`) + `omitempty` so JSON can distinguish absent from zero. Required fields are bare. Slices and maps are nilable in Go and get `omitempty` without pointer-wrapping.\n\n### Operations → interfaces + impls\n\nFor each tag the generator emits:\n\n- `type <Tag>API interface` with one method per op + a `*WithResponse` twin that returns the raw `*http.Response`\n- `type NetHTTP<Tag>API struct { client *APIClient }` impl\n- `func NewNetHTTP<Tag>API(client *APIClient) *NetHTTP<Tag>API` constructor\n\n```go\ntype PetAPI interface {\n    // GET /pet/{petId}\n    GetPetById(ctx context.Context, petId int64, opts RequestOptions) (*Pet, error)\n    GetPetByIdWithResponse(ctx context.Context, petId int64, opts RequestOptions) (*Pet, *http.Response, error)\n    // …\n}\n\ntype NetHTTPPetAPI struct {\n    client *APIClient\n}\n\nfunc NewNetHTTPPetAPI(client *APIClient) *NetHTTPPetAPI {\n    return &NetHTTPPetAPI{client: client}\n}\n```\n\nMethod conventions:\n- **`ctx context.Context`** is the first arg — Go's idiomatic cancellation/deadline channel; replaces the `timeout` field that swift/kotlin's `RequestOptions` carries (`opts.Timeout` is still available as a convenience knob).\n- **`opts RequestOptions`** is the trailing arg — same shape as kotlin/swift.\n- **Named returns** (`(result *Pet, err error)`) so err-check sites do bare `return` without zero-value matching.\n- **No method overloading** — `*WithResponse` is a separately named method (Go has no overloads).\n\n### Per-call control via `RequestOptions`\n\n```go\ntype RequestOptions struct {\n    Client               *APIClient\n    BaseURL              string\n    Timeout              time.Duration\n    Headers              map[string]string\n    RequestInterceptors  []func(*http.Request) (*http.Request, error)\n    ResponseValidator    func(body []byte, resp *http.Response) error\n    ResponseTransformer  func(body []byte) ([]byte, error)\n}\n```\n\n```go\npets.GetPetById(ctx, 1, RequestOptions{})                                    // defaults\npets.GetPetById(ctx, 1, RequestOptions{Client: customClient})                // swap transport\npets.GetPetById(ctx, 1, RequestOptions{Headers: map[string]string{\"X-Trace\": id}})\npets.GetPetById(ctx, 1, RequestOptions{BaseURL: \"https://staging.example.com/api/v3\"})\npets.GetPetById(ctx, 1, RequestOptions{Timeout: 60 * time.Second})\n```\n\n### Composable interceptors + auth\n\nThe runtime `APIClient` carries an `Interceptors` slice that runs against every outgoing request. Interceptors compose — auth, logging, tracing all coexist:\n\n```go\nclient := NewAPIClient(\"https://api.example.com/\")\nclient.Interceptors = append(client.Interceptors, func(req *http.Request) (*http.Request, error) {\n    req.Header.Set(\"Authorization\", \"Bearer \"+TokenStore.Access())\n    return req, nil\n})\n```\n\nWhen the spec declares any `securitySchemes`, the generator additionally emits an `Auth` interface (with `BearerAuth`, `APIKeyAuth`, `BasicAuth` concrete types — `APIKeyAuth` carries an `APIKeyLocation` of `Header` / `Query` / `Cookie`) and the client gains an `Auth map[string]Auth` keyed by scheme name. Operations with `security:` requirements walk the map and apply the matching scheme automatically:\n\n```go\nclient.Auth[\"petstore_auth\"] = BearerAuth{Token: token}\nclient.Auth[\"api_key\"] = APIKeyAuth{Name: \"X-API-Key\", Value: key, Location: APIKeyHeader}\n```\n\n### Body media-type dispatch\n\n| Input media type | Generated parameter | Wire encoding |\n|---|---|---|\n| `application/json` (and `+json`) | `body *T` | `json.Marshal(body)` |\n| `multipart/form-data` (object schema) | one param per property; binary fields → `[]byte` | emitted `MultipartFormBody` helper (wraps `mime/multipart`) |\n| `application/x-www-form-urlencoded` (object schema) | one param per property | `url.Values{}.Encode()` |\n| `application/octet-stream`, image, etc. | `body []byte` | raw bytes |\n| `oneOf` / unresolvable JSON | `body []byte` | raw bytes (caller pre-encodes) |\n\n### Typed errors\n\nEvery non-2xx response funnels into `*APIError`:\n\n```go\ntype APIError struct {\n    Kind       APIErrorKind\n    StatusCode int    // populated for ClientError / ServerError / Unexpected\n    Body       []byte // raw response body for HTTP errors\n    Cause      error  // underlying error for transport / encoding / decoding\n}\n```\n\n`APIErrorKind` is an `iota`-typed enum: `APIErrorKindClient` (4xx), `APIErrorKindServer` (5xx), `APIErrorKindUnexpected`, `APIErrorKindEncoding`, `APIErrorKindDecoding`, `APIErrorKindTransport`. Pattern-match with `errors.As`:\n\n```go\nvar apiErr *APIError\nif errors.As(err, &apiErr) {\n    switch apiErr.Kind {\n    case APIErrorKindClient:  // 4xx — apiErr.StatusCode + apiErr.Body\n    case APIErrorKindServer:  // 5xx\n    case APIErrorKindTransport: // network / I/O — apiErr.Cause\n    }\n}\n```\n\n### Multi-2xx → sealed-style sum type\n\nWhen an operation declares more than one 2xx response code with distinct schemas, the generator emits a marker interface + concrete types — Go's idiomatic sum-type pattern:\n\n```go\ntype SubmitJobResponse interface {\n    isSubmitJobResponse()\n}\n\ntype SubmitJobResponseStatus200 struct{ Value JobResult }\nfunc (SubmitJobResponseStatus200) isSubmitJobResponse() {}\n\ntype SubmitJobResponseStatus204 struct{}\nfunc (SubmitJobResponseStatus204) isSubmitJobResponse() {}\n```\n\nCallers dispatch with a type switch:\n\n```go\nresult, err := jobs.SubmitJob(ctx, body, RequestOptions{})\nswitch r := result.(type) {\ncase SubmitJobResponseStatus200:\n    handle(r.Value)\ncase SubmitJobResponseStatus204:\n    // empty 204\n}\n```\n\n## Generator options\n\nEvery option is optional. Pass them to `generate({ ... })`:\n\n| Option | Purpose |\n|---|---|\n| `input` / `output` | Spec source (path / URL / object) and SDK output dir. |\n| `packageName` | Go package every file declares. Default `\"api\"`. |\n| `clean` | Wipe `output` before writing. Default `true`. Refuses to wipe cwd or filesystem root. |\n| `gomod` | Pass `{ module: \"github.com/example/foo\" }` to emit a minimal `go.mod` at the output root for standalone-module mode. Omit for drop-in mode. |\n| `defaultTag` | Tag to use when an op has none. Default `\"Default\"`. |\n| `interfaceName` | `(tag) => string`. Default `(tag) => `${PascalCase(tag)}API``. |\n| `clientStructName` | `(interfaceName) => string`. Default `(p) => `NetHTTP${p}``. |\n| `interfaceOnly` | Skip impl struct emission. Default `false`. |\n| `fileLocation` | `(decl) => { dir, file }` — full per-decl override. Rejects `..` traversal and absolute paths. |\n\n```ts\ngenerate({\n    input,\n    output,\n    packageName: \"petstore\",\n    gomod: { module: \"github.com/example/petstore-sdk\" },\n});\n```\n\n## Two consumption modes\n\n| Mode | Setup | When |\n|---|---|---|\n| **Drop into an existing module** | Paste the `.go` files into your module's source tree under any directory; they all declare the same `package <packageName>`. No third-party deps needed. | Adding the SDK directly to one app or service. |\n| **Standalone Go module** | Pass `gomod: { module: \"...\" }` to `generate()`; a minimal `go.mod` is emitted at the output root. Run `go build ./...` from the output dir. | Sharing across multiple modules or publishing as a separate Git repo. |\n\n## Output layout\n\n```text\nsdk-go/\n├── pet.go                          # struct\n├── pet_status.go                   # type alias + const block (enum)\n├── pet_api.go                      # interface\n├── net_http_pet_api.go             # impl struct + constructor + all methods\n├── api_client.go                   # runtime helper (transport, dispatch, decode)\n├── api_error.go                    # typed errors\n├── auth.go                         # (when spec has securitySchemes)\n├── api_key_location.go             # (when spec has securitySchemes)\n├── multipart_form_body.go          # (when any op uses multipart/form-data)\n├── url_encoding.go                 # query helpers\n├── query_style.go                  # form / spaceDelimited / pipeDelimited\n├── request_options.go\n└── (go.mod when `gomod:` is set)\n```\n\nConventions:\n- One file per type (struct / interface / typed-string enum) — Go convention.\n- All methods on a receiver collapse into one file (`net_http_<tag>_api.go`).\n- Snake_case file names that respect acronyms (`NetHTTPPetAPI` → `net_http_pet_api.go`).\n- Sealed-style multi-2xx response types (interface + concrete cases + marker methods) collapse into a single file named after the interface.\n\n## Requirements\n\n- **Go** 1.22 or newer (uses generics for `Execute[T]`).\n- **No third-party dependencies** — the SDK uses only stdlib (`net/http`, `encoding/json`, `mime/multipart`, `context`, …).\n\n## API surface\n\n| Export | Purpose |\n|---|---|\n| `generate(opts)` | High-level entry: load → IR → decls → files on disk. |\n| `schemasToDecls(schemas)` | `IR.Model.components.schemas` → `GoDecl[]`. |\n| `operationsToDecls(paths, opts?)` | `IR.PathsObject` → `{ decls, needsAuth, needsMultipart }`. |\n| `buildGoProject(decls, opts?)` | `GoDecl[]` → `{ path, content }[]` with package / import resolution. |\n| `buildRuntimeFiles(opts, pkg)` | Standalone runtime helper files (APIClient, APIError, …). |\n| `gomodFile(opts)` | Build a minimal `go.mod` for standalone-module mode. |\n| `securityKey(path, method)` | Key into `OperationsOptions.securitySchemeNames`. |\n| `printFile(file)` / `go*` builders | Lower-level Go AST + printer. |\n\n```text\nsrc/go-dsl/                   Go AST: type/, expr/, stmt/, decl/, file.ts\nsrc/go-compiler/              AST → string, mirrors the AST tree\nsrc/ir/\n├── type/                     IR.SchemaObject → GoType\n├── operation/                IR.OperationObject → signature shared by interface + impl\n├── impl/                     net/http body builders (url, request, headers, body, decode)\n├── runtime/                  Templated Go source for runtime helpers\n├── schema.ts                 schemasToDecls\n└── operations.ts             paths → interfaces + impl structs (orchestrator)\n```\n\nPer-method bodies are AST-built; runtime helpers (the same Go every time) ship as templated strings in `ir/runtime/templates.ts`.\n","readmeFilename":"README.md"}