Module: Grape::Validations::ParamsDocumentation

Included in:
ParamsScope
Defined in:
lib/grape/validations/params_documentation.rb

Overview

Documents parameters of an endpoint. Reads from a frozen ValidationsSpec; never mutates the user’s validations hash.

Defined Under Namespace

Classes: TypeCache

Instance Method Summary collapse

Instance Method Details

#document_params(attrs, spec) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/grape/validations/params_documentation.rb', line 8

def document_params(attrs, spec)
  return if @api.inheritable_setting.namespace_inheritable[:do_not_document]

  documented_attrs = attrs.to_h do |name|
    [full_name(name), extract_details(spec)]
  end
  @api.inheritable_setting.namespace_stackable[:params] = documented_attrs
end