Repository: apigee/registry
Pull request #1042 (2023-02-22 22:52:19)

Move pkg/types to pkg/mime
Step 3 of #1037

codecov[bot]: # [Codecov](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) Report
> Merging [#1042](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) (0af8437) into [main](https://codecov.io/gh/apigee/registry/commit/2c08b37a4b7c45524dfdf66ff2a09f9ccaeb4a3e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) (2c08b37) will **not change** coverage.
> The diff coverage is `44.11%`.

> :exclamation: Current head 0af8437 differs from pull request most recent head 0dcbcef. Consider uploading reports for the commit 0dcbcef to get more accurate results

```diff
@@           Coverage Diff           @@
##             main    #1042   +/-   ##
=======================================
  Coverage   67.88%   67.88%           
=======================================
  Files         146      146           
  Lines       11896    11896           
=======================================
  Hits         8076     8076           
  Misses       3123     3123           
  Partials      697      697           
```


| [Impacted Files](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) | Coverage Δ | |
|---|---|---|
| [...md/registry/cmd/compute/conformance/conformance.go](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#diff-Y21kL3JlZ2lzdHJ5L2NtZC9jb21wdXRlL2NvbmZvcm1hbmNlL2NvbmZvcm1hbmNlLmdv) | `55.17% <ø> (ø)` | |
| [cmd/registry/cmd/compute/lint/lint.go](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#diff-Y21kL3JlZ2lzdHJ5L2NtZC9jb21wdXRlL2xpbnQvbGludC5nbw==) | `7.40% <0.00%> (ø)` | |
| [cmd/registry/cmd/compute/lintstats/lintstats.go](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#diff-Y21kL3JlZ2lzdHJ5L2NtZC9jb21wdXRlL2xpbnRzdGF0cy9saW50c3RhdHMuZ28=) | `4.18% <0.00%> (ø)` | |
| [cmd/registry/cmd/compute/vocabulary/vocabulary.go](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#diff-Y21kL3JlZ2lzdHJ5L2NtZC9jb21wdXRlL3ZvY2FidWxhcnkvdm9jYWJ1bGFyeS5nbw==) | `4.46% <0.00%> (ø)` | |
| [cmd/registry/conformance/conformance-task.go](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#diff-Y21kL3JlZ2lzdHJ5L2NvbmZvcm1hbmNlL2NvbmZvcm1hbmNlLXRhc2suZ28=) | `45.50% <0.00%> (ø)` | |
| [cmd/registry/controller/local-tasks.go](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#diff-Y21kL3JlZ2lzdHJ5L2NvbnRyb2xsZXIvbG9jYWwtdGFza3MuZ28=) | `31.94% <0.00%> (ø)` | |
| [pkg/mime/types.go](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#diff-cGtnL21pbWUvdHlwZXMuZ28=) | `100.00% <ø> (ø)` | |
| [cmd/registry/cmd/compute/complexity/complexity.go](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#diff-Y21kL3JlZ2lzdHJ5L2NtZC9jb21wdXRlL2NvbXBsZXhpdHkvY29tcGxleGl0eS5nbw==) | `42.40% <40.00%> (ø)` | |
| [cmd/registry/scoring/score.go](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#diff-Y21kL3JlZ2lzdHJ5L3Njb3Jpbmcvc2NvcmUuZ28=) | `75.15% <50.00%> (ø)` | |
| [cmd/registry/scoring/scorecard.go](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#diff-Y21kL3JlZ2lzdHJ5L3Njb3Jpbmcvc2NvcmVjYXJkLmdv) | `55.46% <50.00%> (ø)` | |
| ... and [8 more](https://codecov.io/gh/apigee/registry/pull/1042?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) | |

:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee)


Patch:
diff --git a/cmd/registry/cmd/check/rules/rule1000/rule1000.go b/cmd/registry/cmd/check/rules/rule1000/rule1000.go
index d7b6ecc..85f8db4 100644
--- a/cmd/registry/cmd/check/rules/rule1000/rule1000.go
+++ b/cmd/registry/cmd/check/rules/rule1000/rule1000.go
@@ -22,8 +22,8 @@ import (
 	"github.com/apigee/registry/cmd/registry/cmd/check/lint"
 	"github.com/apigee/registry/pkg/application/apihub"
 	"github.com/apigee/registry/pkg/application/check"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"google.golang.org/protobuf/proto"
@@ -90,7 +90,7 @@ var requiredArtifacts = &lint.ProjectRule{
 }
 
 func checkTaxonomies(a *rpc.Artifact) []*check.Problem {
-	message, err := types.MessageForMimeType(a.GetMimeType())
+	message, err := mime.MessageForMimeType(a.GetMimeType())
 	if err == nil {
 		err = proto.Unmarshal(a.GetContents(), message)
 	}
diff --git a/cmd/registry/cmd/check/rules/rule1002/rule1002.go b/cmd/registry/cmd/check/rules/rule1002/rule1002.go
index 9b220a8..bc10054 100644
--- a/cmd/registry/cmd/check/rules/rule1002/rule1002.go
+++ b/cmd/registry/cmd/check/rules/rule1002/rule1002.go
@@ -21,7 +21,7 @@ import (
 
 	"github.com/apigee/registry/cmd/registry/cmd/check/lint"
 	"github.com/apigee/registry/pkg/application/check"
-	"github.com/apigee/registry/pkg/types"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/rpc"
 	"google.golang.org/protobuf/proto"
 )
@@ -62,7 +62,7 @@ var internalMimeTypeContents = &lint.FieldRule{
 		// internal types, see github.com/apigee/registry/cmd/registry/types
 		typeParam := declaredParameters["type"]
 		if strings.HasPrefix(typeParam, "google.cloud.apigeeregistry.") || strings.HasPrefix(typeParam, "gnostic.metrics.") {
-			message, err := types.MessageForMimeType(declared)
+			message, err := mime.MessageForMimeType(declared)
 			if err != nil {
 				return []*check.Problem{{
 					Severity:   check.Problem_ERROR,
diff --git a/cmd/registry/cmd/compute/complexity/complexity.go b/cmd/registry/cmd/compute/complexity/complexity.go
index 595e008..a3cbe78 100644
--- a/cmd/registry/cmd/compute/complexity/complexity.go
+++ b/cmd/registry/cmd/compute/complexity/complexity.go
@@ -23,8 +23,8 @@ import (
 	"github.com/apigee/registry/cmd/registry/tasks"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/spf13/cobra"
@@ -139,28 +139,28 @@ func (task *computeComplexityTask) Run(ctx context.Context) error {
 		}
 	}
 	var complexity *metrics.Complexity
-	if types.IsOpenAPIv2(spec.GetMimeType()) {
+	if mime.IsOpenAPIv2(spec.GetMimeType()) {
 		document, err := oas2.ParseDocument(contents)
 		if err != nil {
 			log.FromContext(ctx).WithError(err).Errorf("Invalid OpenAPI: %s", task.specName)
 			return nil
 		}
 		complexity = SummarizeOpenAPIv2Document(document)
-	} else if types.IsOpenAPIv3(spec.GetMimeType()) {
+	} else if mime.IsOpenAPIv3(spec.GetMimeType()) {
 		document, err := oas3.ParseDocument(contents)
 		if err != nil {
 			log.FromContext(ctx).WithError(err).Errorf("Invalid OpenAPI: %s", task.specName)
 			return nil
 		}
 		complexity = SummarizeOpenAPIv3Document(document)
-	} else if types.IsDiscovery(spec.GetMimeType()) {
+	} else if mime.IsDiscovery(spec.GetMimeType()) {
 		document, err := discovery.ParseDocument(contents)
 		if err != nil {
 			log.FromContext(ctx).WithError(err).Errorf("Invalid Discovery: %s", task.specName)
 			return nil
 		}
 		complexity = SummarizeDiscoveryDocument(document)
-	} else if types.IsProto(spec.GetMimeType()) && types.IsZipArchive(spec.GetMimeType()) {
+	} else if mime.IsProto(spec.GetMimeType()) && mime.IsZipArchive(spec.GetMimeType()) {
 		complexity, err = SummarizeZippedProtos(contents)
 		if err != nil {
 			log.FromContext(ctx).WithError(err).Errorf("Error processing protos: %s", task.specName)
@@ -178,7 +178,7 @@ func (task *computeComplexityTask) Run(ctx context.Context) error {
 	messageData, _ := proto.Marshal(complexity)
 	artifact := &rpc.Artifact{
 		Name:     subject + "/artifacts/" + relation,
-		MimeType: types.MimeTypeForMessageType("gnostic.metrics.Complexity"),
+		MimeType: mime.MimeTypeForMessageType("gnostic.metrics.Complexity"),
 		Contents: messageData,
 	}
 	return visitor.SetArtifact(ctx, task.client, artifact)
diff --git a/cmd/registry/cmd/compute/conformance/conformance.go b/cmd/registry/cmd/compute/conformance/conformance.go
index a414fc6..878f339 100644
--- a/cmd/registry/cmd/compute/conformance/conformance.go
+++ b/cmd/registry/cmd/compute/conformance/conformance.go
@@ -23,15 +23,15 @@ import (
 	"github.com/apigee/registry/pkg/application/style"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/spf13/cobra"
 	"google.golang.org/protobuf/proto"
 )
 
-var styleguideFilter = fmt.Sprintf("mime_type.contains('%s')", types.MimeTypeForKind("StyleGuide"))
+var styleguideFilter = fmt.Sprintf("mime_type.contains('%s')", mime.MimeTypeForKind("StyleGuide"))
 
 func Command() *cobra.Command {
 	cmd := &cobra.Command{
diff --git a/cmd/registry/cmd/compute/lint/lint.go b/cmd/registry/cmd/compute/lint/lint.go
index 435dbad..005085e 100644
--- a/cmd/registry/cmd/compute/lint/lint.go
+++ b/cmd/registry/cmd/compute/lint/lint.go
@@ -22,8 +22,8 @@ import (
 	"github.com/apigee/registry/pkg/application/style"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/spf13/cobra"
@@ -120,7 +120,7 @@ func (task *computeLintTask) Run(ctx context.Context) error {
 	}
 	var relation string
 	var lint *style.Lint
-	if types.IsOpenAPIv2(spec.GetMimeType()) || types.IsOpenAPIv3(spec.GetMimeType()) {
+	if mime.IsOpenAPIv2(spec.GetMimeType()) || mime.IsOpenAPIv3(spec.GetMimeType()) {
 		// the default openapi linter is gnostic
 		if task.linter == "" {
 			task.linter = "gnostic"
@@ -131,9 +131,9 @@ func (task *computeLintTask) Run(ctx context.Context) error {
 		if err != nil {
 			return fmt.Errorf("error processing OpenAPI: %s (%s)", spec.Name, err.Error())
 		}
-	} else if types.IsDiscovery(spec.GetMimeType()) {
+	} else if mime.IsDiscovery(spec.GetMimeType()) {
 		return fmt.Errorf("unsupported Discovery document: %s", spec.Name)
-	} else if types.IsProto(spec.GetMimeType()) && types.IsZipArchive(spec.GetMimeType()) {
+	} else if mime.IsProto(spec.GetMimeType()) && mime.IsZipArchive(spec.GetMimeType()) {
 		// the default proto linter is the aip linter
 		if task.linter == "" {
 			task.linter = "aip"
@@ -157,7 +157,7 @@ func (task *computeLintTask) Run(ctx context.Context) error {
 	messageData, _ := proto.Marshal(lint)
 	artifact := &rpc.Artifact{
 		Name:     subject + "/artifacts/" + relation,
-		MimeType: types.MimeTypeForMessageType("google.cloud.apigeeregistry.applications.v1alpha1.Lint"),
+		MimeType: mime.MimeTypeForMessageType("google.cloud.apigeeregistry.applications.v1alpha1.Lint"),
 		Contents: messageData,
 	}
 	return visitor.SetArtifact(ctx, task.client, artifact)
diff --git a/cmd/registry/cmd/compute/lintstats/lintstats.go b/cmd/registry/cmd/compute/lintstats/lintstats.go
index 54f3847..78883dc 100644
--- a/cmd/registry/cmd/compute/lintstats/lintstats.go
+++ b/cmd/registry/cmd/compute/lintstats/lintstats.go
@@ -23,8 +23,8 @@ import (
 	"github.com/apigee/registry/pkg/application/style"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/spf13/cobra"
@@ -134,7 +134,7 @@ func computeLintStatsSpecs(ctx context.Context,
 			return nil // ignore missing results
 		}
 
-		messageType, err := types.MessageTypeForMimeType(contents.GetContentType())
+		messageType, err := mime.MessageTypeForMimeType(contents.GetContentType())
 		if err != nil {
 			return nil
 		}
@@ -271,7 +271,7 @@ func storeLintStatsArtifact(ctx context.Context,
 	messageData, _ := proto.Marshal(lintStats)
 	artifact := &rpc.Artifact{
 		Name:     subject + "/artifacts/" + relation,
-		MimeType: types.MimeTypeForMessageType("google.cloud.apigeeregistry.applications.v1alpha1.LintStats"),
+		MimeType: mime.MimeTypeForMessageType("google.cloud.apigeeregistry.applications.v1alpha1.LintStats"),
 		Contents: messageData,
 	}
 	return visitor.SetArtifact(ctx, client, artifact)
diff --git a/cmd/registry/cmd/compute/vocabulary/vocabulary.go b/cmd/registry/cmd/compute/vocabulary/vocabulary.go
index 1978bd3..de2e43d 100644
--- a/cmd/registry/cmd/compute/vocabulary/vocabulary.go
+++ b/cmd/registry/cmd/compute/vocabulary/vocabulary.go
@@ -21,8 +21,8 @@ import (
 	"github.com/apigee/registry/cmd/registry/tasks"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/google/gnostic/metrics/vocabulary"
@@ -123,28 +123,28 @@ func (task *computeVocabularyTask) Run(ctx context.Context) error {
 	log.Debugf(ctx, "Computing %s/artifacts/vocabulary", task.specName)
 	var vocab *metrics.Vocabulary
 
-	if types.IsOpenAPIv2(contents.GetContentType()) {
+	if mime.IsOpenAPIv2(contents.GetContentType()) {
 		document, err := oas2.ParseDocument(contents.GetData())
 		if err != nil {
 			log.FromContext(ctx).WithError(err).Errorf("Invalid OpenAPI: %s", task.specName)
 			return nil
 		}
 		vocab = vocabulary.NewVocabularyFromOpenAPIv2(document)
-	} else if types.IsOpenAPIv3(contents.GetContentType()) {
+	} else if mime.IsOpenAPIv3(contents.GetContentType()) {
 		document, err := oas3.ParseDocument(contents.GetData())
 		if err != nil {
 			log.FromContext(ctx).WithError(err).Errorf("Invalid OpenAPI: %s", task.specName)
 			return nil
 		}
 		vocab = vocabulary.NewVocabularyFromOpenAPIv3(document)
-	} else if types.IsDiscovery(contents.GetContentType()) {
+	} else if mime.IsDiscovery(contents.GetContentType()) {
 		document, err := discovery.ParseDocument(contents.GetData())
 		if err != nil {
 			log.FromContext(ctx).WithError(err).Errorf("Invalid Discovery: %s", task.specName)
 			return nil
 		}
 		vocab = vocabulary.NewVocabularyFromDiscovery(document)
-	} else if types.IsProto(contents.GetContentType()) && types.IsZipArchive(contents.GetContentType()) {
+	} else if mime.IsProto(contents.GetContentType()) && mime.IsZipArchive(contents.GetContentType()) {
 		vocab, err = NewVocabularyFromZippedProtos(contents.GetData())
 		if err != nil {
 			log.FromContext(ctx).WithError(err).Errorf("Error processing protos: %s", task.specName)
@@ -165,7 +165,7 @@ func (task *computeVocabularyTask) Run(ctx context.Context) error {
 	}
 	return visitor.SetArtifact(ctx, task.client, &rpc.Artifact{
 		Name:     task.specName + "/artifacts/vocabulary",
-		MimeType: types.MimeTypeForMessageType("gnostic.metrics.Vocabulary"),
+		MimeType: mime.MimeTypeForMessageType("gnostic.metrics.Vocabulary"),
 		Contents: messageData,
 	})
 }
diff --git a/cmd/registry/cmd/diff/diff.go b/cmd/registry/cmd/diff/diff.go
index c2acf6d..4cabdce 100644
--- a/cmd/registry/cmd/diff/diff.go
+++ b/cmd/registry/cmd/diff/diff.go
@@ -23,8 +23,8 @@ import (
 	"github.com/apigee/registry/cmd/registry/compress"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/hexops/gotextdiff"
@@ -198,14 +198,14 @@ func printDiff(spec1, spec2 *rpc.ApiSpec) error {
 	} else {
 		var err error
 		contents1 := spec1.Contents
-		if types.IsGZipCompressed(spec1.MimeType) {
+		if mime.IsGZipCompressed(spec1.MimeType) {
 			contents1, err = compress.GUnzippedBytes(contents1)
 			if err != nil {
 				return err
 			}
 		}
 		contents2 := spec2.Contents
-		if types.IsGZipCompressed(spec2.MimeType) {
+		if mime.IsGZipCompressed(spec2.MimeType) {
 			contents2, err = compress.GUnzippedBytes(contents2)
 			if err != nil {
 				return err
diff --git a/cmd/registry/cmd/upload/csv.go b/cmd/registry/cmd/upload/csv.go
index ebe2e49..6566b01 100644
--- a/cmd/registry/cmd/upload/csv.go
+++ b/cmd/registry/cmd/upload/csv.go
@@ -26,8 +26,8 @@ import (
 	"github.com/apigee/registry/cmd/registry/tasks"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/spf13/cobra"
@@ -237,7 +237,7 @@ func (t uploadSpecTask) Run(ctx context.Context) error {
 		ApiSpecId: specName.SpecID,
 		ApiSpec: &rpc.ApiSpec{
 			// TODO: How do we choose a mime type?
-			MimeType: types.OpenAPIMimeType("+gzip", "3.0.0"),
+			MimeType: mime.OpenAPIMimeType("+gzip", "3.0.0"),
 			Contents: compressed,
 		},
 	})
diff --git a/cmd/registry/cmd/upload/discovery.go b/cmd/registry/cmd/upload/discovery.go
index ee0550c..2d1caac 100644
--- a/cmd/registry/cmd/upload/discovery.go
+++ b/cmd/registry/cmd/upload/discovery.go
@@ -23,7 +23,7 @@ import (
 	"github.com/apigee/registry/cmd/registry/tasks"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
-	"github.com/apigee/registry/pkg/types"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/spf13/cobra"
@@ -197,7 +197,7 @@ func (task *uploadDiscoveryTask) createOrUpdateSpec(ctx context.Context) error {
 	request := &rpc.UpdateApiSpecRequest{
 		ApiSpec: &rpc.ApiSpec{
 			Name:      task.specName(),
-			MimeType:  types.DiscoveryMimeType("+gzip"),
+			MimeType:  mime.DiscoveryMimeType("+gzip"),
 			Filename:  "discovery.json",
 			Contents:  gzippedContents,
 			SourceUri: task.path,
diff --git a/cmd/registry/cmd/upload/openapi.go b/cmd/registry/cmd/upload/openapi.go
index e890a66..b95a9b8 100644
--- a/cmd/registry/cmd/upload/openapi.go
+++ b/cmd/registry/cmd/upload/openapi.go
@@ -27,7 +27,7 @@ import (
 	"github.com/apigee/registry/cmd/registry/tasks"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
-	"github.com/apigee/registry/pkg/types"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/spf13/cobra"
@@ -247,7 +247,7 @@ func (task *uploadOpenAPITask) createOrUpdateSpec(ctx context.Context) error {
 	request := &rpc.UpdateApiSpecRequest{
 		ApiSpec: &rpc.ApiSpec{
 			Name:     task.specName(),
-			MimeType: types.OpenAPIMimeType("+gzip", task.version),
+			MimeType: mime.OpenAPIMimeType("+gzip", task.version),
 			Filename: task.fileName(),
 			Contents: gzippedContents,
 		},
diff --git a/cmd/registry/cmd/upload/protos.go b/cmd/registry/cmd/upload/protos.go
index 32b8eab..d5d963e 100644
--- a/cmd/registry/cmd/upload/protos.go
+++ b/cmd/registry/cmd/upload/protos.go
@@ -30,7 +30,7 @@ import (
 	"github.com/apigee/registry/cmd/registry/tasks"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
-	"github.com/apigee/registry/pkg/types"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/spf13/cobra"
@@ -261,7 +261,7 @@ func (task *uploadProtoTask) createOrUpdateSpec(ctx context.Context) error {
 	request := &rpc.UpdateApiSpecRequest{
 		ApiSpec: &rpc.ApiSpec{
 			Name:     task.specName(),
-			MimeType: types.ProtobufMimeType("+zip"),
+			MimeType: mime.ProtobufMimeType("+zip"),
 			Filename: task.fileName(),
 			Contents: task.contents,
 		},
diff --git a/cmd/registry/cmd/vocabulary/vocabulary.go b/cmd/registry/cmd/vocabulary/vocabulary.go
index ff11890..59cc3c2 100644
--- a/cmd/registry/cmd/vocabulary/vocabulary.go
+++ b/cmd/registry/cmd/vocabulary/vocabulary.go
@@ -21,8 +21,8 @@ import (
 	"github.com/apigee/registry/cmd/registry/compress"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/spf13/cobra"
@@ -63,7 +63,7 @@ func collectInputVocabularies(ctx context.Context, client connection.RegistryCli
 		}
 
 		err = visitor.ListArtifacts(ctx, client, artifact, filter, true, func(ctx context.Context, artifact *rpc.Artifact) error {
-			messageType, err := types.MessageTypeForMimeType(artifact.GetMimeType())
+			messageType, err := mime.MessageTypeForMimeType(artifact.GetMimeType())
 			if err != nil || messageType != "gnostic.metrics.Vocabulary" {
 				log.Debugf(ctx, "Skipping, not a vocabulary: %s", artifact.Name)
 				return nil
@@ -100,7 +100,7 @@ func setVocabularyToArtifact(ctx context.Context, client connection.RegistryClie
 	log.Debugf(ctx, "Saving vocabulary data (%d bytes)", len(messageData))
 	artifact := &rpc.Artifact{
 		Name:     subject + "/artifacts/" + relation,
-		MimeType: types.MimeTypeForMessageType("gnostic.metrics.Vocabulary+gzip"),
+		MimeType: mime.MimeTypeForMessageType("gnostic.metrics.Vocabulary+gzip"),
 		Contents: messageData,
 	}
 	err = visitor.SetArtifact(ctx, client, artifact)
@@ -116,7 +116,7 @@ func setVersionHistoryToArtifact(ctx context.Context, client connection.Registry
 	messageData, _ := proto.Marshal(output)
 	artifact := &rpc.Artifact{
 		Name:     subject + "/artifacts/" + relation,
-		MimeType: types.MimeTypeForMessageType("gnostic.metrics.VersionHistory"),
+		MimeType: mime.MimeTypeForMessageType("gnostic.metrics.VersionHistory"),
 		Contents: messageData,
 	}
 	err := visitor.SetArtifact(ctx, client, artifact)
diff --git a/cmd/registry/conformance/conformance-task.go b/cmd/registry/conformance/conformance-task.go
index ddb9254..4f1f48f 100644
--- a/cmd/registry/conformance/conformance-task.go
+++ b/cmd/registry/conformance/conformance-task.go
@@ -27,8 +27,8 @@ import (
 	"github.com/apigee/registry/pkg/application/style"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"google.golang.org/protobuf/encoding/protojson"
@@ -110,7 +110,7 @@ func (task *ComputeConformanceTask) Run(ctx context.Context) error {
 	name := filepath.Base(filename)
 	defer os.RemoveAll(root)
 
-	if types.IsZipArchive(task.Spec.GetMimeType()) {
+	if mime.IsZipArchive(task.Spec.GetMimeType()) {
 		_, err = compress.UnzipArchiveToPath(data, root)
 	} else {
 		// Write the file to the temporary directory.
@@ -265,7 +265,7 @@ func (task *ComputeConformanceTask) storeConformanceReport(
 
 	artifact := &rpc.Artifact{
 		Name:     fmt.Sprintf("%s/artifacts/%s", task.Spec.GetName(), conformanceReportId(task.StyleguideId)),
-		MimeType: types.MimeTypeForKind("ConformanceReport"),
+		MimeType: mime.MimeTypeForKind("ConformanceReport"),
 		Contents: messageData,
 	}
 	return visitor.SetArtifact(ctx, task.Client, artifact)
diff --git a/cmd/registry/controller/local-tasks.go b/cmd/registry/controller/local-tasks.go
index 34dd4e2..53d8a7d 100644
--- a/cmd/registry/controller/local-tasks.go
+++ b/cmd/registry/controller/local-tasks.go
@@ -25,7 +25,7 @@ import (
 	"github.com/apigee/registry/pkg/application/controller"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/log"
-	"github.com/apigee/registry/pkg/types"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"google.golang.org/protobuf/proto"
@@ -123,7 +123,7 @@ func touchArtifact(ctx context.Context, artifactName, action string) error {
 	messageData, _ := proto.Marshal(&controller.Receipt{Action: action})
 	return visitor.SetArtifact(ctx, client, &rpc.Artifact{
 		Name:     artifactName,
-		MimeType: types.MimeTypeForMessageType("google.cloud.apigeeregistry.v1.controller.Receipt"),
+		MimeType: mime.MimeTypeForMessageType("google.cloud.apigeeregistry.v1.controller.Receipt"),
 		Contents: messageData,
 	})
 }
diff --git a/cmd/registry/patch/artifact.go b/cmd/registry/patch/artifact.go
index a7b6231..a3fab16 100644
--- a/cmd/registry/patch/artifact.go
+++ b/cmd/registry/patch/artifact.go
@@ -26,8 +26,8 @@ import (
 	"github.com/apigee/registry/gapic"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/encoding"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/rpc"
 	"google.golang.org/protobuf/encoding/protojson"
 	"google.golang.org/protobuf/proto"
@@ -102,7 +102,7 @@ func NewArtifact(ctx context.Context, client *gapic.RegistryClient, message *rpc
 		// The top-level node is a "document" node. We need to marshal the node below it.
 		node = doc.Content[0]
 	} else {
-		m, err := types.MessageForMimeType(message.MimeType)
+		m, err := mime.MessageForMimeType(message.MimeType)
 		if err != nil {
 			return nil, err
 		}
@@ -138,7 +138,7 @@ func NewArtifact(ctx context.Context, client *gapic.RegistryClient, message *rpc
 	return &encoding.Artifact{
 		Header: encoding.Header{
 			ApiVersion: RegistryV1,
-			Kind:       types.KindForMimeType(message.MimeType),
+			Kind:       mime.KindForMimeType(message.MimeType),
 			Metadata: encoding.Metadata{
 				Name:        artifactName.ArtifactID(),
 				Parent:      names.ExportableName(artifactName.Parent(), artifactName.ProjectID()),
@@ -182,7 +182,7 @@ func applyArtifactPatch(ctx context.Context, client connection.RegistryClient, c
 	var bytes []byte
 	// Unmarshal the JSON serialization into the message struct.
 	var m proto.Message
-	m, err = types.MessageForKind(content.Kind)
+	m, err = mime.MessageForKind(content.Kind)
 	if err == nil {
 		err = protojson.Unmarshal(jWithIdAndKind, m)
 		if err != nil {
@@ -213,7 +213,7 @@ func applyArtifactPatch(ctx context.Context, client connection.RegistryClient, c
 	}
 	artifact := &rpc.Artifact{
 		Name:        name.String(),
-		MimeType:    types.MimeTypeForKind(content.Kind),
+		MimeType:    mime.MimeTypeForKind(content.Kind),
 		Contents:    bytes,
 		Labels:      content.Metadata.Labels,
 		Annotations: content.Metadata.Annotations,
diff --git a/cmd/registry/scoring/expression.go b/cmd/registry/scoring/expression.go
index 43d41ac..93d0483 100644
--- a/cmd/registry/scoring/expression.go
+++ b/cmd/registry/scoring/expression.go
@@ -23,7 +23,7 @@ import (
 	"github.com/apigee/registry/pkg/application/controller"
 	"github.com/apigee/registry/pkg/application/scoring"
 	"github.com/apigee/registry/pkg/application/style"
-	"github.com/apigee/registry/pkg/types"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/google/cel-go/cel"
 	metrics "github.com/google/gnostic/metrics"
 	"google.golang.org/protobuf/encoding/protojson"
@@ -60,7 +60,7 @@ func evaluateScoreExpression(expression string, artifactMap map[string]interface
 }
 
 func getMap(contents []byte, mimeType string) (map[string]interface{}, error) {
-	messageType, err := types.MessageTypeForMimeType(mimeType)
+	messageType, err := mime.MessageTypeForMimeType(mimeType)
 	if err != nil {
 		return nil, fmt.Errorf("failed extracting message type from %q", mimeType)
 	}
diff --git a/cmd/registry/scoring/score.go b/cmd/registry/scoring/score.go
index bf695e2..6072874 100644
--- a/cmd/registry/scoring/score.go
+++ b/cmd/registry/scoring/score.go
@@ -23,8 +23,8 @@ import (
 	"github.com/apigee/registry/cmd/registry/patterns"
 	"github.com/apigee/registry/pkg/application/scoring"
 	"github.com/apigee/registry/pkg/log"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/rpc"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
@@ -46,7 +46,7 @@ func FetchScoreDefinitions(
 	if err != nil {
 		return nil, err
 	}
-	listFilter := fmt.Sprintf("mime_type == %q", types.MimeTypeForKind("ScoreDefinition"))
+	listFilter := fmt.Sprintf("mime_type == %q", mime.MimeTypeForKind("ScoreDefinition"))
 	err = client.ListArtifacts(ctx, artifact, listFilter, true,
 		func(ctx context.Context, artifact *rpc.Artifact) error {
 			definition := &scoring.ScoreDefinition{}
@@ -443,7 +443,7 @@ func uploadScore(ctx context.Context, client artifactClient, resource patterns.R
 	artifact := &rpc.Artifact{
 		Name:     fmt.Sprintf("%s/artifacts/%s", resource.ResourceName().String(), score.GetId()),
 		Contents: artifactBytes,
-		MimeType: types.MimeTypeForKind("Score"),
+		MimeType: mime.MimeTypeForKind("Score"),
 	}
 	log.Debugf(ctx, "Uploading %s", artifact.GetName())
 	if err = client.SetArtifact(ctx, artifact); err != nil {
diff --git a/cmd/registry/scoring/scorecard.go b/cmd/registry/scoring/scorecard.go
index 053d157..74a4e63 100644
--- a/cmd/registry/scoring/scorecard.go
+++ b/cmd/registry/scoring/scorecard.go
@@ -21,8 +21,8 @@ import (
 	"github.com/apigee/registry/cmd/registry/patterns"
 	"github.com/apigee/registry/pkg/application/scoring"
 	"github.com/apigee/registry/pkg/log"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/rpc"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
@@ -44,7 +44,7 @@ func FetchScoreCardDefinitions(
 	if err != nil {
 		return nil, err
 	}
-	listFilter := fmt.Sprintf("mime_type == %q", types.MimeTypeForKind("ScoreCardDefinition"))
+	listFilter := fmt.Sprintf("mime_type == %q", mime.MimeTypeForKind("ScoreCardDefinition"))
 	err = client.ListArtifacts(ctx, artifact, listFilter, true,
 		func(ctx context.Context, artifact *rpc.Artifact) error {
 			definition := &scoring.ScoreCardDefinition{}
@@ -208,7 +208,7 @@ func uploadScoreCard(ctx context.Context, client artifactClient, resource patter
 	artifact := &rpc.Artifact{
 		Name:     fmt.Sprintf("%s/artifacts/%s", resource.ResourceName().String(), scoreCard.GetId()),
 		Contents: artifactBytes,
-		MimeType: types.MimeTypeForKind("ScoreCard"),
+		MimeType: mime.MimeTypeForKind("ScoreCard"),
 	}
 	log.Debugf(ctx, "Uploading %s", artifact.GetName())
 	if err = client.SetArtifact(ctx, artifact); err != nil {
diff --git a/pkg/types/types.go b/pkg/mime/types.go
similarity index 99%
rename from pkg/types/types.go
rename to pkg/mime/types.go
index 828592b..ded9a71 100644
--- a/pkg/types/types.go
+++ b/pkg/mime/types.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package types
+package mime
 
 import (
 	"fmt"


Test patch:
diff --git a/cmd/registry/cmd/check/rules/rule1000/rule1000_test.go b/cmd/registry/cmd/check/rules/rule1000/rule1000_test.go
index 65cdfb6..8493375 100644
--- a/cmd/registry/cmd/check/rules/rule1000/rule1000_test.go
+++ b/cmd/registry/cmd/check/rules/rule1000/rule1000_test.go
@@ -22,7 +22,7 @@ import (
 	"github.com/apigee/registry/pkg/application/apihub"
 	"github.com/apigee/registry/pkg/application/check"
 	"github.com/apigee/registry/pkg/connection/grpctest"
-	"github.com/apigee/registry/pkg/types"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/rpc"
 	"github.com/apigee/registry/server/registry"
 	"github.com/apigee/registry/server/registry/test/seeder"
@@ -109,7 +109,7 @@ func TestRequiredTaxonomies(t *testing.T) {
 		ArtifactId: "apihub-taxonomies",
 		Parent:     "projects/check-test/locations/global",
 		Artifact: &rpc.Artifact{
-			MimeType: types.MimeTypeForMessageType("google.cloud.apigeeregistry.v1.apihub.TaxonomyList"),
+			MimeType: mime.MimeTypeForMessageType("google.cloud.apigeeregistry.v1.apihub.TaxonomyList"),
 			Contents: tl,
 		},
 	})
diff --git a/cmd/registry/cmd/check/rules/rule1001/rule1001_test.go b/cmd/registry/cmd/check/rules/rule1001/rule1001_test.go
index 3577475..751990b 100644
--- a/cmd/registry/cmd/check/rules/rule1001/rule1001_test.go
+++ b/cmd/registry/cmd/check/rules/rule1001/rule1001_test.go
@@ -22,7 +22,7 @@ import (
 	"github.com/apigee/registry/pkg/application/apihub"
 	"github.com/apigee/registry/pkg/application/check"
 	"github.com/apigee/registry/pkg/connection/grpctest"
-	"github.com/apigee/registry/pkg/types"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/rpc"
 	"github.com/apigee/registry/server/registry"
 	"github.com/google/go-cmp/cmp"
@@ -70,7 +70,7 @@ func TestTaxonomyList(t *testing.T) {
 		ArtifactId: "apihub-taxonomies",
 		Parent:     "projects/check-test/locations/global",
 		Artifact: &rpc.Artifact{
-			MimeType: types.MimeTypeForMessageType("google.cloud.apigeeregistry.v1.apihub.TaxonomyList"),
+			MimeType: mime.MimeTypeForMessageType("google.cloud.apigeeregistry.v1.apihub.TaxonomyList"),
 			Contents: tl,
 		},
 	})
diff --git a/cmd/registry/cmd/delete/delete_test.go b/cmd/registry/cmd/delete/delete_test.go
index b603202..d645a49 100644
--- a/cmd/registry/cmd/delete/delete_test.go
+++ b/cmd/registry/cmd/delete/delete_test.go
@@ -21,7 +21,7 @@ import (
 	"github.com/apigee/registry/pkg/application/apihub"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/connection/grpctest"
-	"github.com/apigee/registry/pkg/types"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/rpc"
 	"github.com/apigee/registry/server/registry"
 	"github.com/apigee/registry/server/registry/test/seeder"
@@ -43,7 +43,7 @@ func setup(t *testing.T) (context.Context, connection.RegistryClient) {
 	}
 	seed := []seeder.RegistryResource{
 		&rpc.ApiSpec{Name: "projects/my-project/locations/global/apis/a/versions/v/specs/s", MimeType: "text/plain", Contents: []byte("hello")},
-		&rpc.Artifact{Name: "projects/my-project/locations/global/artifacts/x", MimeType: types.MimeTypeForKind("DisplaySettings"), Contents: displaySettingsBytes},
+		&rpc.Artifact{Name: "projects/my-project/locations/global/artifacts/x", MimeType: mime.MimeTypeForKind("DisplaySettings"), Contents: displaySettingsBytes},
 		&rpc.Artifact{Name: "projects/my-project/locations/global/apis/a/artifacts/x", MimeType: "application/yaml", Contents: []byte("hello: 123")},
 		&rpc.Artifact{Name: "projects/my-project/locations/global/apis/a/versions/v/artifacts/x", MimeType: "application/yaml", Contents: []byte("hello: 123")},
 		&rpc.Artifact{Name: "projects/my-project/locations/global/apis/a/versions/v/specs/s/artifacts/x", MimeType: "application/yaml", Contents: []byte("hello: 123")},
diff --git a/cmd/registry/cmd/get/get_test.go b/cmd/registry/cmd/get/get_test.go
index 2fb5aaf..130542d 100644
--- a/cmd/registry/cmd/get/get_test.go
+++ b/cmd/registry/cmd/get/get_test.go
@@ -24,7 +24,7 @@ import (
 	"github.com/apigee/registry/pkg/application/apihub"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/connection/grpctest"
-	"github.com/apigee/registry/pkg/types"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/rpc"
 	"github.com/apigee/registry/server/registry"
 	"github.com/apigee/registry/server/registry/test/seeder"
@@ -46,7 +46,7 @@ func TestGetValidResources(t *testing.T) {
 	}
 	seed := []seeder.RegistryResource{
 		&rpc.ApiSpec{Name: "projects/my-project/locations/global/apis/a/versions/v/specs/s", MimeType: "text/plain", Contents: []byte("hello")},
-		&rpc.Artifact{Name: "projects/my-project/locations/global/artifacts/x", MimeType: types.MimeTypeForKind("DisplaySettings"), Contents: displaySettingsBytes},
+		&rpc.Artifact{Name: "projects/my-project/locations/global/artifacts/x", MimeType: mime.MimeTypeForKind("DisplaySettings"), Contents: displaySettingsBytes},
 		&rpc.Artifact{Name: "projects/my-project/locations/global/apis/a/artifacts/x", MimeType: "application/yaml", Contents: []byte("hello: 123")},
 		&rpc.Artifact{Name: "projects/my-project/locations/global/apis/a/versions/v/artifacts/x", MimeType: "application/yaml", Contents: []byte("hello: 123")},
 		&rpc.Artifact{Name: "projects/my-project/locations/global/apis/a/versions/v/specs/s/artifacts/x", MimeType: "application/yaml", Contents: []byte("hello: 123")},
diff --git a/cmd/registry/controller/controller_test.go b/cmd/registry/controller/controller_test.go
index 82d14f8..3b6f6aa 100644
--- a/cmd/registry/controller/controller_test.go
+++ b/cmd/registry/controller/controller_test.go
@@ -25,8 +25,8 @@ import (
 	"github.com/apigee/registry/pkg/application/style"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/connection/grpctest"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/apigee/registry/server/registry"
@@ -635,7 +635,7 @@ func TestMultipleEntitiesArtifacts(t *testing.T) {
 			seed: []seeder.RegistryResource{
 				&rpc.Artifact{
 					Name:     "projects/controller-test/locations/global/artifacts/registry-styleguide",
-					MimeType: types.MimeTypeForMessageType("google.cloud.apigeeregistry.v1.style.StyleGuide"),
+					MimeType: mime.MimeTypeForMessageType("google.cloud.apigeeregistry.v1.style.StyleGuide"),
 					Contents: protoMarshal(styleguide),
 				},
 				&rpc.ApiSpec{
@@ -681,7 +681,7 @@ func TestMultipleEntitiesArtifacts(t *testing.T) {
 				//Update styleguide definition to make sure conformance artifacts are outdated
 				&rpc.Artifact{
 					Name:     "projects/controller-test/locations/global/artifacts/registry-styleguide",
-					MimeType: types.MimeTypeForMessageType("google.cloud.apigeeregistry.v1.style.StyleGuide"),
+					MimeType: mime.MimeTypeForMessageType("google.cloud.apigeeregistry.v1.style.StyleGuide"),
 					Contents: protoMarshal(styleguide),
 				},
 			},
@@ -708,7 +708,7 @@ func TestMultipleEntitiesArtifacts(t *testing.T) {
 			seed: []seeder.RegistryResource{
 				&rpc.Artifact{
 					Name:     "projects/controller-test/locations/global/artifacts/registry-styleguide",
-					MimeType: types.MimeTypeForMessageType("google.cloud.apigeeregistry.v1.style.StyleGuide"),
+					MimeType: mime.MimeTypeForMessageType("google.cloud.apigeeregistry.v1.style.StyleGuide"),
 					Contents: protoMarshal(styleguide),
 				},
 				&rpc.ApiSpec{
diff --git a/cmd/registry/patch/patch_test.go b/cmd/registry/patch/patch_test.go
index 78b294e..c1931dd 100644
--- a/cmd/registry/patch/patch_test.go
+++ b/cmd/registry/patch/patch_test.go
@@ -25,8 +25,8 @@ import (
 	"github.com/apigee/registry/pkg/application/style"
 	"github.com/apigee/registry/pkg/connection"
 	"github.com/apigee/registry/pkg/connection/grpctest"
+	"github.com/apigee/registry/pkg/mime"
 	"github.com/apigee/registry/pkg/names"
-	"github.com/apigee/registry/pkg/types"
 	"github.com/apigee/registry/pkg/visitor"
 	"github.com/apigee/registry/rpc"
 	"github.com/apigee/registry/server/registry"
@@ -1260,7 +1260,7 @@ func TestInvalidArtifactPatches(t *testing.T) {
 }
 
 func getArtifactMessageContents(artifact *rpc.Artifact) (proto.Message, error) {
-	message, err := types.MessageForMimeType(artifact.GetMimeType())
+	message, err := mime.MessageForMimeType(artifact.GetMimeType())
 	if err != nil {
 		return nil, err
 	}
diff --git a/pkg/types/types_test.go b/pkg/mime/types_test.go
similarity index 99%
rename from pkg/types/types_test.go
rename to pkg/mime/types_test.go
index 5369b9f..dd864d1 100644
--- a/pkg/types/types_test.go
+++ b/pkg/mime/types_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package types
+package mime
 
 import (
 	"fmt"