{"id":49873446,"url":"https://github.com/sqlc-contrib/sqlc-gen-json","last_synced_at":"2026-05-15T11:18:34.703Z","repository":{"id":354984641,"uuid":"1221395258","full_name":"sqlc-contrib/sqlc-gen-json","owner":"sqlc-contrib","description":"Inspect your sqlc plugin pipeline — a WASM sqlc plugin that emits the GenerateRequest (schema, queries, settings) as JSON for debugging and prototyping.","archived":false,"fork":false,"pushed_at":"2026-05-10T01:53:23.000Z","size":339,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-10T03:40:26.641Z","etag":null,"topics":["code-generation","codegen","debugging","golang","introspection","json","mysql","postgresql","sql","sqlc","sqlc-plugin","sqlite","wasm"],"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/sqlc-contrib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-26T06:28:04.000Z","updated_at":"2026-05-10T01:53:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sqlc-contrib/sqlc-gen-json","commit_stats":null,"previous_names":["sqlc-contrib/sqlc-gen-json"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sqlc-contrib/sqlc-gen-json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlc-contrib%2Fsqlc-gen-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlc-contrib%2Fsqlc-gen-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlc-contrib%2Fsqlc-gen-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlc-contrib%2Fsqlc-gen-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sqlc-contrib","download_url":"https://codeload.github.com/sqlc-contrib/sqlc-gen-json/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlc-contrib%2Fsqlc-gen-json/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33064690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-15T02:00:06.351Z","response_time":103,"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":["code-generation","codegen","debugging","golang","introspection","json","mysql","postgresql","sql","sqlc","sqlc-plugin","sqlite","wasm"],"created_at":"2026-05-15T11:18:34.044Z","updated_at":"2026-05-15T11:18:34.697Z","avatar_url":"https://github.com/sqlc-contrib.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqlc-gen-json\n\n[![CI](https://github.com/sqlc-contrib/sqlc-gen-json/actions/workflows/ci.yml/badge.svg)](https://github.com/sqlc-contrib/sqlc-gen-json/actions/workflows/ci.yml)\n[![Release](https://img.shields.io/github/v/release/sqlc-contrib/sqlc-gen-json?include_prereleases)](https://github.com/sqlc-contrib/sqlc-gen-json/releases)\n[![License](https://img.shields.io/github/license/sqlc-contrib/sqlc-gen-json)](LICENSE)\n[![Go](https://img.shields.io/badge/Go-1.25-00ADD8?logo=go\u0026logoColor=white)](https://go.dev)\n[![sqlc](https://img.shields.io/badge/sqlc-compatible-blue)](https://sqlc.dev)\n\nA [sqlc](https://sqlc.dev) plugin that writes the `GenerateRequest` sqlc would\nhave passed to your codegen plugin out as a single JSON file.\n\nUseful for:\n\n- **Debugging plugin pipelines** — see exactly what schema, queries, settings,\n  and plugin options sqlc parsed before invoking your generator.\n- **Prototyping new plugins** — capture a real request, then iterate on a\n  generator script offline against the saved JSON.\n- **Schema snapshots** — keep a versioned JSON view of your database catalog\n  alongside the SQL.\n\n## Installation\n\nThe plugin ships as a WASM artifact. Reference it from `sqlc.yaml` with the\nrelease URL and its sha256:\n\n```yaml\nversion: \"2\"\nplugins:\n  - name: json\n    wasm:\n      url: https://github.com/sqlc-contrib/sqlc-gen-json/releases/download/v0.1.0/sqlc-gen-json.wasm\n      sha256: \u003csha256 from the release assets\u003e\n```\n\nBoth the `.wasm` and a `.wasm.sha256` sidecar are published with each\nrelease.\n\n## Configuration\n\n```yaml\nsql:\n  - engine: postgresql\n    schema: db/schema.sql\n    queries: db/queries.sql\n    codegen:\n      - plugin: json\n        out: ./gen\n        options:\n          filename: generate_request.json # optional\n          indent: \"  \" # optional; \"-\" disables indent\n          use_proto_names: false # optional\n          emit_defaults: false # optional\n```\n\n| Option            | Type    | Default                  | Description                                                                                                       |\n| ----------------- | ------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------- |\n| `filename`        | string  | `generate_request.json`  | Name of the emitted file.                                                                                         |\n| `indent`          | string  | `\"  \"` (two spaces)      | Per-level indent string passed to `protojson`. Use the sentinel `-` to emit compact (single-line) JSON.            |\n| `use_proto_names` | boolean | `false`                  | When `true`, emit field names from the proto descriptor (snake_case) instead of `protojson`'s default JSON names. |\n| `emit_defaults`   | boolean | `false`                  | When `true`, include scalar fields whose value is the zero value.                                                 |\n\nUnknown top-level options are rejected.\n\n## Output\n\nThe output is the full `plugin.GenerateRequest` from\n[`plugin-sdk-go`](https://pkg.go.dev/github.com/sqlc-dev/plugin-sdk-go/plugin)\nserialized via `protojson`. A trimmed example for a single-table schema:\n\n```json\n{\n  \"settings\": { \"engine\": \"postgresql\" },\n  \"catalog\": {\n    \"defaultSchema\": \"public\",\n    \"schemas\": [\n      {\n        \"name\": \"public\",\n        \"tables\": [\n          {\n            \"rel\": { \"schema\": \"public\", \"name\": \"users\" },\n            \"columns\": [\n              { \"name\": \"id\", \"type\": { \"name\": \"int4\" }, \"notNull\": true },\n              { \"name\": \"email\", \"type\": { \"name\": \"text\" }, \"notNull\": true }\n            ]\n          }\n        ]\n      }\n    ]\n  },\n  \"queries\": [{ \"name\": \"GetUser\", \"cmd\": \":one\" }],\n  \"sqlc_version\": \"v1.30.0\"\n}\n```\n\nNote that `plugin-sdk-go`'s proto descriptors do not consistently set\n`json_name`, so default output mixes camelCase (e.g. `defaultSchema`,\n`notNull`) and snake_case (e.g. `sqlc_version`). Set `use_proto_names: true`\nto force snake_case across the board.\n\n## Caveats\n\n- **Output is not byte-stable across runs.** `protojson.Marshal`\n  intentionally injects random whitespace to discourage byte-stable\n  diffing. For diffs, use a JSON-aware tool (`jq -S`, `diff \u003c(jq -S . a)\n  \u003c(jq -S . b)`, etc.) rather than direct text comparison.\n- **No `formatter_cmd`.** sqlc plugins cannot spawn subprocesses. If you\n  want canonical formatting, run `jq -S . generate_request.json | sponge\n  generate_request.json` (or similar) as a post-step.\n\n## Development\n\n```bash\nnix develop\ngo tool ginkgo run -r -coverprofile=coverage.out -covermode=atomic ./...\n```\n\nBuild the WASM artifact locally:\n\n```bash\nnix build .#wasm\nsha256sum result/bin/sqlc-gen-json.wasm\n```\n\nA native binary build is also exposed for convenience (used by the\nintegration tests via `gexec.Build`):\n\n```bash\nnix build .       # default == native build\n./result/bin/sqlc-gen-json --help\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqlc-contrib%2Fsqlc-gen-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsqlc-contrib%2Fsqlc-gen-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqlc-contrib%2Fsqlc-gen-json/lists"}