MCPcopy Create free account
hub / github.com/pace/bricks / validate

Method validate

http/jsonapi/node.go:72–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70type Links map[string]interface{}
71
72func (l *Links) validate() (err error) {
73 // Each member of a links object is a “link”. A link MUST be represented as
74 // either:
75 // - a string containing the link’s URL.
76 // - an object (“link object”) which can contain the following members:
77 // - href: a string containing the link’s URL.
78 // - meta: a meta object containing non-standard meta-information about the
79 // link.
80 for k, v := range *l {
81 _, isString := v.(string)
82 _, isLink := v.(Link)
83
84 if !(isString || isLink) {
85 return fmt.Errorf(
86 "The %s member of the links object was not a string or link object",
87 k,
88 )
89 }
90 }
91 return
92}
93
94// Link is used to represent a member of the `links` object.
95type Link struct {

Callers 2

MarshalFunction · 0.80
visitModelNodeFunction · 0.80

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected