Skip to content

RBS generator #1

@supermomonga

Description

@supermomonga

I am considering the following implementation approach:

  1. Load the Rails application and list the routes.
  2. Cross-reference the routing list in the Schema file to identify parameter definitions for each route.
  3. Convert to RBS.

When retrieving typed_params from a Rails controller, we may need to use overloading to identify the calling action.

class UsersController < ApplicationController
  def self.typed_params_for: (:index) -> TypedParamsForIndexAction
                           | (:show) -> TypedParamsForShowAction
end
class UsersController < ApplicationController
  def index
    typed_params = typed_params_for(:index)
  end
  def show
    typed_params = typed_params_for(:show)
  end
end

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions