Closed Gurleen-Singh closed 8 years ago
Hi,
Groupby the ouput messages by message.exec(/^(.*)\s\-\s.*$/)[0]
as message output is always <path> - <message>
Rules should returns an array an object containing message, path and some more metadata.
function rule(diff: RawDiff) : String
to
function rule(diff: RawDiff) : Object{message: String, path: String, ...}
Rules are only used there, so it shouldn't be hard to change (most of rules are tested) https://github.com/zallek/swagger-diff/blob/master/src/workflow/applyRules.js#L29 https://github.com/zallek/swagger-diff/blob/master/src/workflow/applyRules.js#L46
So at those lines, turn object shape from
Diff {
ruleId: String,
message: String, // Would be better to keep the message property as-is in order to not introduce any interface breaking
path: String,
shortMessage: String, // Any idea fot a better property name ? :p
}
Example:
{
ruleId: 'add-required-param',
message: '/users/{username}/ (get) - Required param username added',
path: '/users/{username}/ (get)',
shortMessage: 'Required param username added',
}
Maybe you could improve something about the path too. Your inputs would be appreciated. Thx :)
done
Hiii.. We want to change the Output from rule-centric to path-centric. It will simplify the output and make it easy to understand. Any help in doing this is much appreciated.
TIA,