Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions openapi-diff/src/modeler/AutoRest.Swagger/Model/Schema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,16 @@ private void CompareRequired(ComparisonContext<ServiceDefinition> context, Schem
var newRequiredNonReadOnlyPropNames = new List<string>();
foreach (string requiredPropName in Required)
{
Properties.TryGetValue(requiredPropName, out Schema propSchema);
priorSchema.Properties.TryGetValue(requiredPropName, out Schema priorPropSchema);
bool propWasRequired = priorSchema.Required?.Contains(requiredPropName) == true;
Schema propSchema = null;
Schema priorPropSchema = null;
Properties?.TryGetValue(requiredPropName, out propSchema);
priorSchema?.Properties?.TryGetValue(requiredPropName, out priorPropSchema);
bool propWasRequired = priorSchema?.Required?.Contains(requiredPropName) == true;
// Note that property is considered read-only only if it is consistently read-only both in the old and new models.
bool propIsReadOnly = propSchema?.ReadOnly == true && priorPropSchema?.ReadOnly == true;
if (!propWasRequired && !propIsReadOnly)
{
// Property is newly required and it is not read-only, hence it is a breaking change.
// Property is newly required, and it is not read-only, hence it is a breaking change.
newRequiredNonReadOnlyPropNames.Add(requiredPropName);
}
else
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure/oad",
"version": "0.10.12",
"version": "0.10.13",
"author": {
"name": "Microsoft Corporation",
"email": "azsdkteam@microsoft.com",
Expand Down