{"id":13877914,"url":"https://github.com/skryukov/skooma","last_synced_at":"2025-05-15T17:05:41.928Z","repository":{"id":196686862,"uuid":"681977411","full_name":"skryukov/skooma","owner":"skryukov","description":"Skooma is a Ruby library for validating API implementations against OpenAPI documents.","archived":false,"fork":false,"pushed_at":"2025-01-14T11:49:20.000Z","size":88,"stargazers_count":162,"open_issues_count":7,"forks_count":13,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-15T17:05:35.507Z","etag":null,"topics":["hacktoberfest","openapi","rspec","ruby"],"latest_commit_sha":null,"homepage":"","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/skryukov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2023-08-23T07:04:47.000Z","updated_at":"2025-05-14T14:19:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"b9775eb1-82d1-4d5e-bd12-b9b775cf138b","html_url":"https://github.com/skryukov/skooma","commit_stats":{"total_commits":38,"total_committers":4,"mean_commits":9.5,"dds":"0.13157894736842102","last_synced_commit":"4b7bb16bf4aec88f24e4cfda092da4c3d4d7e232"},"previous_names":["skryukov/skooma"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skryukov%2Fskooma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skryukov%2Fskooma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skryukov%2Fskooma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skryukov%2Fskooma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skryukov","download_url":"https://codeload.github.com/skryukov/skooma/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384988,"owners_count":22062422,"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":["hacktoberfest","openapi","rspec","ruby"],"created_at":"2024-08-06T08:01:34.779Z","updated_at":"2025-05-15T17:05:36.899Z","avatar_url":"https://github.com/skryukov.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Skooma – Sugar for your APIs\n\n[![Gem Version](https://badge.fury.io/rb/skooma.svg)](https://rubygems.org/gems/skooma)\n[![Ruby](https://github.com/skryukov/skooma/actions/workflows/main.yml/badge.svg)](https://github.com/skryukov/skooma/actions/workflows/main.yml)\n\n\u003cimg align=\"right\" height=\"150\" width=\"150\" title=\"Skooma logo\" src=\"./assets/logo.svg\"\u003e\n\nSkooma is a Ruby library for validating API implementations against OpenAPI documents.\n\n### Features\n\n- Supports OpenAPI 3.1.0\n- Supports OpenAPI document validation\n- Supports request/response validations against OpenAPI document\n- Includes RSpec and Minitest helpers\n\n### Learn more\n\n- [Let there be docs! A documentation-first approach to Rails API development](https://evilmartians.com/chronicles/let-there-be-docs-a-documentation-first-approach-to-rails-api-development)\n\n\u003ca href=\"https://evilmartians.com/?utm_source=skooma\u0026utm_campaign=project_page\"\u003e\n\u003cimg src=\"https://evilmartians.com/badges/sponsored-by-evil-martians.svg\" alt=\"Sponsored by Evil Martians\" width=\"236\" height=\"54\"\u003e\n\u003c/a\u003e\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n    $ bundle add skooma\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n    $ gem install skooma\n\n## Usage\n\nSkooma provides `rspec` and `minitest` helpers for validating OpenAPI documents and requests/responses against them.\nSkooma helpers are designed to be used with `rails` request specs or `rack-test`.\n\n### RSpec\n\n#### Configuration\n\n```ruby\n# spec/rails_helper.rb\n\nRSpec.configure do |config|\n  # ...\n  path_to_openapi = Rails.root.join(\"docs\", \"openapi.yml\")\n  config.include Skooma::RSpec[path_to_openapi], type: :request\n\n  # OR pass path_prefix option if your API is mounted under a prefix:\n  config.include Skooma::RSpec[path_to_openapi, path_prefix: \"/internal/api\"], type: :request\n\n  # To enable coverage, pass `coverage: :report` option,\n  # and to raise an error when an operation is not covered, pass `coverage: :strict` option:\n  config.include Skooma::RSpec[path_to_openapi, coverage: :report], type: :request\nend\n```\n\n#### Validate OpenAPI document\n\n```ruby\n# spec/openapi_spec.rb\n\nrequire \"rails_helper\"\n\ndescribe \"OpenAPI document\", type: :request do\n  subject(:schema) { skooma_openapi_schema }\n\n  it { is_expected.to be_valid_document }\nend\n```\n\n#### Validate request\n\n```ruby\n# spec/requests/feed_spec.rb\n\nrequire \"rails_helper\"\n\ndescribe \"/animals/:animal_id/feed\" do  \n  let(:animal) { create(:animal, :unicorn) }\n  \n  describe \"POST\" do\n    subject { post \"/animals/#{animal.id}/feed\", body:, as: :json }\n    \n    let(:body) { {food: \"apple\", quantity: 3} }\n\n    it { is_expected.to conform_schema(200) }\n\n    context \"with wrong food type\" do\n      let(:body) { {food: \"wood\", quantity: 1} }\n    \n      it { is_expected.to conform_schema(422) }\n    end\n  end\nend\n\n# Validation Result:\n#\n#  {\"valid\"=\u003efalse,\n#   \"instanceLocation\"=\u003e\"\",\n#   \"keywordLocation\"=\u003e\"\",\n#   \"absoluteKeywordLocation\"=\u003e\"urn:uuid:1b4b39eb-9b93-4cc1-b6ac-32a25d9bff50#\",\n#   \"errors\"=\u003e\n#     [{\"instanceLocation\"=\u003e\"\",\n#       \"keywordLocation\"=\u003e\n#         \"/paths/~1animals~1{animalId}~1feed/post/responses/200\"/\n#           \"/content/application~1json/schema/required\",\n#       \"error\"=\u003e\n#         \"The object is missing required properties\"/\n#           \" [\\\"animalId\\\", \\\"food\\\", \\\"amount\\\"]\"}]}\n```\n\n### Minitest\n\n#### Configuration\n\n```ruby\n# test/test_helper.rb\npath_to_openapi = Rails.root.join(\"docs\", \"openapi.yml\")\nActionDispatch::IntegrationTest.include Skooma::Minitest[path_to_openapi]\n\n# OR pass path_prefix option if your API is mounted under a prefix:\nActionDispatch::IntegrationTest.include Skooma::Minitest[path_to_openapi, path_prefix: \"/internal/api\"], type: :request\n\n# To enable coverage, pass `coverage: :report` option,\n# and to raise an error when an operation is not covered, pass `coverage: :strict` option:\nActionDispatch::IntegrationTest.include Skooma::Minitest[path_to_openapi, coverage: :report], type: :request\n\n# EXPERIMENTAL\n# To enable support for readOnly and writeOnly keywords, pass `enforce_access_modes: true` option:\nActionDispatch::IntegrationTest.include Skooma::Minitest[path_to_openapi, enforce_access_modes: true], type: :request\n```\n\n#### Validate OpenAPI document\n\n```ruby\n# test/openapi_test.rb\n\nrequire \"test_helper\"\n\nclass OpenapiTest \u003c ActionDispatch::IntegrationTest\n  test \"is valid OpenAPI document\" do\n    assert_is_valid_document(skooma_openapi_schema)\n  end\nend\n```\n\n#### Validate request\n\n```ruby\n# test/integration/items_test.rb\n\nrequire \"test_helper\"\n\nclass ItemsTest \u003c ActionDispatch::IntegrationTest\n  test \"GET /\" do\n    get \"/\"\n    assert_conform_schema(200)\n  end\n\n  test \"POST / conforms to schema with 201 response code\" do\n    post \"/\", params: {foo: \"bar\"}, as: :json\n    assert_conform_schema(201)\n  end\n\n  test \"POST / conforms to schema with 400 response code\" do\n    post \"/\", params: {foo: \"baz\"}, as: :json\n    assert_conform_response_schema(400)\n  end\nend\n```\n\n## Alternatives\n\n- [openapi_first](https://github.com/ahx/openapi_first)\n- [committee](https://github.com/interagent/committee)\n\n## Feature plans\n\n- Full support for external `$ref`s\n- Full OpenAPI 3.1.0 support:\n  - respect `style` and `explode` keywords\n  - xml\n- Callbacks and webhooks validations\n- Example validations\n- Ability to plug in custom X-*** keyword classes\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 the created tag, 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/skryukov/skooma.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskryukov%2Fskooma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskryukov%2Fskooma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskryukov%2Fskooma/lists"}