Skip to content

Commit b80c764

Browse files
mikekistlerKonrad Jamrozik
andauthored
Improve message for different format value (#304)
* Improve message for different format value * Update package.json * Update expandsAllOfFullCoversTest.ts --------- Co-authored-by: Konrad Jamrozik <kojamroz@microsoft.com>
1 parent 0742f45 commit b80c764

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

openapi-diff/src/modeler/AutoRest.Swagger/ComparisonMessages.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ public static class ComparisonMessages
310310
{
311311
Id = 1023,
312312
Code = nameof(ComparisonMessages.TypeFormatChanged),
313-
Message = "The new version has a different format than the previous one.",
313+
Message = "The new version has a different format '{0}' than the previous one '{1}'.",
314314
Type = MessageType.Update
315315
};
316316

openapi-diff/src/modeler/AutoRest.Swagger/Model/SwaggerObject.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public abstract class SwaggerObject<T> : SwaggerBase<T>
4242
/// Describes the type of additional properties in the data type.
4343
/// </summary>
4444
public virtual Schema AdditionalProperties { get; set; }
45-
45+
4646
public virtual string Description { get; set; }
4747

4848
/// <summary>
@@ -136,7 +136,7 @@ T previous
136136

137137
if ((Type.HasValue && prior.Type.HasValue && prior.Type.Value != Type.Value))
138138
{
139-
context.LogError(ComparisonMessages.TypeChanged,
139+
context.LogError(ComparisonMessages.TypeChanged,
140140
Type.HasValue ? Type.Value.ToString().ToLower() : "",
141141
prior.Type.HasValue ? prior.Type.Value.ToString().ToLower() : "");
142142
}
@@ -206,7 +206,7 @@ private void CompareEnums(ComparisonContext<ServiceDefinition> context, T prior)
206206
context.LogBreakingChange(ComparisonMessages.RemovedEnumValue, String.Join(", ", removedEnums.ToList()));
207207
}
208208
}
209-
209+
210210
if (relaxes)
211211
{
212212
IEnumerable<string> addedEnums = this.Enum.Except(prior.Enum);
@@ -282,11 +282,11 @@ protected void CompareFormats(ComparisonContext<ServiceDefinition> context, T pr
282282
throw new ArgumentNullException("context");
283283
}
284284

285-
if (prior.Format == null && Format != null ||
285+
if (prior.Format == null && Format != null ||
286286
prior.Format != null && Format == null ||
287287
prior.Format != null && Format != null && !prior.Format.Equals(Format) && !isFormatChangeAllowed(context,prior))
288-
{
289-
context.LogBreakingChange(ComparisonMessages.TypeFormatChanged);
288+
{
289+
context.LogBreakingChange(ComparisonMessages.TypeFormatChanged, Format, prior);
290290
}
291291
}
292292

@@ -414,8 +414,8 @@ private bool Narrows(string previous, string current, bool isLowerBound)
414414
{
415415
int p = 0;
416416
int c = 0;
417-
return int.TryParse(previous, out p) &&
418-
int.TryParse(current, out c) &&
417+
return int.TryParse(previous, out p) &&
418+
int.TryParse(current, out c) &&
419419
(isLowerBound ? (c > p) : (c < p));
420420
}
421421

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azure/oad",
3-
"version": "0.10.5",
3+
"version": "0.10.6",
44
"author": {
55
"name": "Microsoft Corporation",
66
"email": "azsdkteam@microsoft.com",

src/test/expandsAllOfFullCoversTest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ test("expands allOf full covers", async () => {
8787
{
8888
id: "1023",
8989
code: "TypeFormatChanged",
90-
message: "The new version has a different format than the previous one.",
90+
message: "The new version has a different format '' than the previous one 'AutoRest.Swagger.Model.Schema'.",
9191
old: {
9292
ref: `${oldFilePath}#/definitions/DataBaseProperties/properties/b`,
9393
path: "definitions.Database.properties.b",

0 commit comments

Comments
 (0)