def add_schema_hashes(obj, key=nil)
        if obj.is_a?(Array)
          obj.map! { |method| add_schema_hashes(method) }
        elsif obj.is_a?(Hash)
          obj.each { |k, v| obj[k] = add_schema_hashes(v, k)}

          if obj.include?("schema")
            
            case key
              when 'application/json'
                obj['schema_hash'] = JSON.parse(obj['schema'])

                refactor_object = lambda do |lam_obj|
                  lam_obj['properties'].each do |name, param|
                    param['displayName'] = name
                    param['required'] = true if lam_obj.fetch('required', []).include?(name)

                    if param.include?('example') and ['object', 'array'].include?(param['type'])
                      param['example'] = JSON.pretty_generate(JSON.parse(param['example']))
                    elsif param.include?('properties')
                      param['properties'] = JSON.pretty_generate(param['properties'])
                    elsif param.include?('items')
                      param['items'] = JSON.pretty_generate(param['items'])
                    end

                    lam_obj['properties'][name] = param
                  end
                  lam_obj
                end

                if obj['schema_hash'].include?('properties')
                  obj['schema_hash'] = refactor_object.call(obj['schema_hash'])
                end

                if obj['schema_hash'].include?('items') and obj['schema_hash']['items'].include?('properties')
                  obj['schema_hash']['items'] = refactor_object.call(obj['schema_hash']['items'])
                end
            end
          end
        end

        obj
      end
def add_schema_hashes(obj, key=nil)
        if obj.is_a?(Array)
          obj.map! { |method| add_schema_hashes(method) }
        elsif obj.is_a?(Hash)
          obj.each { |k, v| obj[k] = add_schema_hashes(v, k)}

          if obj.include?("schema")
            
            case key
              when 'application/json'
                obj['schema_hash'] = JSON.parse(obj['schema'])

                refactor_object = lambda do |lam_obj|
                  lam_obj['properties'].each do |name, param|
                    param['displayName'] = name
                    param['required'] = true if lam_obj.fetch('required', []).include?(name)

                    if param.include?('example') and ['object', 'array'].include?(param['type'])
                      param['example'] = JSON.pretty_generate(JSON.parse(param['example']))
                    elsif param.include?('properties')
                      param['properties'] = JSON.pretty_generate(param['properties'])
                    elsif param.include?('items')
                      param['items'] = JSON.pretty_generate(param['items'])
                    end

                    lam_obj['properties'][name] = param
                  end
                  lam_obj
                end

                if obj['schema_hash'].include?('properties')
                  obj['schema_hash'] = refactor_object.call(obj['schema_hash'])
                end

                if obj['schema_hash'].include?('items') and obj['schema_hash']['items'].include?('properties')
                  obj['schema_hash']['items'] = refactor_object.call(obj['schema_hash']['items'])
                end
            end
          end
        end

        obj
      end
Adds a 'schema_hash' attribute to bodies with 'schema', which allows for the generation of schema table views