MCPcopy Index your code
hub / github.com/getkin/kin-openapi / loadFromDataWithPathInternal

Method loadFromDataWithPathInternal

openapi3/loader.go:188–212  ·  view source on GitHub ↗
(data []byte, location *url.URL)

Source from the content-addressed store, hash-verified

186}
187
188func (loader *Loader) loadFromDataWithPathInternal(data []byte, location *url.URL) (*T, error) {
189 if loader.visitedDocuments == nil {
190 loader.visitedDocuments = make(map[string]*T)
191 loader.rootLocation = location.Path
192 }
193 uri := location.String()
194 if doc, ok := loader.visitedDocuments[uri]; ok {
195 return doc, nil
196 }
197
198 doc := &T{}
199 loader.visitedDocuments[uri] = doc
200
201 if err := unmarshal(data, doc, loader.IncludeOrigin, location); err != nil {
202 return nil, err
203 }
204
205 doc.url = copyURI(location)
206
207 if err := loader.ResolveRefsIn(doc, location); err != nil {
208 return nil, err
209 }
210
211 return doc, nil
212}
213
214// ResolveRefsIn expands references if for instance spec was just unmarshaled
215func (loader *Loader) ResolveRefsIn(doc *T, location *url.URL) (err error) {

Callers 2

loadFromURIInternalMethod · 0.95
LoadFromDataWithPathMethod · 0.95

Calls 4

ResolveRefsInMethod · 0.95
unmarshalFunction · 0.70
copyURIFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected