There is a case where there is validation but no actual validation code: if the validation is a required validation that applies to attributes that cannot be nil i.e. primitive types.
(att *expr.AttributeExpr, attCtx *AttributeContext)
| 499 | // the validation is a required validation that applies to attributes that |
| 500 | // cannot be nil i.e. primitive types. |
| 501 | func generatedRequiredValidation(att *expr.AttributeExpr, attCtx *AttributeContext) (res []string) { |
| 502 | if att.Validation == nil { |
| 503 | return |
| 504 | } |
| 505 | obj := expr.AsObject(att.Type) |
| 506 | for _, req := range att.Validation.Required { |
| 507 | reqAtt := obj.Attribute(req) |
| 508 | if reqAtt == nil { |
| 509 | continue |
| 510 | } |
| 511 | if !attCtx.Pointer && expr.IsPrimitive(reqAtt.Type) && |
| 512 | reqAtt.Type.Kind() != expr.BytesKind && |
| 513 | reqAtt.Type.Kind() != expr.AnyKind { |
| 514 | continue |
| 515 | } |
| 516 | if attCtx.IgnoreRequired && expr.IsPrimitive(reqAtt.Type) { |
| 517 | continue |
| 518 | } |
| 519 | res = append(res, req) |
| 520 | } |
| 521 | return |
| 522 | } |
| 523 | |
| 524 | func flattenValidations(att *expr.AttributeExpr, seen map[string]struct{}) { |
| 525 | switch actual := att.Type.(type) { |
no test coverage detected