MCPcopy Index your code
hub / github.com/DataDog/jsonapi / check

Method check

jsonapi.go:111–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

109}
110
111func (l *Link) check() error {
112 selfIsEmpty, err := checkLinkValue(l.Self)
113 if err != nil {
114 return err
115 }
116
117 relatedIsEmpty, err := checkLinkValue(l.Related)
118 if err != nil {
119 return err
120 }
121
122 // if both are empty then fail, and if one is empty, it must be set to nil to satisfy omitempty
123 switch {
124 case selfIsEmpty && relatedIsEmpty:
125 return ErrMissingLinkFields
126 case selfIsEmpty:
127 l.Self = nil
128 case relatedIsEmpty:
129 l.Related = nil
130 }
131
132 return nil
133}
134
135// Document is a JSON:API document as defined by https://jsonapi.org/format/1.0/#document-top-level
136type document struct {

Callers 1

makeResourceObjectMethod · 0.95

Calls 1

checkLinkValueFunction · 0.85

Tested by

no test coverage detected