Skip to content

Commit

Permalink
Remove unused methods in GrapeSwagger::DocMethods::BuildModelDefiniti…
Browse files Browse the repository at this point in the history
…on (ruby-grape#856)

Co-authored-by: peter scholz <pscholz.le@gmail.com>
  • Loading branch information
2 people authored and aka-momo committed Feb 8, 2023
1 parent 0b5e948 commit 5b08872
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions lib/grape-swagger/doc_methods/build_model_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ module GrapeSwagger
module DocMethods
class BuildModelDefinition
class << self
def build(model, properties, required, other_def_properties = {})
def build(_model, properties, required, other_def_properties = {})
definition = { type: 'object', properties: properties }.merge(other_def_properties)

if required.nil?
required_attrs = required_attributes(model)
definition[:required] = required_attrs unless required_attrs.blank?
end

definition[:required] = required if required.is_a?(Array) && required.any?

definition
Expand Down Expand Up @@ -67,20 +62,6 @@ def parse_refs_and_models(refs_or_models, model)
end
end
end

private

def required_attributes(model)
parse_entity(model) || parse_representable(model)
end

def parse_entity(model)
return unless model.respond_to?(:documentation)
end

def parse_representable(model)
return unless model.respond_to?(:map)
end
end
end
end
Expand Down

0 comments on commit 5b08872

Please sign in to comment.