class OasRails::Builders::ParametersBuilder
def build
def build @parameters.map do |p| @specification.components.add_parameter(p) end end
def from_oas_route(oas_route)
def from_oas_route(oas_route) parameters_from_tags(tags: oas_route.docstring.tags(:parameter)) oas_route.path_params.try(:map) do |p| @parameters << ParameterBuilder.new(@specification).from_path(oas_route.path, p).build unless @parameters.any? { |param| param.name.to_s == p.to_s } end self end
def initialize(specification)
def initialize(specification) @specification = specification @parameters = [] end
def parameters_from_tags(tags:)
def parameters_from_tags(tags:) tags.each do |t| parameter = Spec::Parameter.new(@specification) parameter.name = t.name parameter.in = t.location parameter.required = t.required parameter.schema = t.schema parameter.description = t.text @parameters << parameter end self end