lib/utils.rb
def insert_schemas(obj)
      if obj.is_a?(Array)
        obj.map!{|method| insert_schemas(method)}
      elsif obj.is_a?(Hash)
        @current_method = obj['method'] if obj.include?('method')
        
        obj.each { |k, v| obj[k] = insert_schemas(v)}

        if obj.include?('body')
          if obj['body'].fetch('application/x-www-form-urlencoded', {}).include?('formParameters')
            if insert_json_schema?(obj)
              insert_json_schema(obj, generate_json_schema(obj))
            end
          end
        end
      end

      obj
    end
def insert_schemas(obj)
      if obj.is_a?(Array)
        obj.map!{|method| insert_schemas(method)}
      elsif obj.is_a?(Hash)
        @current_method = obj['method'] if obj.include?('method')
        
        obj.each { |k, v| obj[k] = insert_schemas(v)}

        if obj.include?('body')
          if obj['body'].fetch('application/x-www-form-urlencoded', {}).include?('formParameters')
            if insert_json_schema?(obj)
              insert_json_schema(obj, generate_json_schema(obj))
            end
          end
        end
      end

      obj
    end
def insert_schemas ( obj ) if obj . is_a? ( Array ) obj . map! { | method | insert_schemas ( method ) } elsif obj . is_a? ( Hash ) @current_method = obj [ 'method' ] if obj . include? ( 'method' ) obj . each { | k , v | obj [ k ] = insert_schemas ( v ) } if obj . include? ( 'body' ) if obj [ 'body' ] . fetch ( 'application/x-www-form-urlencoded' , { } ) . include? ( 'formParameters' ) if insert_json_schema? ( obj ) insert_json_schema ( obj , generate_json_schema ( obj ) ) end end end end obj end
Creates a schema attribute sibling of any formParameter attribute found,
 based on the found formParameters attribute.

 Existing schema siblings of formParameter attributes are not modified.

 Modifys obj, and returns the modified obj
Creates a schema attribute sibling of any formParameter attribute found based on the found formParameters attribute .