MCPcopy Create free account
hub / github.com/goadesign/goa / clientResponseViewName

Function clientResponseViewName

http/codegen/service_data.go:2816–2827  ·  view source on GitHub ↗

clientResponseViewName returns the response view used by client code generation when the design fixes the response to a single view. An empty string means the client must keep the unprojected transport body because the server may render multiple views.

(e *expr.HTTPEndpointExpr, md *service.MethodData)

Source from the content-addressed store, hash-verified

2814// string means the client must keep the unprojected transport body because the
2815// server may render multiple views.
2816func clientResponseViewName(e *expr.HTTPEndpointExpr, md *service.MethodData) string {
2817 if md == nil || md.ViewedResult == nil {
2818 return ""
2819 }
2820 if v, ok := e.MethodExpr.Result.Meta.Last(expr.ViewMetaKey); ok {
2821 return v
2822 }
2823 if len(md.ViewedResult.Views) == 1 {
2824 return md.ViewedResult.Views[0].Name
2825 }
2826 return ""
2827}
2828
2829func buildHTTPUnionTypeData(u *expr.Union, scope *codegen.NameScope) *service.UnionTypeData {
2830 att := &expr.AttributeExpr{Type: u}

Callers 2

buildResponsesMethod · 0.85

Calls 1

LastMethod · 0.80

Tested by

no test coverage detected