DupRequirement creates a copy of the given security requirement.
(req *SecurityExpr)
| 119 | |
| 120 | // DupRequirement creates a copy of the given security requirement. |
| 121 | func DupRequirement(req *SecurityExpr) *SecurityExpr { |
| 122 | dup := &SecurityExpr{ |
| 123 | Scopes: req.Scopes, |
| 124 | Schemes: make([]*SchemeExpr, 0, len(req.Schemes)), |
| 125 | } |
| 126 | for _, s := range req.Schemes { |
| 127 | dup.Schemes = append(dup.Schemes, DupScheme(s)) |
| 128 | } |
| 129 | return dup |
| 130 | } |
| 131 | |
| 132 | // DupScheme creates a copy of the given scheme expression. |
| 133 | func DupScheme(sch *SchemeExpr) *SchemeExpr { |