Ruby
The following section covers the components of Ruby frameworks and their library components that NightVision’s API Discovery capability can detect and use to generate OpenAPI documentation. If a component that you use is not supported, please get in touch with our support team at support@nightviz.ai, and we can add this as a new feature.
Ruby on Rails
Section titled “Ruby on Rails”| Library Component | Description |
|---|---|
| ActionController::Base | The base class for all controllers in Rails, providing shared functionality such as rendering and redirects. |
| ActionController::Parameters | Provides a way to handle strong parameters to prevent unwanted attributes from being used in ActiveRecord operations. |
| ActionDispatch::Routing::RouteSet | Manages the routing rules in a Rails application and is responsible for mapping incoming requests to controllers and actions. |
| resources | Defines standard RESTful routes for a collection of resources, including actions like index, create, new, edit, show, update, and destroy. |
| resource | Similar to resources, but used for a singular resource which doesn’t require index or create routes. |
| namespace | Groups controllers under a specific namespace and routes the incoming requests accordingly. |
| member | A routing method that adds more routes to a single resource using standard HTTP verbs which act on a specific member. |
| collection | A routing method that adds additional routes to a collection of resources, not just a single resource. |
| get | Defines a route for a GET request to a specified path mapped to a controller action. |
| post | Defines a route for a POST request to a specified path which typically handles the creation of a resource. |
| put | Defines a route for a PUT request to a specified path which typically handles the updating of a resource. |
| patch | Defines a route for a PATCH request, often used interchangeably with PUT, to update a specific resource. |
| delete | Defines a route for a DELETE request to remove a specific resource. |
| draw | Method used within the routes.rb file to draw routes using a block of routing definitions. |
| Library Component | Description |
|---|---|
| Grape::DSL::Routing::ClassMethods | Class that provides major part of Grape routing related DSL |
| resource | Similar to resources, but used for a singular resource which doesn’t require index or create routes. |
| namespace | Groups controllers under a specific namespace and routes the incoming requests accordingly. |
| get | Defines a route for a GET request to a specified path mapped to a controller action. |
| post | Defines a route for a POST request to a specified path which typically handles the creation of a resource. |
| put | Defines a route for a PUT request to a specified path which typically handles the updating of a resource. |
| patch | Defines a route for a PATCH request, often used interchangeably with PUT, to update a specific resource. |
| delete | Defines a route for a DELETE request to remove a specific resource. |
| mount | Mounts another Grape API or Rack application at a specified path within the current API. |
| version | Specifies the API version, allowing you to define versioned routes and handle different versions of your API endpoints. |
| params | Defines parameters for the route, specifying expected inputs and validations. |
| prefix | Sets a prefix for all routes within the API, effectively changing the base path for all endpoints. |
Authentication and security schemes
Section titled “Authentication and security schemes”NightVision reads authentication guards on Ruby routes and records them as OpenAPI security schemes. See the Framework Support Index for how schemes and the x-unsound marker are represented.
Ruby on Rails
Section titled “Ruby on Rails”Controller before_action filters are followed, including inheritance from parent controllers and skip_before_action, with the only: and except: options scoping which actions a filter guards:
| Library Component | OpenAPI Security Scheme |
|---|---|
before_action :authenticate_user! (Devise) and session-based login filters | Session cookie |
http_basic_authenticate_with | HTTP basic |
authenticate_or_request_with_http_token and the HTTP token family | HTTP bearer |
authenticate_or_request_with_http_digest | HTTP digest |
Convention-named authentication filters (for example require_login, require_authentication, require_user) are recognized as session guards and flagged x-unsound, as is a Devise classification that is corroborated only by naming.
| Library Component | OpenAPI Security Scheme |
|---|---|
http_basic | HTTP basic |
http_digest | HTTP digest |
A before/before_validation block that enforces authentication | HTTP bearer or basic, flagged x-unsound |
Grape mounted and namespaced APIs inherit the guards of their enclosing scope.
Role and scope names are not extracted for Ruby, so no x-roles are emitted.