refactor: Improve readability with explicit parameter names

pull/11825/head
Christophe Bliard 2 years ago
parent 36a2e1de9d
commit 33a591b49d
No known key found for this signature in database
GPG Key ID: 2BC07603210C3FA4
  1. 6
      lib/api/decorators/property_schema_representer.rb
  2. 62
      lib/api/decorators/schema_representer.rb
  3. 12
      lib/api/v3/queries/schemas/query_schema_representer.rb

@ -82,17 +82,17 @@ module API
property :min_length, exec_context: :decorator
property :max_length, exec_context: :decorator
property :regular_expression, exec_context: :decorator
property :deprecated, exec_context: :decorator, render_nil: false
property :deprecated, exec_context: :decorator
property :options, exec_context: :decorator
property :location, exec_context: :decorator, render_nil: false
property :location, exec_context: :decorator
formattable_property :description,
exec_context: :decorator,
render_nil: false,
setter: nil,
getter: ->(*) do
next unless description.present?
next if description.blank?
::API::Decorators::Formattable.new(description)
end

@ -83,12 +83,12 @@ module API
end
schema_property(property,
getter,
show_if,
required,
has_default,
name_source,
as)
getter:,
show_if:,
required:,
has_default:,
name_source:,
as:)
end
def schema_with_allowed_link(property,
@ -112,12 +112,12 @@ module API
end
schema_property(property,
getter,
show_if,
required,
has_default,
name_source,
as)
getter:,
show_if:,
required:,
has_default:,
name_source:,
as:)
end
def schema_with_allowed_collection(property,
@ -150,12 +150,12 @@ module API
end
schema_property(property,
getter,
show_if,
required,
has_default,
name_source,
as)
getter:,
show_if:,
required:,
has_default:,
name_source:,
as:)
end
def schema_with_allowed_string_collection(property,
@ -189,25 +189,25 @@ module API
end
schema_property(property,
getter,
show_if,
required,
has_default,
name_source,
as)
getter:,
show_if:,
required:,
has_default:,
name_source:,
as:)
end
def schema_property(property,
getter,
show_if,
required,
has_default,
name_source,
property_alias)
getter:,
show_if:,
required:,
has_default:,
name_source:,
as:)
raise ArgumentError unless property
property property,
as: property_alias,
as:,
exec_context: :decorator,
getter:,
if: show_if,

@ -187,12 +187,12 @@ module API
}
schema_property :filters,
filters_schema,
true,
false,
true,
:filters,
:filters
getter: filters_schema,
show_if: true,
required: false,
has_default: true,
name_source: :filters,
as: :filters
schema_with_allowed_collection :group_by,
type: '[]QueryGroupBy',

Loading…
Cancel
Save