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

Method GetTypeKey

expr/types.go:660–665  ·  view source on GitHub ↗

GetTypeKey returns the discriminator field name for JSON marshaling. Defaults to "type" if not explicitly set via Meta("oneof:type:field").

()

Source from the content-addressed store, hash-verified

658// GetTypeKey returns the discriminator field name for JSON marshaling.
659// Defaults to "type" if not explicitly set via Meta("oneof:type:field").
660func (u *Union) GetTypeKey() string {
661 if u.TypeKey != "" {
662 return u.TypeKey
663 }
664 return "type"
665}
666
667// GetValueKey returns the value field name for JSON marshaling.
668// Defaults to "value" if not explicitly set via Meta("oneof:value:field").

Callers 9

TestUnionGetTypeKeyFunction · 0.95
UnionToObjectFunction · 0.80
buildHTTPUnionTypeDataFunction · 0.80
TypeSchemaWithPrefixFunction · 0.80
schemafyMethod · 0.80
TestOneOfCustomKeysFunction · 0.80
buildUnionTypeDataFunction · 0.80
buildViewUnionTypeDataFunction · 0.80

Calls

no outgoing calls

Tested by 3

TestUnionGetTypeKeyFunction · 0.76
TestOneOfCustomKeysFunction · 0.64