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

Function newRecursiveType

http/codegen/openapi/v3/types_test.go:691–708  ·  view source on GitHub ↗

Helper function for recursive types

(name string)

Source from the content-addressed store, hash-verified

689
690// Helper function for recursive types
691func newRecursiveType(name string) *expr.AttributeExpr {
692 // Create a user type that references itself
693 ut := &expr.UserTypeExpr{
694 TypeName: name,
695 }
696 att := &expr.AttributeExpr{
697 Type: &expr.Object{
698 &expr.NamedAttributeExpr{
699 Name: "self",
700 Attribute: &expr.AttributeExpr{
701 Type: ut,
702 },
703 },
704 },
705 }
706 ut.AttributeExpr = att
707 return &expr.AttributeExpr{Type: ut}
708}
709
710// nameFromRef does the reverse of toRef: it returns the type name from its
711// JSON Schema reference.

Callers 1

TestHashAttributeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected