Closed konrad-jamrozik closed 1 month ago
should I make it so that all errors messages always show previous/current paths?
My vote would be "yes", depending how difficult it would be to implement, and how many rules implement their own version of it already. More standardization of rules is better.
should I make it so that all errors messages always show previous/current paths?
My vote would be "yes", depending how difficult it would be to implement, and how many rules implement their own version of it already. More standardization of rules is better.
@mikeharder OK let's see how we like how this rule prints out once deployed. Based on that I will adjust all the rules.
OK looking at the code, what openapi-alps
receives from openapi-diff
is this data structure built from ComparisonMessage
:
public string GetValidationMessagesAsJson()
{
var rawMessage = new JsonComparisonMessage
{
id = Id.ToString(),
code = Code.ToString(),
message = Message,
type = Severity.ToString(),
docUrl = DocUrl.ToString(),
mode = Mode.ToString(),
old = new JsonLocation
{
@ref = OldJsonRef,
path = OldJson()?.Path,
location = OldLocation(),
},
@new = new JsonLocation
{
@ref = NewJsonRef,
path = NewJson()?.Path,
location = NewLocation(),
}
};
and then openapi-alps
proceeds to output location
property in the table rows
new JsonLocation
{
@ref = error.NewJsonRef,
path = error.NewJson()?.Path,
location = error.NewLocation(),
};
like e.g. this one:
but I could instead make openapi-alps
display different value than location
. Here is example data injected into openapi-diff
unit test:
The location
is what we have currently, but I could replace it with path
or @ref
. Or I could concatenate location
and path
.
I am closing this PR in favor of:
Addresses:
Example of error message after changes (new text emboldened):
@mikekistler should I make it so that all errors messages always show previous/current paths?
I noticed we already display stuff like this:
was the
Old / New
not enough?Implementation note:
The
Old / New
is populated byazureSwaggerValidation/src/unifiedPipelineHelper.ts/oadMessagesToResultMessageRecords
:where
messages: OadMessage[]
come from:breaking-change.ts / doBreakingChangeDetection
:where
filteredOadMessages
are derived frombreaking-change.ts / runOad