You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: merge_schemas.go
    path of file: ./repos/oapi-codegen/pkg/codegen
    
    the code of the file until where you have to start completion: package codegen

import (
	"errors"
	"fmt"
	"strings"

	"github.com/getkin/kin-openapi/openapi3"
)

// MergeSchemas merges all the fields in the schemas 
    
func valueWithPropagatedRef(ref *openapi3.SchemaRef) (openapi3.Schema, error) {
	if len(ref.Ref) == 0 || ref.Ref[0] == '#' {
		return *ref.Value, nil
	}

	pathParts := strings.Split(ref.Ref, "#")
	if len(pathParts) < 1 || len(pathParts) > 2 {
		return openapi3.Schema{}, fmt.Errorf("unsupported reference: %s", ref.Ref)
	}
	remoteComponent := pathParts[0]

	// remote ref
	schema := *ref.Value
	for _, value := range schema.Properties {
		if len(value.Ref) > 0 && value.Ref[0] == '#' {
			// local reference, should propagate remote
			value.Ref = remoteComponent + value.Ref
		}
	}

	return schema, nil
}