Repository: apigee/registry
Pull request #616 (2022-06-17 21:16:54)

Fix lingering references to old mime_type for style protos

codecov[bot]: # [Codecov](https://codecov.io/gh/apigee/registry/pull/616?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) Report
> Merging [#616](https://codecov.io/gh/apigee/registry/pull/616?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) (3bf35cd) into [main](https://codecov.io/gh/apigee/registry/commit/426d47656af5e76c5a630397e4c71ec2111169cb?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) (426d476) will **not change** coverage.
> The diff coverage is `50.00%`.

> :exclamation: Current head 3bf35cd differs from pull request most recent head 50b5dbe. Consider uploading reports for the commit 50b5dbe to get more accurate results

```diff
@@           Coverage Diff           @@
##             main     #616   +/-   ##
=======================================
  Coverage   52.39%   52.39%           
=======================================
  Files          71       71           
  Lines        6989     6989           
=======================================
  Hits         3662     3662           
  Misses       2922     2922           
  Partials      405      405           
```


| [Impacted Files](https://codecov.io/gh/apigee/registry/pull/616?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) | Coverage Δ | |
|---|---|---|
| [cmd/registry/scoring/expression.go](https://codecov.io/gh/apigee/registry/pull/616/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#diff-Y21kL3JlZ2lzdHJ5L3Njb3JpbmcvZXhwcmVzc2lvbi5nbw==) | `44.77% <50.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/apigee/registry/pull/616?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apigee/registry/pull/616?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee). Last update [426d476...50b5dbe](https://codecov.io/gh/apigee/registry/pull/616?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee).

shrutiparabgoogle: Thanks for quick approval :) @timburks 

Patch:
diff --git a/cmd/registry/scoring/expression.go b/cmd/registry/scoring/expression.go
index d6336e5..05127bf 100644
--- a/cmd/registry/scoring/expression.go
+++ b/cmd/registry/scoring/expression.go
@@ -67,11 +67,11 @@ func getMap(contents []byte, mimeType string) (map[string]interface{}, error) {
 		return unmarshalAndMap(contents, &metrics.Complexity{})
 	case "gnostic.metrics.Vocabulary":
 		return unmarshalAndMap(contents, &metrics.Vocabulary{})
-	case "google.cloud.apigeeregistry.applications.v1alpha1.ConformanceReport":
+	case "google.cloud.apigeeregistry.v1.style.ConformanceReport":
 		return unmarshalAndMap(contents, &rpc.ConformanceReport{})
 	case "google.cloud.apigeeregistry.applications.v1alpha1.Index":
 		return unmarshalAndMap(contents, &rpc.Index{})
-	case "google.cloud.apigeeregistry.applications.v1alpha1.Lint":
+	case "google.cloud.apigeeregistry.v1.style.Lint":
 		return unmarshalAndMap(contents, &rpc.Lint{})
 	case "google.cloud.apigeeregistry.v1.apihub.ReferenceList":
 		return unmarshalAndMap(contents, &rpc.ReferenceList{})


Test patch:
diff --git a/cmd/registry/scoring/expression_test.go b/cmd/registry/scoring/expression_test.go
index 1f246e2..48e8188 100644
--- a/cmd/registry/scoring/expression_test.go
+++ b/cmd/registry/scoring/expression_test.go
@@ -45,7 +45,7 @@ func TestGetMap(t *testing.T) {
 					},
 				},
 			},
-			mimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+			mimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 			wantMap: map[string]interface{}{
 				"name": "openapi.yaml",
 				"files": []interface{}{
diff --git a/cmd/registry/scoring/score_test.go b/cmd/registry/scoring/score_test.go
index d77a3da..8434bea 100644
--- a/cmd/registry/scoring/score_test.go
+++ b/cmd/registry/scoring/score_test.go
@@ -142,7 +142,7 @@ func TestCalculateScore(t *testing.T) {
 			seed: []seeder.RegistryResource{
 				&rpc.Artifact{
 					Name:     "projects/score-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -202,7 +202,7 @@ func TestCalculateScore(t *testing.T) {
 				// score formula artifact
 				&rpc.Artifact{
 					Name:     "projects/score-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -257,7 +257,7 @@ func TestCalculateScore(t *testing.T) {
 				// score formula artifact
 				&rpc.Artifact{
 					Name:     "projects/score-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -355,7 +355,7 @@ func TestCalculateScore(t *testing.T) {
 				// score formula artifact
 				&rpc.Artifact{
 					Name:     "projects/score-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -422,7 +422,7 @@ func TestCalculateScore(t *testing.T) {
 				// score formula artifact
 				&rpc.Artifact{
 					Name:     "projects/score-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -550,7 +550,7 @@ func TestProcessScoreFormula(t *testing.T) {
 	seed := []seeder.RegistryResource{
 		&rpc.Artifact{
 			Name:     "projects/score-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-			MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+			MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 			Contents: protoMarshal(&rpc.Lint{
 				Name: "openapi.yaml",
 				Files: []*rpc.LintFile{
@@ -714,7 +714,7 @@ func TestProcessScoreFormulaError(t *testing.T) {
 			seed: []seeder.RegistryResource{
 				&rpc.Artifact{
 					Name:     "projects/score-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -752,7 +752,7 @@ func TestProcessScoreFormulaError(t *testing.T) {
 			seed: []seeder.RegistryResource{
 				&rpc.Artifact{
 					Name:     "projects/score-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -842,7 +842,7 @@ func TestProcessScoreFormulaTimestamp(t *testing.T) {
 				// score  formula artifact
 				&rpc.Artifact{
 					Name:     "projects/score-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -882,7 +882,7 @@ func TestProcessScoreFormulaTimestamp(t *testing.T) {
 				// score formula artifact
 				&rpc.Artifact{
 					Name:     "projects/score-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -932,7 +932,7 @@ func TestProcessScoreFormulaTimestamp(t *testing.T) {
 				// score formula artifact
 				&rpc.Artifact{
 					Name:     "projects/score-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -971,7 +971,7 @@ func TestProcessScoreFormulaTimestamp(t *testing.T) {
 				// score formula artifact
 				&rpc.Artifact{
 					Name:     "projects/score-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -1087,7 +1087,7 @@ func TestProcessRollUpFormula(t *testing.T) {
 		// lint artifact
 		&rpc.Artifact{
 			Name:     "projects/rollup-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-			MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+			MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 			Contents: protoMarshal(&rpc.Lint{
 				Name: "openapi.yaml",
 				Files: []*rpc.LintFile{
@@ -1237,7 +1237,7 @@ func TestProcessRollUpFormulaError(t *testing.T) {
 				// lint artifact
 				&rpc.Artifact{
 					Name:     "projects/rollup-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -1303,7 +1303,7 @@ func TestProcessRollUpFormulaError(t *testing.T) {
 				// lint artifact
 				&rpc.Artifact{
 					Name:     "projects/rollup-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -1456,7 +1456,7 @@ func TestProcessRollUpFormulaTimestamp(t *testing.T) {
 				// lint artifact
 				&rpc.Artifact{
 					Name:     "projects/rollup-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -1509,7 +1509,7 @@ func TestProcessRollUpFormulaTimestamp(t *testing.T) {
 				// lint artifact
 				&rpc.Artifact{
 					Name:     "projects/rollup-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -1567,7 +1567,7 @@ func TestProcessRollUpFormulaTimestamp(t *testing.T) {
 				// lint artifact
 				&rpc.Artifact{
 					Name:     "projects/rollup-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -1630,7 +1630,7 @@ func TestProcessRollUpFormulaTimestamp(t *testing.T) {
 				// lint artifact
 				&rpc.Artifact{
 					Name:     "projects/rollup-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -1683,7 +1683,7 @@ func TestProcessRollUpFormulaTimestamp(t *testing.T) {
 				// lint artifact
 				&rpc.Artifact{
 					Name:     "projects/rollup-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{
@@ -1741,7 +1741,7 @@ func TestProcessRollUpFormulaTimestamp(t *testing.T) {
 				// lint artifact
 				&rpc.Artifact{
 					Name:     "projects/rollup-formula-test/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml/artifacts/lint-spectral",
-					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.applications.v1alpha1.Lint",
+					MimeType: "application/octet-stream;type=google.cloud.apigeeregistry.v1.style.Lint",
 					Contents: protoMarshal(&rpc.Lint{
 						Name: "openapi.yaml",
 						Files: []*rpc.LintFile{