{"id":21157687,"url":"https://github.com/snikch/goodman","last_synced_at":"2025-07-29T20:34:22.045Z","repository":{"id":57481080,"uuid":"41761060","full_name":"snikch/goodman","owner":"snikch","description":"Go Hook Handler for Dredd","archived":false,"fork":false,"pushed_at":"2017-11-25T02:47:57.000Z","size":9324,"stargazers_count":21,"open_issues_count":4,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-13T11:47:41.496Z","etag":null,"topics":["dredd","dredd-hooks","go"],"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/snikch.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}},"created_at":"2015-09-01T20:14:56.000Z","updated_at":"2024-12-29T23:05:05.000Z","dependencies_parsed_at":"2022-09-26T17:41:26.760Z","dependency_job_id":null,"html_url":"https://github.com/snikch/goodman","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/snikch/goodman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snikch%2Fgoodman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snikch%2Fgoodman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snikch%2Fgoodman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snikch%2Fgoodman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snikch","download_url":"https://codeload.github.com/snikch/goodman/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snikch%2Fgoodman/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267754757,"owners_count":24139434,"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-07-29T02:00:12.549Z","response_time":2574,"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":["dredd","dredd-hooks","go"],"created_at":"2024-11-20T12:06:00.100Z","updated_at":"2025-07-29T20:34:22.006Z","avatar_url":"https://github.com/snikch.png","language":"Go","readme":"# Goodman [![Godoc Reference](http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](https://godoc.org/github.com/snikch/goodman) ![Travis Status](https://travis-ci.org/snikch/goodman.svg?branch=master)\n\nGoodman is a [Dredd](https://github.com/apiaryio/dredd) hook handler implementation in Go. The API may change, please Vendor this library.\n\n## About\nThis package contains a Go Dredd hook handler which provides a bridge between the [Dredd API Testing Framework](http://dredd.readthedocs.org/en/latest/)\n and Go environment to ease implementation of testing hooks provided by [Dredd](http://dredd.readthedocs.org/en/latest/). Write Dredd hooks in Go to glue together [API Blueprint](https://apiblueprint.org/) with your Go project\n\nNot sure what these Dredd Hooks are?  Read the Dredd documentation on [them](http://dredd.readthedocs.org/en/latest/hooks/)\n\nThe following are a few examples of what hooks can be used for:\n\n- loading db fixtures\n- cleanup after test step or steps\n- handling authentication and sessions\n- passing data between transactions (saving state from responses to stash)\n- modifying request generated from blueprint\n- changing generated expectations\n- setting custom expectations\n- debugging via logging stuff\n\n\n## Installing\n\n**Must use Dredd v1.1.0 or greater**\n\n```bash\ngo get github.com/snikch/goodman/cmd/goodman\n```\n\n## Usage\n\n1). Create a hook file in `hooks.go`\n\n```go\npackage main\n\nimport (\n  \"fmt\"\n\n  \"github.com/snikch/goodman/hooks\"\n  trans \"github.com/snikch/goodman/transaction\"\n)\n\nfunc main() {\n      h := hooks.NewHooks()\n      server := hooks.NewServer(hooks.NewHooksRunner(h))\n      h.Before(\"/message \u003e GET\", func(t *trans.Transaction) {\n          fmt.Println(\"before modification\")\n      })\n      server.Serve()\n      defer server.Listener.Close()\n})\n\n```\n\n2). Compile your hooks program\n\n```bash\ngo build -o hooks path/to/hooks.go\n```\n\n3). Run it with dredd\n\n`dredd apiary.apib localhost:3000 --language go --hookfiles ./hooks`\n\n## API\n\nThe `hooks.Server` struct provides the following methods to hook into the following dredd transactions: `before`, `after`, `before_all`, `after_all`, `before_each`, `after_each`, `before_validation`, and `before_each_validation`.\nThe `before`, `before_validation` and `after` hooks are identified by [transaction name](http://dredd.readthedocs.org/en/latest/hooks/#getting-transaction-names).\n\n## How to Contribute\n\n1. Fork it\n2. Create your feature branch (git checkout -b my-newfeature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push (git push origin my-new-feature)\n5. Create a new Pull Request\n\n## Tests\n\nThe test suite consists of go test suite and aruba/cucumber tests\n\nRunning the tests\n\n- go tests `go test github.com/snikch/{,/hooks,/transaction}`\n\n- aruba tests\n  - Install local dredd copy `npm install`\n  - Install aruba ruby gem `bundle install`\n  - Run test suite `bundle exec cucumber`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnikch%2Fgoodman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnikch%2Fgoodman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnikch%2Fgoodman/lists"}