Repository: goadesign/goa
Pull request #3445 (2024-01-12 01:35:24)

Add APIName constant to generated code
Useful to configure telemetry.


Patch:
diff --git a/codegen/service/service.go b/codegen/service/service.go
index 004616b1..53a03a08 100644
--- a/codegen/service/service.go
+++ b/codegen/service/service.go
@@ -329,14 +329,17 @@ type Auther interface {
 }
 {{- end }}
 
+// APIName is the name of the API as defined in the design.
+const APIName = {{ printf "%q" .APIName }}
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = {{ printf "%q" .APIVersion }}
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = {{ printf "%q" .Name }}
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = {{ printf "%q" .APIVersion }}
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
diff --git a/codegen/service/service_data.go b/codegen/service/service_data.go
index fa718e69..114da03e 100644
--- a/codegen/service/service_data.go
+++ b/codegen/service/service_data.go
@@ -41,6 +41,8 @@ type (
 		Name string
 		// Description is the service description.
 		Description string
+		// APIName is the name of the API the service belongs to.
+		APIName string
 		// APIVersion is the API version.
 		APIVersion string
 		// StructName is the service struct name.
@@ -749,6 +751,7 @@ func (d ServicesData) analyze(service *expr.ServiceExpr) *Data {
 	data := &Data{
 		Name:               service.Name,
 		Description:        desc,
+		APIName:            expr.Root.API.Name,
 		APIVersion:         expr.Root.API.Version,
 		VarName:            varName,
 		PathName:           codegen.SnakeCase(varName),


Test patch:
diff --git a/codegen/service/testdata/service_code.go b/codegen/service/testdata/service_code.go
index c9071467..353cc117 100644
--- a/codegen/service/testdata/service_code.go
+++ b/codegen/service/testdata/service_code.go
@@ -7,14 +7,17 @@ type Service interface {
 	MethodWithSpaces(context.Context, *PayloadWithSpace) (res *ResultWithSpace, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "API With Spaces"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "Service With Spaces"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -71,14 +74,17 @@ type Service interface {
 	A(context.Context, *APayload) (res *AResult, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "SingleMethod"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -112,14 +118,17 @@ type Service interface {
 	B(context.Context, *BPayload) (res *BResult, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "MultipleMethods"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -181,14 +190,17 @@ type Service interface {
 	A(context.Context, *AUnion) (res *AUnion, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "UnionService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -222,14 +234,17 @@ type Service interface {
 	MultiUnion(context.Context, *Union) (res *Union, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "MultiUnionService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -261,14 +276,17 @@ type Service interface {
 	A(context.Context, *APayload) (res *AResult, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "WithDefault"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -298,14 +316,17 @@ type Service interface {
 	Empty(context.Context) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "Empty"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -319,14 +340,17 @@ type Service interface {
 	EmptyResult(context.Context, *APayload) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "EmptyResult"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -349,14 +373,17 @@ type Service interface {
 	EmptyPayload(context.Context) (res *AResult, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "EmptyPayload"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -379,14 +406,17 @@ type Service interface {
 	A(context.Context) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "ServiceError"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -405,14 +435,17 @@ type Service interface {
 	A(context.Context) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "CustomErrors"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -493,14 +526,17 @@ type Service interface {
 	A(context.Context) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "CustomErrorsCustomFields"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -540,14 +576,17 @@ type Service interface {
 	B(context.Context) (res *SingleView, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "MultipleMethodsResultMultipleViews"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -688,14 +727,17 @@ type Service interface {
 	AEndpoint(context.Context) (res *MultipleViews, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "WithExplicitAndDefaultViews"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -789,14 +831,17 @@ type Service interface {
 	A(context.Context) (res MultipleViewsCollection, view string, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "ResultCollectionMultipleViewsMethod"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -934,14 +979,17 @@ type Service interface {
 	A(context.Context) (res *MultipleViews, view string, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "ResultWithOtherResult"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -1087,14 +1135,17 @@ type Service interface {
 	A(context.Context) (res *RT, view string, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "ResultWithResultTypeCollection"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -1337,14 +1388,17 @@ type Service interface {
 	List(context.Context) (res *ListResult, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "ResultWithDashedMimeType"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -1404,14 +1458,17 @@ type Service interface {
 	A(context.Context) (res *ResultOneof, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "ResultWithOneOfType"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -1586,14 +1643,17 @@ type Service interface {
 	B(context.Context) (res *ResultInlineValidationBResult, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "ResultWithInlineValidation"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -1655,14 +1715,17 @@ type Service interface {
 	A(context.Context) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "ForceGenerateType"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -1680,14 +1743,17 @@ type Service interface {
 	A(context.Context) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "ForceGenerateTypeExplicit"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -1705,14 +1771,17 @@ type Service interface {
 	StreamingResultMethod(context.Context, *APayload, StreamingResultMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "StreamingResultService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -1765,14 +1834,17 @@ type Service interface {
 	StreamingResultWithViewsMethod(context.Context, string, StreamingResultWithViewsMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "StreamingResultWithViewsService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -1878,14 +1950,17 @@ type Service interface {
 	StreamingResultWithExplicitViewMethod(context.Context, []int32, StreamingResultWithExplicitViewMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "StreamingResultWithExplicitViewService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -1989,14 +2064,17 @@ type Service interface {
 	StreamingResultNoPayloadMethod(context.Context, StreamingResultNoPayloadMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "StreamingResultNoPayloadService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2036,14 +2114,17 @@ type Service interface {
 	StreamingPayloadMethod(context.Context, *BPayload, StreamingPayloadMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "StreamingPayloadService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2116,14 +2197,17 @@ type Service interface {
 	StreamingPayloadNoPayloadMethod(context.Context, StreamingPayloadNoPayloadMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "StreamingPayloadNoPayloadService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2156,14 +2240,17 @@ type Service interface {
 	StreamingPayloadNoResultMethod(context.Context, StreamingPayloadNoResultMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "StreamingPayloadNoResultService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2199,14 +2286,17 @@ type Service interface {
 	StreamingPayloadResultWithViewsMethod(context.Context, StreamingPayloadResultWithViewsMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "StreamingPayloadResultWithViewsService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2328,14 +2418,17 @@ type Service interface {
 	StreamingPayloadResultWithExplicitViewMethod(context.Context, StreamingPayloadResultWithExplicitViewMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "StreamingPayloadResultWithExplicitViewService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2444,14 +2537,17 @@ type Service interface {
 	BidirectionalStreamingMethod(context.Context, *BPayload, BidirectionalStreamingMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "BidirectionalStreamingService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2528,14 +2624,17 @@ type Service interface {
 	BidirectionalStreamingNoPayloadMethod(context.Context, BidirectionalStreamingNoPayloadMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "BidirectionalStreamingNoPayloadService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2576,14 +2675,17 @@ type Service interface {
 	BidirectionalStreamingResultWithViewsMethod(context.Context, BidirectionalStreamingResultWithViewsMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "BidirectionalStreamingResultWithViewsService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2710,14 +2812,17 @@ type Service interface {
 	BidirectionalStreamingResultWithExplicitViewMethod(context.Context, BidirectionalStreamingResultWithExplicitViewMethodServerStream) (err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "BidirectionalStreamingResultWithExplicitViewService"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2829,14 +2934,17 @@ type Service interface {
 	A(context.Context, *foo.Foo) (res *foo.Foo, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "PkgPathMethod"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2850,14 +2958,17 @@ type Service interface {
 	A(context.Context, []*foo.Foo) (res []*foo.Foo, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "PkgPathArrayMethod"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2871,14 +2982,17 @@ type Service interface {
 	A(context.Context, *foo.RecursiveFoo) (res *foo.RecursiveFoo, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "PkgPathRecursiveMethod"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2896,14 +3010,17 @@ type Service interface {
 	EnvelopedB(context.Context, *EnvelopedBPayload) (res *EnvelopedBResult, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "MultiplePkgPathMethod"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2966,14 +3083,17 @@ type Service interface {
 	A(context.Context, *NoDir) (res *NoDir, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "NoDirMethod"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -2994,14 +3114,17 @@ type Service interface {
 	B(context.Context, *foo.Foo) (res *foo.Foo, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "PkgPathDupeMethod"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -3023,14 +3146,17 @@ type Service interface {
 	B(context.Context, *foo.Foo) (res *foo.Foo, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "PkgPathDupeMethod2"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.
@@ -3044,14 +3170,17 @@ type Service interface {
 	FooEndpoint(context.Context, *Bar) (res *Bar, err error)
 }
 
+// APIName is the name of the API as defined in the design.
+const APIName = "test api"
+
+// APIVersion is the version of the API as defined in the design.
+const APIVersion = "0.0.1"
+
 // ServiceName is the name of the service as defined in the design. This is the
 // same value that is set in the endpoint request contexts under the ServiceKey
 // key.
 const ServiceName = "PkgPathPayloadAttributeDSL"
 
-// APIVersion is the version of the API as defined in the design.
-const APIVersion = "0.0.1"
-
 // MethodNames lists the service method names as defined in the design. These
 // are the same values that are set in the endpoint request contexts under the
 // MethodKey key.