MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / walkResponseRef

Function walkResponseRef

pkg/codegen/prune.go:214–251  ·  view source on GitHub ↗
(ref *openapi3.ResponseRef, doFn func(RefWrapper) (bool, error))

Source from the content-addressed store, hash-verified

212}
213
214func walkResponseRef(ref *openapi3.ResponseRef, doFn func(RefWrapper) (bool, error)) error {
215 // Not a valid ref, ignore it and continue
216 if ref == nil {
217 return nil
218 }
219 refWrapper := RefWrapper{Ref: ref.Ref, HasValue: ref.Value != nil, SourceRef: ref}
220 shouldContinue, err := doFn(refWrapper)
221 if err != nil {
222 return err
223 }
224 if !shouldContinue {
225 return nil
226 }
227 if ref.Value == nil {
228 return nil
229 }
230
231 for _, header := range ref.Value.Headers {
232 _ = walkHeaderRef(header, doFn)
233 }
234
235 for _, mediaType := range ref.Value.Content {
236 if mediaType == nil {
237 continue
238 }
239 _ = walkSchemaRef(mediaType.Schema, doFn)
240
241 for _, example := range mediaType.Examples {
242 _ = walkExampleRef(example, doFn)
243 }
244 }
245
246 for _, link := range ref.Value.Links {
247 _ = walkLinkRef(link, doFn)
248 }
249
250 return nil
251}
252
253func walkCallbackRef(ref *openapi3.CallbackRef, doFn func(RefWrapper) (bool, error)) error {
254 // Not a valid ref, ignore it and continue

Callers 2

walkOperationFunction · 0.85
walkComponentsFunction · 0.85

Calls 4

walkHeaderRefFunction · 0.85
walkSchemaRefFunction · 0.85
walkExampleRefFunction · 0.85
walkLinkRefFunction · 0.85

Tested by

no test coverage detected