func GetComments(metadata *v0.Metadata) []string {
	if metadata == nil {
		return []string{}
	}
	comments := []string{}
	for _, msg := range metadata.MetadataMessage {
		var dc iv1.DocComment
		if err := msg.UnmarshalTo(&dc); err == nil {
			comments = append(comments, dc.Comment)
		}
	}
	return comments
}
GetComments returns the comment metadata found within the given metadata message.
package namespace
import (
	v0 "github.com/authzed/authzed-go/proto/authzed/api/v0"
	"google.golang.org/protobuf/proto"
	"google.golang.org/protobuf/types/known/anypb"
	iv1 "github.com/authzed/spicedb/internal/proto/impl/v1"
)
var userDefinedMetadataTypeUrls = map[string]struct{}{
	"type.googleapis.com/impl.v1.DocComment": {},
}
func FilterUserDefinedMetadata(nsconfig *v0.NamespaceDefinition) *v0.NamespaceDefinition {
	nsconfig = proto.Clone(nsconfig).(*v0.NamespaceDefinition)
	nsconfig.Metadata = nil
	for _, relation := range nsconfig.Relation {
		if relation.Metadata != nil {
			var filteredMessages []*anypb.Any
			for _, msg := range relation.Metadata.MetadataMessage {
				if _, ok := userDefinedMetadataTypeUrls[msg.TypeUrl]; !ok {
					filteredMessages = append(filteredMessages, msg)
				}
			}
			relation.Metadata.MetadataMessage = filteredMessages
		}
	}
	return nsconfig
}