{"id":23060095,"url":"https://github.com/rodrigosetti/swagger-test","last_synced_at":"2025-08-15T08:31:39.780Z","repository":{"id":56879584,"uuid":"101358007","full_name":"rodrigosetti/swagger-test","owner":"rodrigosetti","description":"Property based testing tool for Swagger APIs","archived":false,"fork":false,"pushed_at":"2021-01-12T23:33:13.000Z","size":87,"stargazers_count":33,"open_issues_count":4,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-24T13:45:35.355Z","etag":null,"topics":["haskell","property-based-testing","swagger","testing"],"latest_commit_sha":null,"homepage":"http://hackage.haskell.org/package/swagger-test","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rodrigosetti.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}},"created_at":"2017-08-25T02:37:20.000Z","updated_at":"2022-09-27T12:20:33.000Z","dependencies_parsed_at":"2022-08-20T11:40:39.802Z","dependency_job_id":null,"html_url":"https://github.com/rodrigosetti/swagger-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigosetti%2Fswagger-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigosetti%2Fswagger-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigosetti%2Fswagger-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigosetti%2Fswagger-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rodrigosetti","download_url":"https://codeload.github.com/rodrigosetti/swagger-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229901646,"owners_count":18141740,"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","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":["haskell","property-based-testing","swagger","testing"],"created_at":"2024-12-16T03:11:26.026Z","updated_at":"2024-12-16T03:11:26.587Z","avatar_url":"https://github.com/rodrigosetti.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swagger-test\n\nThis is a tool for\n[Property Based Testing](https://en.wikipedia.org/wiki/Property_testing)\nof [swagger](https://swagger.io) APIs.\n\nIt basically allow you to approximate the computation of the following\nproposition:\n\n![](https://latex.codecogs.com/png.latex?\\forall\u0026space;\\,\u0026space;input\u0026space;\\in\u0026space;\\text{API}\u0026space;\\,\u0026space;:\u0026space;\\underset{API}{valid}(input)\u0026space;\\Rightarrow\u0026space;\\underset{API}{valid}(output)\u0026space;\\\\\u0026space;\\text{where}\u0026space;\\\\\u0026space;output\u0026space;=\u0026space;\\underset{API}{request}(input))\n\n\nWhich translates to:\n\n\u003e For all valid requests that can be derived from my Swagger schema, the\n\u003e API response obtained from a service that implements the schema is valid.\n\nThe tool exposes several ways to derive value from the Swagger schema, for\nexample, you may be interested in getting just a random valid request from the\nschema (use the `generate` command), or validating if a given response (from a\nparticular operation) is valid (use the `validate` command), or, run one sample\ninstance of the full proposition, which picks a random request and validate its\nresulting response (use the `request` command).\n\nThe random requests generator is deterministic by given the same _seed_\nvalue, or one can focus on a particular operation by specifying the operation\nid.\n\nThe tool also simplifies integration with other systems by allowing to configure\noutput formats as standard HTTP message, JSON, or [curl](https://curl.se).\nAdditionally, there are Haskell modules exposed as a library if one wants to\nbuild on top of it.\n\n## Command Line Interface\n\n*swagger-test* supports four commands:\n\n * `generate` - generates a new random valid request from the Swagger schema.\n * `validate` - validate a response to a given operation id, according to the\n   schema.\n * `request` - generate and make the request, then validates the response\n   (combines generate and validate).\n * `report` - high-level command that run several requests concurrently, and\n   write HTML reports for multiple Swagger schemas. Useful for testing systems\n   with many Swagger services in a CI server.\n\n```console\nswagger-test --help\n```\n\n```\nProperty-based testing tool for Swagger APIs\n\nUsage: swagger-test COMMAND\n  Execute one of the commands available depending on your needs\n\nAvailable options:\n  -h,--help                Show this help text\n\nAvailable commands:\n  generate                 Generate a random request according to Schema\n  validate                 Validate a response against Schema\n  request                  Generate, make the request, and validate response\n  report                   Run several tests and generate reports\n\nRun `COMMAND --help` to get command specific options help\n```\n\n### Sub-commands\n\n#### Generate\n\n```console\nswagger-test generate --help\n```\n\n```\nUsage: swagger-test generate [-s|--schema FILENAME] [--seed N]\n                             [-o|--operation ID]\n                             [--request-format http|curl|none|json]\n                             [-i|--info] [--size N]\n  Generate a random request according to Schema\n\nAvailable options:\n  -s,--schema FILENAME     swagger JSON schema file to read\n                           from (default: \"swagger.json\")\n  --seed N                 specify the seed for the random generator\n  -o,--operation ID        specify a operation id to test (default pick\n                           randomly)\n  --request-format http|curl|none|json\n                           output format of the HTTP request (default: http)\n  -i,--info                render information about seed and operation id\n  --size N                 control the size of the generated\n                           request (default: 30)\n  -h,--help                Show this help text\n```\n\n#### Validate\n\n```console\nswagger-test validate --help\n```\n\n```\nUsage: swagger-test validate [-s|--schema FILENAME] [FILENAME]\n                             (-o|--operation ID)\n  Validate a response against Schema\n\nAvailable options:\n  -s,--schema FILENAME     swagger JSON schema file to read\n                           from (default: \"swagger.json\")\n  FILENAME                 http response file to read from (default=stdin)\n  -o,--operation ID        specify a operation id to test (default pick\n                           randomly)\n  -h,--help                Show this help text\n```\n\n#### Request\n\n```console\nswagger-test request --help\n```\n\n```\nUsage: swagger-test request [-s|--schema FILENAME] [--seed N]\n                            [-o|--operation ID]\n                            [--request-format http|curl|none|json]\n                            [--response-format http|json|none] [-i|--info]\n                            [--size N]\n  Generate, make the request, and validate response\n\nAvailable options:\n  -s,--schema FILENAME     swagger JSON schema file to read\n                           from (default: \"swagger.json\")\n  --seed N                 specify the seed for the random generator\n  -o,--operation ID        specify a operation id to test (default pick\n                           randomly)\n  --request-format http|curl|none|json\n                           output format of the HTTP request (default: none)\n  --response-format http|json|none\n                           output format of the HTTP request (default: none)\n  -i,--info                render information about seed and operation id\n  --size N                 control the size of the generated\n                           request (default: 30)\n  -h,--help                Show this help text\n```\n\n#### Report\n\n```console\nswagger-test report --help\n```\n\n```\nUsage: swagger-test report [--schemas PATH] [--reports PATH] [--tests N]\n                           [--size N]\n  Run several tests and generate reports\n\nAvailable options:\n  --schemas PATH           path to folder with swagger\n                           schemas (default: \"schemas\")\n  --reports PATH           path to folder to write the HTML\n                           reports (default: \"reports\")\n  --tests N                number of tests to run (default: 100)\n  --size N                 control the size of the generated\n                           request (default: 30)\n  -h,--help                Show this help text\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodrigosetti%2Fswagger-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frodrigosetti%2Fswagger-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodrigosetti%2Fswagger-test/lists"}