{"id":13879150,"url":"https://github.com/ketiko/open_api-rspec","last_synced_at":"2025-07-16T15:31:38.224Z","repository":{"id":29818416,"uuid":"122860187","full_name":"ketiko/open_api-rspec","owner":"ketiko","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-12T05:35:41.000Z","size":97,"stargazers_count":7,"open_issues_count":9,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-27T09:04:14.298Z","etag":null,"topics":["openapi","openapi-validation","rspec-matchers"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/ketiko.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-25T17:46:31.000Z","updated_at":"2021-05-05T21:26:55.000Z","dependencies_parsed_at":"2024-11-14T13:50:52.274Z","dependency_job_id":null,"html_url":"https://github.com/ketiko/open_api-rspec","commit_stats":{"total_commits":40,"total_committers":3,"mean_commits":"13.333333333333334","dds":0.275,"last_synced_commit":"19205b457102e6c7a5e712d24d28bb6ef7070182"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/ketiko/open_api-rspec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ketiko%2Fopen_api-rspec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ketiko%2Fopen_api-rspec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ketiko%2Fopen_api-rspec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ketiko%2Fopen_api-rspec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ketiko","download_url":"https://codeload.github.com/ketiko/open_api-rspec/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ketiko%2Fopen_api-rspec/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265521429,"owners_count":23781500,"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":["openapi","openapi-validation","rspec-matchers"],"created_at":"2024-08-06T08:02:11.370Z","updated_at":"2025-07-16T15:31:37.961Z","avatar_url":"https://github.com/ketiko.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# OpenApi::RSpec [![Build Status](https://travis-ci.org/ketiko/open_api-rspec.svg?branch=master)](https://travis-ci.org/ketiko/open_api-rspec)\n\nRSpec matchers and shared examples for OpenApi\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'open_api-rspec'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install open_api-rspec\n\n## Usage\n\nAdd a file with the following:\n\n```ruby\n#file: spec/support/openapi_schema.rb\n\nRSpec.shared_context \"Shared OpenAPI JSON\" do\n  let(:open_api_json) { '{my open api json schema'} }\nend\n\nRSpec.configure do |rspec|\n  rspec.include_context \"Shared OpenAPI JSON\", type: :request\n  rspec.include_context \"Shared OpenAPI JSON\", type: :controller\nend\n```\n\nTest if your swagger.json endpoint is a valid schema.\n\n```ruby\nrequire 'rails_helper'\n\nRSpec.describe SwaggerController, type: :request do\n  describe '#swagger' do\n    before do\n      get '/swagger.json'\n    end\n\n    it { expect(response).to have_http_status(:ok) }\n    it { expect(response.body).to be_valid_openapi_schema }\n  end\nend\n```\n\nTest that a response body matches a specific OpenApi Schema.\n```ruby\nrequire 'rails_helper'\n\nRSpec.describe UsersController, type: :request do\n  describe '#show' do\n    before do\n      get '/users/1'\n    end\n\n    it { expect(response).to have_http_status(:ok) }\n    it { expect(response).to match_openapi_response_schema :User }\n  end\nend\n```\nTest that a request spec  matches an OpenApi Schema.\nThis will check body, path, query, form data params.\nIt will also fail if any unknown params are passed.\nIt checks that there is a documented response code and verifies its response schema\n```ruby\nrequire 'rails_helper'\n\nRSpec.describe UsersController, type: :request do\n  describe '#show' do\n    before do\n      get '/users/1'\n    end\n\n    it { expect(response).to have_http_status(:ok) }\n    it { expect(response).to match_openapi_response_schema :User }\n    it_behaves_like :an_openapi_endpoint\n  end\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/open_api-rspec.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fketiko%2Fopen_api-rspec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fketiko%2Fopen_api-rspec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fketiko%2Fopen_api-rspec/lists"}