-
Notifications
You must be signed in to change notification settings - Fork 2
/
operation_visitor_gen.go
55 lines (45 loc) · 1.37 KB
/
operation_visitor_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package openapi
// This file was automatically generated.
// DO NOT EDIT MANUALLY. All changes will be lost
import (
"context"
"github.com/pkg/errors"
)
var _ = context.Background
var _ = errors.Cause
// OperationVisitor is an interface for objects that knows
// how to process Operation elements while traversing the OpenAPI structure
type OperationVisitor interface {
VisitOperation(context.Context, Operation) error
}
func visitOperation(ctx context.Context, elem Operation) error {
select {
case <-ctx.Done():
return ctx.Err()
default:
}
if v, ok := ctx.Value(operationVisitorCtxKey{}).(OperationVisitor); ok {
if err := v.VisitOperation(ctx, elem); err != nil {
if err == ErrVisitAbort {
return nil
}
return errors.Wrap(err, `failed to visit Operation element`)
}
}
if child := elem.ExternalDocs(); child != nil {
if err := visitExternalDocumentation(ctx, child); err != nil {
return errors.Wrap(err, `failed to visit ExternalDocs element for Operation`)
}
}
if child := elem.RequestBody(); child != nil {
if err := visitRequestBody(ctx, child); err != nil {
return errors.Wrap(err, `failed to visit RequestBody element for Operation`)
}
}
if child := elem.Responses(); child != nil {
if err := visitResponses(ctx, child); err != nil {
return errors.Wrap(err, `failed to visit Responses element for Operation`)
}
}
return nil
}