# rswag

> Seamlessly adds a Swagger to Rails-based API's

Source: https://talira.ai/catalog/rswag-f0zkee6s
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [developer tools / api / documentation](https://talira.ai/categories/developer-tools/api/documentation), [developer tools / testing / api](https://talira.ai/categories/developer-tools/testing/api), [languages / ruby / rails](https://talira.ai/categories/languages/ruby/rails)
- Platforms: linux, macos, windows
- Licence: MIT
- Pricing: Free and open source
- Free tier: yes
- Self-hostable: yes

rswag extends rspec-rails request specs with a DSL that describes each API operation (path, parameters, request body, responses and their schemas) and runs it as a test. Once the tests pass, a rake task writes the OpenAPI 3.0 file from them, so the documentation can't drift from what the API does. rswag-api serves the file as JSON or YAML and rswag-ui embeds swagger-ui to explore and try the API. The project is looking for maintainers.

## Links

- GitHub: https://github.com/rswag/rswag

## Problems it solves

- our API documentation keeps going out of date with what the code does
- generate an OpenAPI spec from tests for a Rails API
- test every API endpoint's response against its documented schema
- serve interactive API docs where people can try requests
- write API tests and API docs once instead of twice
- an OpenAPI file produced by passing API tests, so the docs and anything generated from it match the API
- document several versions of our Rails API side by side
- check request and response examples in the docs are real

## Features

- RSpec DSL for paths, operations, parameters and responses
- response validation against JSON schemas
- OpenAPI 3.0 file generation (rake rswag:specs:swaggerize)
- oneOf, anyOf and allOf schemas
- several API documents and versions
- JSON and YAML endpoints (rswag-api)
- embedded swagger-ui (rswag-ui)

## Trust

Overall: 0.41 out of 1.
Signals: maintenance 0.45, adoption 0.67, momentum 0.37, community 0.86, backing 0.00, extensibility 0.00.

- last commit 3 months ago
- latest release 2.17.0 12 months ago
- 2.2k GitHub stars
- 140 contributors

## Alternatives

- [ReadMe](https://talira.ai/catalog/readme-jbzg262n.md): Build docs that developers love and AI can actually read
- [Mintlify](https://talira.ai/catalog/mintlify-a1nxaz4m.md): The documentation platform for agents
- [GitBook](https://talira.ai/catalog/gitbook-tj77c96x.md): GitBook keeps docs accurate, for both people and AI
- [Stoplight](https://talira.ai/catalog/stoplight-r2j9hckj.md): Design, document, and build APIs faster
