diff --git a/CHANGELOG.md b/CHANGELOG.md
index 768d7a99..bd46c5ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,17 @@
# Changelog
+## 0.10.4 Released on 2023-01-10
+
+- fix rule index & support additionalProperties:true
+
+## 0.10.3 Released on 2022-11-29
+
+- fix adding enum value & command line exception
+
+## 0.10.2 Released on 2022-11-02
+
+- bugfix for RequiredStatusChange
+
## 0.10.1 Released on 2022-10-15
- Bugfixes for ReferenceRedirection,AddedPropertyInResponse,DefaultValueChanged.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..5fa2db99
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,61 @@
+# Contributing
+
+This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
+
+## Prerequisites
+
+- [Node.js](https://nodejs.org/) (14.x or higher)
+- [.NET runtime and SDK](https://aka.ms/dotnet-download)
+- [.NET CLI tools](https://github.com/dotnet/cli/releases) version 2.0.0 or higher
+
+## Build scripts
+
+Run `npm install` to install the required modules.
+
+```sh
+npm install
+```
+
+## How to build the C# code
+
+The core logic for openapi-diff is written in C# and compiled to a .NET binary.
+
+Use `dn.build` npm script to build the C# code.
+
+```sh
+npm run dn.build
+```
+
+## How to test the C# code
+
+To run all tests under the repo
+
+```sh
+npm run dn.test
+```
+
+## How to build the TypeScript code
+
+The CLI for openapi-diff is written in TypeScript and compiled to a Node.js binary.
+
+Use `tsc` npm script to build the TypeScript code.
+
+```sh
+npm run tsc
+```
+
+## How to run locally
+
+After you have built the C# and TypeScript code, you can run the openapi-diff tool locally.
+To run the openapi-diff tool locally, use the `npm run start` command.
+
+```sh
+node dist/cli.js --help
+```
+
+You can also install the package globally and run it from anywhere.
+
+```sh
+npm install -g
+oad --help
+```
diff --git a/README.md b/README.md
index 5226f832..9c4a482b 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
npm install -g @azure/oad
```
-## git Usage
+# Usage
```bash
vishrut@visshamac openapi-diff $ oad compare --help
@@ -25,49 +25,12 @@ Options:
-j, --inJson A boolean flag indicating whether output format of the
messages is json. [boolean] [default: true]
-h, --help Show help [boolean]
- -o, --oldTagName The tag name for the old specification file. If include it
+ -o, --oldTagName The tag name for the old specification file. If included it
indicates that the old spec file is a readme file
- -n, --newTagName The tag name for the new specification file. If include it
+ -n, --newTagName The tag name for the new specification file. If included it
indicates that the new spec file is a readme file
```
-## Build dependencies
-
-* [Node](https://nodejs.org) (10 or higher)
-* [Node Package Manager](https://www.npmjs.com/package/npm)
-* [.NET CLI tools](https://github.com/dotnet/cli/releases) version 2.0.0 or higher
- > You want the **.NET Core SDK Binaries** for your platform
- >
- > `dotnet --version`
- > `2.0.2`
-
-## Build scripts
-
-### How to build
-
-The first step would be to run `npm install` so we have all the required modules installed.
-
-#### How to build the whole repo
-
-```javascript
-gulp;
-```
-
-### How to test
-
-To run all tests under the repo
-
-```javascript
-gulp test
-```
-
-### How to bundle node package & install
-
-```javascript
-gulp pack
-npm install -g oad-0.1.0.tgz
-```
-
# Contributing
-This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
+See [CONTRIBUTING.md](./CONTRIBUTING.md)
diff --git a/openapi-diff/src/core/OpenApiDiff/OpenApiDiff.csproj b/openapi-diff/src/core/OpenApiDiff/OpenApiDiff.csproj
index ee318dda..626bba6f 100644
--- a/openapi-diff/src/core/OpenApiDiff/OpenApiDiff.csproj
+++ b/openapi-diff/src/core/OpenApiDiff/OpenApiDiff.csproj
@@ -4,9 +4,8 @@
- win7-x64
Exe
- netcoreapp3.1
+ netcoreapp6.0
OpenApiDiff
Microsoft OpenApiDiff
0.1.0
diff --git a/openapi-diff/src/modeler/AutoRest.Swagger.Tests/AutoRest.Swagger.Tests.csproj b/openapi-diff/src/modeler/AutoRest.Swagger.Tests/AutoRest.Swagger.Tests.csproj
index 27206d13..e5e1ffc9 100644
--- a/openapi-diff/src/modeler/AutoRest.Swagger.Tests/AutoRest.Swagger.Tests.csproj
+++ b/openapi-diff/src/modeler/AutoRest.Swagger.Tests/AutoRest.Swagger.Tests.csproj
@@ -4,7 +4,7 @@
- netcoreapp3.1
+ netcoreapp6.0
7.1
diff --git a/openapi-diff/src/modeler/AutoRest.Swagger.Tests/SwaggerModelerCompareTests.cs b/openapi-diff/src/modeler/AutoRest.Swagger.Tests/SwaggerModelerCompareTests.cs
index 5ac2f97e..c1dfbce3 100644
--- a/openapi-diff/src/modeler/AutoRest.Swagger.Tests/SwaggerModelerCompareTests.cs
+++ b/openapi-diff/src/modeler/AutoRest.Swagger.Tests/SwaggerModelerCompareTests.cs
@@ -166,7 +166,7 @@ public void TypeObjectChanged()
}
///
- /// Verifies that if if you change the default value of a schema, it's caught .
+ /// Verifies that if you change the default value of a schema, it's caught.
///
[Fact]
public void DefaultValueChanged()
@@ -174,7 +174,7 @@ public void DefaultValueChanged()
var messages = CompareSwagger("default_changed_01.json").ToArray();
var errors = messages.Where(m => m.Id == ComparisonMessages.DefaultValueChanged.Id).ToArray();
Assert.NotNull(errors);
- Assert.Equal(errors.Count(), 8);
+ Assert.Equal(8, errors.Count());
}
///
@@ -276,7 +276,7 @@ public void OperationIdRemoved()
{
var messages = CompareSwagger("removed_operation_id.json").ToArray();
var missing = messages.Where(m => m.Id == ComparisonMessages.ModifiedOperationId.Id);
- Assert.Equal(1, missing.Count());
+ Assert.Single(missing);
var x = missing.First(m => m.Severity == Category.Error && m.NewJsonRef == "new/removed_operation_id.json#/paths/~1api~1Operations/get");
Assert.NotNull(x.NewJson());
Assert.NotNull(x.OldJson());
@@ -385,6 +385,10 @@ public void RequiredParameterAdded()
Assert.Null(x.OldJson());
}
+ ///
+ /// Verifies that if you add an optional parameter, it is flagged
+ ///
+ [Fact]
public void OptionalParameterAdded()
{
var messages = CompareSwagger("optional_parameter.json").ToArray();
@@ -429,7 +433,7 @@ public void AddedPropertyInResponse()
}
///
- /// Verifies that rules work on the recurive models
+ /// Verifies that rules work on the recursive models
///
[Fact]
public void RecursiveModels()
@@ -492,11 +496,11 @@ public void PropertyRequiredChanged()
{
var messages = CompareSwagger("property_required_status_changed.json").ToArray();
var missing = messages.Where(m => m.Id == ComparisonMessages.RequiredStatusChange.Id);
- Assert.Equal(missing.Count(),2);
+ Assert.Equal(2, missing.Count());
}
///
- /// Verifieds that if you make an optional parameter required, it's caught.
+ /// Verifies that if you make an optional parameter required, it's caught.
///
[Fact]
public void ParameterStatusMore()
@@ -693,7 +697,7 @@ public void RequestTypeConstraintsChanged()
/// Verifies that making constraints stricter in requests are flagged, weaker are flagged and adding enum to parameters are flagged
///
[Fact]
- public void RequestTypeContraintsWithNewEnum()
+ public void RequestTypeConstraintsWithNewEnum()
{
var messages = CompareSwagger("enum_values_changed.json").Where(m => m.NewJsonRef.Contains("Parameters")).ToArray();
@@ -741,7 +745,7 @@ public void ResponseTypeConstraintsChanged()
/// Direction: requests
///
[Fact]
- public void GobalParamArrayFormatChanged()
+ public void GlobalParamArrayFormatChanged()
{
var messages = CompareSwagger("param_check_01.json").ToArray();
var changed = messages.Where(m => m.Id == ComparisonMessages.ArrayCollectionFormatChanged.Id).ToArray();
@@ -766,7 +770,7 @@ public void GobalParamArrayFormatChanged()
/// are just informational.
///
[Fact]
- public void GobalParamTypeConstraintsChanged()
+ public void GlobalParamTypeConstraintsChanged()
{
var messages = CompareSwagger("param_check_01.json").Where(m => m.NewJsonRef.Contains("parameters")).ToArray();
var stricter = messages.Where(m => m.Id == ComparisonMessages.ConstraintIsStronger.Id && m.Severity == Category.Error).ToArray();
@@ -783,7 +787,7 @@ public void GobalParamTypeConstraintsChanged()
/// Direction: responses
///
[Fact]
- public void GobalResponseArrayFormatChanged()
+ public void GlobalResponseArrayFormatChanged()
{
var messages = CompareSwagger("response_check_01.json").ToArray();
var changed = messages.Where(m => m.Id == ComparisonMessages.ArrayCollectionFormatChanged.Id).ToArray();
@@ -892,24 +896,24 @@ public void ChangedParameterOrder()
public void ChangedXmsLongRunningOperation()
{
var messages = CompareSwagger("long_running_operation.json").ToArray();
- Assert.Equal(1, messages.Where(m => m.Id == ComparisonMessages.XmsLongRunningOperationChanged.Id).Count());
+ Assert.Single(messages.Where(m => m.Id == ComparisonMessages.XmsLongRunningOperationChanged.Id));
}
[Fact]
public void AddedOptionalProperty()
{
var messages = CompareSwagger("added_optional_property.json").ToArray();
- Assert.Equal(1, messages.Where(m => m.Id == ComparisonMessages.AddedOptionalProperty.Id).Count());
+ Assert.Single(messages.Where(m => m.Id == ComparisonMessages.AddedOptionalProperty.Id));
}
- // Verify a inline schema of response was changed to reference schema and a new proeprty was added.
+ // Verify a inline schema of response was changed to reference schema and a new property was added.
[Fact]
public void AddedOptionalPropertyToInlineResponseSchema()
{
var messages = CompareSwagger("add_optional_property_01.json").ToArray();
- Assert.Equal(1, messages.Where(m => m.Id == ComparisonMessages.AddedPropertyInResponse.Id).Count());
- Assert.Equal(1, messages.Where(m => m.Id == ComparisonMessages.ReferenceRedirection.Id).Count());
+ Assert.Single(messages.Where(m => m.Id == ComparisonMessages.AddedPropertyInResponse.Id));
+ Assert.Single(messages.Where(m => m.Id == ComparisonMessages.ReferenceRedirection.Id));
}
[Fact]
@@ -932,8 +936,8 @@ public void ReferenceChanged()
{
var messages = CompareSwagger("xms_client_name_changed.json").ToArray();
var redirected = messages.Where(m => m.Id == ComparisonMessages.ReferenceRedirection.Id).ToArray();
- Assert.Equal(1, redirected.Count());
- Assert.Equal(redirected[0].NewJsonRef, "new/xms_client_name_changed.json#/paths/~1api~1Parameters/post/parameters/0/schema");
+ Assert.Single(redirected);
+ Assert.Equal("new/xms_client_name_changed.json#/paths/~1api~1Parameters/post/parameters/0/schema", redirected[0].NewJsonRef);
}
}
}
diff --git a/src/cli.ts b/src/cli.ts
index b717e3af..c4dbf82f 100644
--- a/src/cli.ts
+++ b/src/cli.ts
@@ -3,7 +3,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
-import * as yargs from "yargs"
+import yargs from "yargs"
import { log } from "./lib/util/logging"
const defaultLogDir = log.directory