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

Function ValidationCode

codegen/validation.go:90–92  ·  view source on GitHub ↗

ValidationCode produces Go code that runs the validations defined in the given attribute and its children recursively against the value held by the variable named target. put is the parent UserType if any. It is used to compute proto oneof type names. attCtx is the attribute context used to genera

(att *expr.AttributeExpr, put expr.UserType, attCtx *AttributeContext, req, alias, view bool, target string)

Source from the content-addressed store, hash-verified

88//
89// context is used to produce helpful messages in case of error.
90func ValidationCode(att *expr.AttributeExpr, put expr.UserType, attCtx *AttributeContext, req, alias, view bool, target string) string {
91 return recurseValidationCode(att, put, attCtx, req, alias, view, target, target, nil).String()
92}
93
94func recurseValidationCode(att *expr.AttributeExpr, put expr.UserType, attCtx *AttributeContext, req, alias, view bool, target, context string, seen map[string]*bytes.Buffer) *bytes.Buffer {
95 if seen == nil {

Callers 13

buildPayloadDataMethod · 0.92
buildResponsesMethod · 0.92
buildRequestBodyTypeMethod · 0.92
buildResponseBodyTypeMethod · 0.92
attributeTypeDataMethod · 0.92
initWebSocketDataMethod · 0.92
addValidationFunction · 0.92
buildValidationsFunction · 0.92

Calls 2

recurseValidationCodeFunction · 0.85
StringMethod · 0.65