Repository: goadesign/goa
Pull request #3151 (2022-09-26 11:03:39)

Bump github.com/getkin/kin-openapi from 0.102.0 to 0.103.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.102.0 to 0.103.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/getkin/kin-openapi/releases">github.com/getkin/kin-openapi's releases</a>.</em></p>
<blockquote>
<h2>v0.103.0</h2>
<h2>What's Changed</h2>
<ul>
<li>use %w to wrap the errors by <a href="https://github.com/SVilgelm"><code>@​SVilgelm</code></a> in <a href="https://github-redirect.dependabot.com/getkin/kin-openapi/pull/596">getkin/kin-openapi#596</a></li>
<li>Expose request/response validation options in the middleware Validator by <a href="https://github.com/sorintm"><code>@​sorintm</code></a> in <a href="https://github-redirect.dependabot.com/getkin/kin-openapi/pull/608">getkin/kin-openapi#608</a></li>
<li>fix: detects circular references that can't be handled at the moment to avoid infinite loops loading documents by <a href="https://github.com/TristanSpeakEasy"><code>@​TristanSpeakEasy</code></a> in <a href="https://github-redirect.dependabot.com/getkin/kin-openapi/pull/607">getkin/kin-openapi#607</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/sorintm"><code>@​sorintm</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/getkin/kin-openapi/pull/608">getkin/kin-openapi#608</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/getkin/kin-openapi/compare/v0.102.0...v0.103.0">https://github.com/getkin/kin-openapi/compare/v0.102.0...v0.103.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/getkin/kin-openapi/commit/a8f69f469eb9c4c423fefa06433c90edc0bfaa45"><code>a8f69f4</code></a> fix: detects circular references that can't be handled at the moment to avoid...</li>
<li><a href="https://github.com/getkin/kin-openapi/commit/6610338051cc51016df6dbc462ef332fc0550560"><code>6610338</code></a> Expose request/response validation options in the middleware Validator (<a href="https://github-redirect.dependabot.com/getkin/kin-openapi/issues/608">#608</a>)</li>
<li><a href="https://github.com/getkin/kin-openapi/commit/d12860caf67e8be20bec1d0b57b82ffb83f4e140"><code>d12860c</code></a> use %w to wrap the errors (<a href="https://github-redirect.dependabot.com/getkin/kin-openapi/issues/596">#596</a>)</li>
<li>See full diff in <a href="https://github.com/getkin/kin-openapi/compare/v0.102.0...v0.103.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/getkin/kin-openapi&package-manager=go_modules&previous-version=0.102.0&new-version=0.103.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index 1a079587..84b06d47 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -18,7 +18,7 @@ jobs:
       pull-requests: write
 
     steps:
-    - uses: actions/stale@v5
+    - uses: actions/stale@v6
       with:
         days-before-issue-stale: 60
         days-before-pr-stale: 90
diff --git a/codegen/service/service.go b/codegen/service/service.go
index 1c525792..f1207579 100644
--- a/codegen/service/service.go
+++ b/codegen/service/service.go
@@ -390,7 +390,14 @@ func (e {{ .Ref }}) Error() string {
 }
 
 // ErrorName returns {{ printf "%q" .Name }}.
+//
+// Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105
 func (e {{ .Ref }}) ErrorName() string {
+	return e.GoaErrorName()
+}
+
+// GoaErrorName returns {{ printf "%q" .Name }}.
+func (e {{ .Ref }}) GoaErrorName() string {
 	return {{ errorName . }}
 }
 `
diff --git a/go.mod b/go.mod
index bedfbeb1..eb4ce54d 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.19
 require (
 	github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598
 	github.com/dimfeld/httptreemux/v5 v5.4.0
-	github.com/getkin/kin-openapi v0.102.0
+	github.com/getkin/kin-openapi v0.103.0
 	github.com/google/uuid v1.3.0
 	github.com/gorilla/websocket v1.5.0
 	github.com/hashicorp/go-multierror v1.1.1
diff --git a/go.sum b/go.sum
index 308e2f3a..bf4d2adc 100644
--- a/go.sum
+++ b/go.sum
@@ -6,8 +6,8 @@ github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZs
 github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI=
 github.com/dimfeld/httptreemux/v5 v5.4.0 h1:IiHYEjh+A7pYbhWyjmGnj5HZK6gpOOvyBXCJ+BE8/Gs=
 github.com/dimfeld/httptreemux/v5 v5.4.0/go.mod h1:QeEylH57C0v3VO0tkKraVz9oD3Uu93CKPnTLbsidvSw=
-github.com/getkin/kin-openapi v0.102.0 h1:qrzANKLqtUKlKUAofkmlV08pVNiVW2PgeWbKi/H2WVQ=
-github.com/getkin/kin-openapi v0.102.0/go.mod h1:w4lRPHiyOdwGbOkLIyk+P0qCwlu7TXPCHD/64nSXzgE=
+github.com/getkin/kin-openapi v0.103.0 h1:F5wAtaQvPWxKCAYZ69LgHAThgu16p4u41VQtbn1U8LA=
+github.com/getkin/kin-openapi v0.103.0/go.mod h1:w4lRPHiyOdwGbOkLIyk+P0qCwlu7TXPCHD/64nSXzgE=
 github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
 github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
 github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
diff --git a/grpc/codegen/server.go b/grpc/codegen/server.go
index f13c2dc0..7866fa23 100644
--- a/grpc/codegen/server.go
+++ b/grpc/codegen/server.go
@@ -208,9 +208,23 @@ type {{ .ServerStruct }} struct {
 
 // ErrorNamer is an interface implemented by generated error structs that
 // exposes the name of the error as defined in the expr.
+//
+// Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105
 type ErrorNamer interface {
   ErrorName() string
 }
+
+// GoaErrorNamer is an interface implemented by generated error structs that
+// exposes the name of the error as defined in the design.
+type GoaErrorNamer interface {
+	GoaErrorName() string
+}
+
+type adaptErrorNamer ErrorName
+
+func (err adaptErrorNamer) GoaErrorName() string {
+	return err.ErrorName()
+}
 `
 
 // input: ServiceData
@@ -266,9 +280,13 @@ func (s *{{ .ServerStruct }}) {{ .Method.VarName }}(
 {{- define "handle_error" }}
 	if err != nil {
 	{{- if .Errors }}
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if errors.As(err, &en) {
-			switch en.ErrorName() {
+			switch en.GoaErrorName() {
 		{{- range .Errors }}
 			case {{ printf "%q" .Name }}:
 				{{- if .Response.ServerConvert }}
diff --git a/http/codegen/server.go b/http/codegen/server.go
index faacd810..be294eb6 100644
--- a/http/codegen/server.go
+++ b/http/codegen/server.go
@@ -279,9 +279,23 @@ type {{ .ServerStruct }} struct {
 
 // ErrorNamer is an interface implemented by generated error structs that
 // exposes the name of the error as defined in the design.
+//
+// Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105
 type ErrorNamer interface {
 	ErrorName() string
 }
+
+// GoaErrorNamer is an interface implemented by generated error structs that
+// exposes the name of the error as defined in the design.
+type GoaErrorNamer interface {
+	GoaErrorName() string
+}
+
+type adaptErrorNamer ErrorName
+
+func (err adaptErrorNamer) GoaErrorName() string {
+	return err.ErrorName()
+}
 `
 
 // input: ServiceData
@@ -694,7 +708,7 @@ const requestElementsT = `{{- define "request_elements" }}
 			{{ .VarName }} = []string{
                 {{- range $i, $v := .DefaultValue }}
                     {{- if $i }}{{ print ", " }}{{ end }}
-                    {{- printf "%q" $v -}} 
+                    {{- printf "%q" $v -}}
                 {{- end -}} }
 		}
 		{{- end }}
@@ -1203,11 +1217,15 @@ const errorEncoderT = `{{ printf "%s returns an encoder for errors returned by t
 func {{ .ErrorEncoder }}(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error {
 	encodeError := goahttp.ErrorEncoder(encoder, formatter)
 	return func(ctx context.Context, w http.ResponseWriter, v error) error {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if !errors.As(v, &en) {
 			return encodeError(ctx, w, v)
 		}
-		switch en.ErrorName() {
+		switch en.GoaErrorName() {
 	{{- range $gerr := .Errors }}
 	{{- range $err := .Errors }}
 		case {{ printf "%q" .Name }}:
@@ -1350,7 +1368,7 @@ const responseT = `{{ define "response" -}}
 	{{- end }}
 
 	{{- if .ErrorHeader }}
-	w.Header().Set("goa-error", res.ErrorName())
+	w.Header().Set("goa-error", res.GoaErrorName())
 	{{- end }}
 	w.WriteHeader({{ .StatusCode }})
 {{- end }}
diff --git a/pkg/error.go b/pkg/error.go
index b057f99c..3d4c12b3 100644
--- a/pkg/error.go
+++ b/pkg/error.go
@@ -245,8 +245,13 @@ func (e ServiceError) History() []ServiceError {
 func (e *ServiceError) Error() string { return e.Message }
 
 // ErrorName returns the error name.
+//
+// Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105
 func (e *ServiceError) ErrorName() string { return e.Name }
 
+// GoaErrorName returns the error name.
+func (e *ServiceError) GoaErrorName() string { return e.ErrorName() }
+
 func (e *ServiceError) Unwrap() error { return e.err }
 
 func withField(field string, err *ServiceError) *ServiceError {


Test patch:
diff --git a/codegen/service/testdata/service_code.go b/codegen/service/testdata/service_code.go
index e3ab82a6..693b044c 100644
--- a/codegen/service/testdata/service_code.go
+++ b/codegen/service/testdata/service_code.go
@@ -407,7 +407,14 @@ func (e *APayload) Error() string {
 }
 
 // ErrorName returns "APayload".
+//
+// Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105
 func (e *APayload) ErrorName() string {
+	return e.GoaErrorName()
+}
+
+// GoaErrorName returns "APayload".
+func (e *APayload) GoaErrorName() string {
 	return "user_type"
 }
 
@@ -417,7 +424,14 @@ func (e *Result) Error() string {
 }
 
 // ErrorName returns "Result".
+//
+// Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105
 func (e *Result) ErrorName() string {
+	return e.GoaErrorName()
+}
+
+// GoaErrorName returns "Result".
+func (e *Result) GoaErrorName() string {
 	return e.B
 }
 
@@ -427,7 +441,14 @@ func (e Primitive) Error() string {
 }
 
 // ErrorName returns "primitive".
+//
+// Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105
 func (e Primitive) ErrorName() string {
+	return e.GoaErrorName()
+}
+
+// GoaErrorName returns "primitive".
+func (e Primitive) GoaErrorName() string {
 	return "primitive"
 }
 `
@@ -459,7 +480,14 @@ func (e *GoaError) Error() string {
 }
 
 // ErrorName returns "GoaError".
+//
+// Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105
 func (e *GoaError) ErrorName() string {
+	return e.GoaErrorName()
+}
+
+// GoaErrorName returns "GoaError".
+func (e *GoaError) GoaErrorName() string {
 	return e.ErrorCode
 }
 `
diff --git a/grpc/codegen/testdata/server_interface_code.go b/grpc/codegen/testdata/server_interface_code.go
index ffcd59a7..e5cb7974 100644
--- a/grpc/codegen/testdata/server_interface_code.go
+++ b/grpc/codegen/testdata/server_interface_code.go
@@ -58,9 +58,13 @@ func (s *Server) MethodUnaryRPCWithErrors(ctx context.Context, message *service_
 	ctx = context.WithValue(ctx, goa.ServiceKey, "ServiceUnaryRPCWithErrors")
 	resp, err := s.MethodUnaryRPCWithErrorsH.Handle(ctx, message)
 	if err != nil {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if errors.As(err, &en) {
-			switch en.ErrorName() {
+			switch en.GoaErrorName() {
 			case "timeout":
 				return nil, goagrpc.NewStatusError(codes.Canceled, err, goagrpc.NewErrorResponse(err))
 			case "internal":
@@ -92,9 +96,13 @@ func (s *Server) MethodUnaryRPCWithOverridingErrors(ctx context.Context, message
 	ctx = context.WithValue(ctx, goa.ServiceKey, "ServiceUnaryRPCWithOverridingErrors")
 	resp, err := s.MethodUnaryRPCWithOverridingErrorsH.Handle(ctx, message)
 	if err != nil {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if errors.As(err, &en) {
-			switch en.ErrorName() {
+			switch en.GoaErrorName() {
 			case "overridden":
 				return nil, goagrpc.NewStatusError(codes.Unknown, err, goagrpc.NewErrorResponse(err))
 			case "internal":
@@ -231,9 +239,13 @@ func (s *Server) MethodBidirectionalStreamingRPCWithErrors(stream service_bidire
 	ctx = context.WithValue(ctx, goa.ServiceKey, "ServiceBidirectionalStreamingRPCWithErrors")
 	_, err := s.MethodBidirectionalStreamingRPCWithErrorsH.Decode(ctx, nil)
 	if err != nil {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if errors.As(err, &en) {
-			switch en.ErrorName() {
+			switch en.GoaErrorName() {
 			case "timeout":
 				return goagrpc.NewStatusError(codes.Canceled, err, goagrpc.NewErrorResponse(err))
 			case "internal":
@@ -249,9 +261,13 @@ func (s *Server) MethodBidirectionalStreamingRPCWithErrors(stream service_bidire
 	}
 	err = s.MethodBidirectionalStreamingRPCWithErrorsH.Handle(ctx, ep)
 	if err != nil {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if errors.As(err, &en) {
-			switch en.ErrorName() {
+			switch en.GoaErrorName() {
 			case "timeout":
 				return goagrpc.NewStatusError(codes.Canceled, err, goagrpc.NewErrorResponse(err))
 			case "internal":
diff --git a/http/codegen/testdata/error_encoder_code.go b/http/codegen/testdata/error_encoder_code.go
index 6a412385..861e5d0e 100644
--- a/http/codegen/testdata/error_encoder_code.go
+++ b/http/codegen/testdata/error_encoder_code.go
@@ -6,17 +6,21 @@ var PrimitiveErrorResponseEncoderCode = `// EncodeMethodPrimitiveErrorResponseEr
 func EncodeMethodPrimitiveErrorResponseError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error {
 	encodeError := goahttp.ErrorEncoder(encoder, formatter)
 	return func(ctx context.Context, w http.ResponseWriter, v error) error {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if !errors.As(v, &en) {
 			return encodeError(ctx, w, v)
 		}
-		switch en.ErrorName() {
+		switch en.GoaErrorName() {
 		case "bad_request":
 			var res serviceprimitiveerrorresponse.BadRequest
 			errors.As(v, &res)
 			enc := encoder(ctx, w)
 			body := res
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusBadRequest)
 			return enc.Encode(body)
 		case "internal_error":
@@ -24,7 +28,7 @@ func EncodeMethodPrimitiveErrorResponseError(encoder func(context.Context, http.
 			errors.As(v, &res)
 			enc := encoder(ctx, w)
 			body := res
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusInternalServerError)
 			return enc.Encode(body)
 		default:
@@ -40,11 +44,15 @@ var PrimitiveErrorInResponseHeaderEncoderCode = `// EncodeMethodPrimitiveErrorIn
 func EncodeMethodPrimitiveErrorInResponseHeaderError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error {
 	encodeError := goahttp.ErrorEncoder(encoder, formatter)
 	return func(ctx context.Context, w http.ResponseWriter, v error) error {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if !errors.As(v, &en) {
 			return encodeError(ctx, w, v)
 		}
-		switch en.ErrorName() {
+		switch en.GoaErrorName() {
 		case "bad_request":
 			var res serviceprimitiveerrorinresponseheader.BadRequest
 			errors.As(v, &res)
@@ -53,7 +61,7 @@ func EncodeMethodPrimitiveErrorInResponseHeaderError(encoder func(context.Contex
 				string_s := val
 				w.Header().Set("String", string_s)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusBadRequest)
 			return nil
 		case "internal_error":
@@ -64,7 +72,7 @@ func EncodeMethodPrimitiveErrorInResponseHeaderError(encoder func(context.Contex
 				int_s := strconv.Itoa(val)
 				w.Header().Set("Int", int_s)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusInternalServerError)
 			return nil
 		default:
@@ -80,11 +88,15 @@ var APIPrimitiveErrorResponseEncoderCode = `// EncodeMethodAPIPrimitiveErrorResp
 func EncodeMethodAPIPrimitiveErrorResponseError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error {
 	encodeError := goahttp.ErrorEncoder(encoder, formatter)
 	return func(ctx context.Context, w http.ResponseWriter, v error) error {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if !errors.As(v, &en) {
 			return encodeError(ctx, w, v)
 		}
-		switch en.ErrorName() {
+		switch en.GoaErrorName() {
 		case "internal_error":
 			var res *goa.ServiceError
 			errors.As(v, &res)
@@ -95,7 +107,7 @@ func EncodeMethodAPIPrimitiveErrorResponseError(encoder func(context.Context, ht
 			} else {
 				body = NewMethodAPIPrimitiveErrorResponseInternalErrorResponseBody(res)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusInternalServerError)
 			return enc.Encode(body)
 		case "bad_request":
@@ -103,7 +115,7 @@ func EncodeMethodAPIPrimitiveErrorResponseError(encoder func(context.Context, ht
 			errors.As(v, &res)
 			enc := encoder(ctx, w)
 			body := res
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusBadRequest)
 			return enc.Encode(body)
 		default:
@@ -118,11 +130,15 @@ var DefaultErrorResponseEncoderCode = `// EncodeMethodDefaultErrorResponseError
 func EncodeMethodDefaultErrorResponseError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error {
 	encodeError := goahttp.ErrorEncoder(encoder, formatter)
 	return func(ctx context.Context, w http.ResponseWriter, v error) error {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if !errors.As(v, &en) {
 			return encodeError(ctx, w, v)
 		}
-		switch en.ErrorName() {
+		switch en.GoaErrorName() {
 		case "bad_request":
 			var res *goa.ServiceError
 			errors.As(v, &res)
@@ -133,7 +149,7 @@ func EncodeMethodDefaultErrorResponseError(encoder func(context.Context, http.Re
 			} else {
 				body = NewMethodDefaultErrorResponseBadRequestResponseBody(res)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusBadRequest)
 			return enc.Encode(body)
 		default:
@@ -148,11 +164,15 @@ var DefaultErrorResponseWithContentTypeEncoderCode = `// EncodeMethodDefaultErro
 func EncodeMethodDefaultErrorResponseError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error {
 	encodeError := goahttp.ErrorEncoder(encoder, formatter)
 	return func(ctx context.Context, w http.ResponseWriter, v error) error {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if !errors.As(v, &en) {
 			return encodeError(ctx, w, v)
 		}
-		switch en.ErrorName() {
+		switch en.GoaErrorName() {
 		case "bad_request":
 			var res *goa.ServiceError
 			errors.As(v, &res)
@@ -164,7 +184,7 @@ func EncodeMethodDefaultErrorResponseError(encoder func(context.Context, http.Re
 			} else {
 				body = NewMethodDefaultErrorResponseBadRequestResponseBody(res)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusBadRequest)
 			return enc.Encode(body)
 		default:
@@ -179,11 +199,15 @@ var ServiceErrorResponseEncoderCode = `// EncodeMethodServiceErrorResponseError
 func EncodeMethodServiceErrorResponseError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error {
 	encodeError := goahttp.ErrorEncoder(encoder, formatter)
 	return func(ctx context.Context, w http.ResponseWriter, v error) error {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if !errors.As(v, &en) {
 			return encodeError(ctx, w, v)
 		}
-		switch en.ErrorName() {
+		switch en.GoaErrorName() {
 		case "internal_error":
 			var res *goa.ServiceError
 			errors.As(v, &res)
@@ -194,7 +218,7 @@ func EncodeMethodServiceErrorResponseError(encoder func(context.Context, http.Re
 			} else {
 				body = NewMethodServiceErrorResponseInternalErrorResponseBody(res)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusInternalServerError)
 			return enc.Encode(body)
 		case "bad_request":
@@ -207,7 +231,7 @@ func EncodeMethodServiceErrorResponseError(encoder func(context.Context, http.Re
 			} else {
 				body = NewMethodServiceErrorResponseBadRequestResponseBody(res)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusBadRequest)
 			return enc.Encode(body)
 		default:
@@ -222,11 +246,15 @@ var ServiceErrorResponseWithContentTypeEncoderCode = `// EncodeMethodServiceErro
 func EncodeMethodServiceErrorResponseError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error {
 	encodeError := goahttp.ErrorEncoder(encoder, formatter)
 	return func(ctx context.Context, w http.ResponseWriter, v error) error {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if !errors.As(v, &en) {
 			return encodeError(ctx, w, v)
 		}
-		switch en.ErrorName() {
+		switch en.GoaErrorName() {
 		case "internal_error":
 			var res *goa.ServiceError
 			errors.As(v, &res)
@@ -237,7 +265,7 @@ func EncodeMethodServiceErrorResponseError(encoder func(context.Context, http.Re
 			} else {
 				body = NewMethodServiceErrorResponseInternalErrorResponseBody(res)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusInternalServerError)
 			return enc.Encode(body)
 		case "bad_request":
@@ -251,7 +279,7 @@ func EncodeMethodServiceErrorResponseError(encoder func(context.Context, http.Re
 			} else {
 				body = NewMethodServiceErrorResponseBadRequestResponseBody(res)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusBadRequest)
 			return enc.Encode(body)
 		default:
@@ -266,18 +294,22 @@ var NoBodyErrorResponseEncoderCode = `// EncodeMethodServiceErrorResponseError r
 func EncodeMethodServiceErrorResponseError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error {
 	encodeError := goahttp.ErrorEncoder(encoder, formatter)
 	return func(ctx context.Context, w http.ResponseWriter, v error) error {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if !errors.As(v, &en) {
 			return encodeError(ctx, w, v)
 		}
-		switch en.ErrorName() {
+		switch en.GoaErrorName() {
 		case "bad_request":
 			var res *servicenobodyerrorresponse.StringError
 			errors.As(v, &res)
 			if res.Header != nil {
 				w.Header().Set("Header", *res.Header)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusBadRequest)
 			return nil
 		default:
@@ -292,11 +324,15 @@ var NoBodyErrorResponseWithContentTypeEncoderCode = `// EncodeMethodServiceError
 func EncodeMethodServiceErrorResponseError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error {
 	encodeError := goahttp.ErrorEncoder(encoder, formatter)
 	return func(ctx context.Context, w http.ResponseWriter, v error) error {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if !errors.As(v, &en) {
 			return encodeError(ctx, w, v)
 		}
-		switch en.ErrorName() {
+		switch en.GoaErrorName() {
 		case "bad_request":
 			var res *servicenobodyerrorresponse.StringError
 			errors.As(v, &res)
@@ -304,7 +340,7 @@ func EncodeMethodServiceErrorResponseError(encoder func(context.Context, http.Re
 			if res.Header != nil {
 				w.Header().Set("Header", *res.Header)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusBadRequest)
 			return nil
 		default:
@@ -320,11 +356,15 @@ var EmptyErrorResponseBodyEncoderCode = `// EncodeMethodEmptyErrorResponseBodyEr
 func EncodeMethodEmptyErrorResponseBodyError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error {
 	encodeError := goahttp.ErrorEncoder(encoder, formatter)
 	return func(ctx context.Context, w http.ResponseWriter, v error) error {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if !errors.As(v, &en) {
 			return encodeError(ctx, w, v)
 		}
-		switch en.ErrorName() {
+		switch en.GoaErrorName() {
 		case "internal_error":
 			var res *goa.ServiceError
 			errors.As(v, &res)
@@ -346,7 +386,7 @@ func EncodeMethodEmptyErrorResponseBodyError(encoder func(context.Context, http.
 				faults := strconv.FormatBool(val)
 				w.Header().Set("Goa-Attribute-Fault", faults)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusInternalServerError)
 			return nil
 		case "not_found":
@@ -357,7 +397,7 @@ func EncodeMethodEmptyErrorResponseBodyError(encoder func(context.Context, http.
 				inHeaders := val
 				w.Header().Set("In-Header", inHeaders)
 			}
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusNotFound)
 			return nil
 		default:
@@ -373,15 +413,19 @@ var EmptyCustomErrorResponseBodyEncoderCode = `// EncodeMethodEmptyCustomErrorRe
 func EncodeMethodEmptyCustomErrorResponseBodyError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error {
 	encodeError := goahttp.ErrorEncoder(encoder, formatter)
 	return func(ctx context.Context, w http.ResponseWriter, v error) error {
-		var en ErrorNamer
+		var deprecatedErrorNamer ErrorNamer
+		if errors.As(v, &deprecatedErrorNamer) {
+			v = adaptErrorNamer(deprecatedErrorNamer)
+		}
+		var en GoaErrorNamer
 		if !errors.As(v, &en) {
 			return encodeError(ctx, w, v)
 		}
-		switch en.ErrorName() {
+		switch en.GoaErrorName() {
 		case "internal_error":
 			var res *serviceemptycustomerrorresponsebody.Error
 			errors.As(v, &res)
-			w.Header().Set("goa-error", res.ErrorName())
+			w.Header().Set("goa-error", res.GoaErrorName())
 			w.WriteHeader(http.StatusInternalServerError)
 			return nil
 		default: