(resourcePath string, body string)
| 250 | } |
| 251 | |
| 252 | func generatePath(resourcePath string, body string) string { |
| 253 | var curSchema = schema.GetSchemaByURLPath(resourcePath) |
| 254 | path := resourcePath |
| 255 | if _, ok := curSchema.SyncKeyTemplate(); ok { |
| 256 | var data map[string]interface{} |
| 257 | err := json.Unmarshal(([]byte)(body), &data) |
| 258 | if err != nil { |
| 259 | log.Error(fmt.Sprintf("Error %v during unmarshaling data %v", err, data)) |
| 260 | } else { |
| 261 | path, err = curSchema.GenerateCustomPath(data) |
| 262 | if err != nil { |
| 263 | path = resourcePath |
| 264 | log.Error(fmt.Sprintf("%v", err)) |
| 265 | } |
| 266 | } |
| 267 | } |
| 268 | if !curSchema.SkipConfigPrefix() { |
| 269 | path = configPrefix + path |
| 270 | } |
| 271 | log.Info("Generated path: %s", path) |
| 272 | return path |
| 273 | } |
no test coverage detected