ParseMetadata parse metadata.
(attribute, lowerAttribute, lineRemainder string)
| 209 | |
| 210 | // ParseMetadata parse metadata. |
| 211 | func (operation *Operation) ParseMetadata(attribute, lowerAttribute, lineRemainder string) error { |
| 212 | // parsing specific meta data extensions |
| 213 | if strings.HasPrefix(lowerAttribute, "@x-") { |
| 214 | if len(lineRemainder) == 0 { |
| 215 | return fmt.Errorf("annotation %s need a value", attribute) |
| 216 | } |
| 217 | |
| 218 | var valueJSON interface{} |
| 219 | |
| 220 | err := json.Unmarshal([]byte(lineRemainder), &valueJSON) |
| 221 | if err != nil { |
| 222 | return fmt.Errorf("annotation %s need a valid json value", attribute) |
| 223 | } |
| 224 | |
| 225 | // don't use the method provided by spec lib, because it will call toLower() on attribute names, which is wrongly |
| 226 | operation.Extensions[attribute[1:]] = valueJSON |
| 227 | } |
| 228 | |
| 229 | return nil |
| 230 | } |
| 231 | |
| 232 | var paramPattern = regexp.MustCompile(`(\S+)\s+(\w+)\s+([\S. ]+?)\s+(\w+)\s+"([^"]+)"`) |
| 233 |
no outgoing calls
no test coverage detected