pathOperations returns all non-nil operations for a path item.
(item *v3.PathItem)
| 184 | |
| 185 | // pathOperations returns all non-nil operations for a path item. |
| 186 | func pathOperations(item *v3.PathItem) map[string]*v3.Operation { |
| 187 | all := map[string]*v3.Operation{ |
| 188 | http.MethodGet: item.Get, |
| 189 | http.MethodPost: item.Post, |
| 190 | http.MethodPut: item.Put, |
| 191 | http.MethodPatch: item.Patch, |
| 192 | http.MethodDelete: item.Delete, |
| 193 | http.MethodHead: item.Head, |
| 194 | http.MethodOptions: item.Options, |
| 195 | } |
| 196 | |
| 197 | ops := make(map[string]*v3.Operation, len(all)) |
| 198 | for m, op := range all { |
| 199 | if op != nil { |
| 200 | ops[m] = op |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | return ops |
| 205 | } |
| 206 | |
| 207 | // resolveBaseURL determines the base URL for API requests. |
| 208 | func (t *ToolSet) resolveBaseURL(spec *v3.Document) (string, error) { |