Skip to content

Commit 720b650

Browse files
author
Vlad Barosan
authored
Merge pull request #114 from vladbarosan/fixNull
Fix null parameter
2 parents 01ceef7 + 587040b commit 720b650

File tree

5 files changed

+74
-3534
lines changed

5 files changed

+74
-3534
lines changed

CHANGELOG.md

+24-17
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
1-
## 0.1.10
2-
Released on 2018-03-15.
3-
- Fix crash when there are no required parameters. [#107](https://github.com/Azure/openapi-diff/issues/107)
1+
# Changelog
42

5-
## 0.1.9
6-
Released on 2017-10-23.
7-
- Fix publishing issue of 0.1.8 where some dlls were missing.
3+
## 0.1.11 Released on 2018-05-14
84

9-
## 0.1.8
10-
Released on 2017-10-20.
11-
- Updating to use AutoRest 2. This solves [#105](https://github.com/Azure/openapi-diff/issues/105)
5+
* Fix crash on no operation parameters . [#86](https://github.com/Azure/openapi-diff/issues/86)
126

13-
## 0.1.7
14-
Released on 2017-08-10.
15-
- Chaining the promises upto `compare` method and gracefully exiting application [#88](https://github.com/Azure/openapi-diff/issues/88)
7+
## 0.1.10 Released on 2018-03-15
168

17-
## 0.1.x
18-
Released on 2017-07-18. All issues associated with this release can be found using this filter [Sprint-103](https://github.com/Azure/openapi-diff/issues?q=label%3ASprint-103+is%3Aclosed) [Sprint-104](https://github.com/Azure/openapi-diff/issues?utf8=%E2%9C%93&q=label%3ASprint-104%20is%3Aclosed)
9+
* Fix crash when there are no required parameters. [#107](https://github.com/Azure/openapi-diff/issues/107)
1910

20-
#### Added
21-
- Initial release of oad.
22-
- Added by [Vishrut Shah](https://github.com/vishrutshah).
11+
## 0.1.9 Released on 2017-10-23
12+
13+
* Fix publishing issue of 0.1.8 where some dlls were missing.
14+
15+
## 0.1.8 Released on 2017-10-20
16+
17+
* Updating to use AutoRest 2. This solves [#105](https://github.com/Azure/openapi-diff/issues/105)
18+
19+
## 0.1.7 Released on 2017-08-10.
20+
21+
* Chaining the promises upto `compare` method and gracefully exiting application [#88](https://github.com/Azure/openapi-diff/issues/88)
22+
23+
## 0.1.x Released on 2017-07-18.
24+
25+
* All issues associated with this release can be found using this filter [Sprint-103](https://github.com/Azure/openapi-diff/issues?q=label%3ASprint-103+is%3Aclosed) [Sprint-104](https://github.com/Azure/openapi-diff/issues?utf8=%E2%9C%93&q=label%3ASprint-104%20is%3Aclosed)
26+
27+
## Added
28+
29+
* Initial release of oad.

README.md

+28-18
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
### How to install
2-
```
3-
npm install -g [email protected]
4-
```
1+
# How to install
52

6-
### Command Usage
3+
```javascript
4+
npm install -g oad@0.1.11
75
```
6+
7+
## git Usage
8+
9+
```bash
810
vishrut@visshamac openapi-diff $ oad compare --help
911
Commands:
1012
compare <old-spec> <new-spec> Compares old and new open api specification for
@@ -21,33 +23,41 @@ Options:
2123
-j, --inJson A boolean flag indicating whether output format of the
2224
messages is json. [boolean] [default: true]
2325
-h, --help Show help [boolean]
24-
2526
```
2627

2728
## Build dependencies
28-
- [Node](https://nodejs.org) (7.10.0 or higher)
29-
- [Node Package Manager](https://www.npmjs.com/package/npm)
30-
- [.NET CLI tools](https://github.com/dotnet/cli/releases) version 2.0.0 or higher
31-
> You want the **.NET Core SDK Binaries** for your platform <br>
32-
>
33-
> `dotnet --version ` <br>
34-
> ` 2.0.2 ` <br>
29+
30+
* [Node](https://nodejs.org) (7.10.0 or higher)
31+
* [Node Package Manager](https://www.npmjs.com/package/npm)
32+
* [.NET CLI tools](https://github.com/dotnet/cli/releases) version 2.0.0 or higher
33+
> You want the **.NET Core SDK Binaries** for your platform <br>
34+
>
35+
> `dotnet --version` <br>
36+
> `2.0.2` <br>
3537
3638
## Build scripts
39+
3740
### How to build
38-
The first step would be to run ```npm install``` so we have all the required modules installed.
41+
42+
The first step would be to run `npm install` so we have all the required modules installed.
43+
3944
#### How to build the whole repo
40-
```
41-
gulp
45+
46+
```javascript
47+
gulp;
4248
```
4349

4450
### How to test
51+
4552
To run all tests under the repo
46-
```
53+
54+
```javascript
4755
gulp test
4856
```
57+
4958
### How to bundle node package & install
50-
```
59+
60+
```javascript
5161
gulp pack
5262
npm install -g oad-0.1.0.tgz
5363
```

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

+15-15
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public Operation()
2323
public IList<string> Tags { get; set; }
2424

2525
/// <summary>
26-
/// A friendly serviceTypeName for the operation. The id MUST be unique among all
27-
/// operations described in the API. Tools and libraries MAY use the
26+
/// A friendly serviceTypeName for the operation. The id MUST be unique among all
27+
/// operations described in the API. Tools and libraries MAY use the
2828
/// operation id to uniquely identify an operation.
2929
/// </summary>
3030
public string OperationId { get; set; }
@@ -43,34 +43,34 @@ public Operation()
4343
public IList<string> Consumes { get; set; }
4444

4545
/// <summary>
46-
/// A list of MIME types the operation can produce.
46+
/// A list of MIME types the operation can produce.
4747
/// </summary>
4848
public IList<string> Produces { get; set; }
4949

5050
/// <summary>
51-
/// A list of parameters that are applicable for this operation.
52-
/// If a parameter is already defined at the Path Item, the
51+
/// A list of parameters that are applicable for this operation.
52+
/// If a parameter is already defined at the Path Item, the
5353
/// new definition will override it, but can never remove it.
5454
/// </summary>
55-
public IList<SwaggerParameter> Parameters { get; set; }
55+
public IList<SwaggerParameter> Parameters { get; set; } = new List<SwaggerParameter>();
5656

5757
/// <summary>
5858
/// The list of possible responses as they are returned from executing this operation.
5959
/// </summary>
6060
public Dictionary<string, OperationResponse> Responses { get; set; }
6161

6262
/// <summary>
63-
/// The transfer protocol for the operation.
63+
/// The transfer protocol for the operation.
6464
/// </summary>
6565
public IList<TransferProtocolScheme> Schemes { get; set; }
6666

6767
public bool Deprecated { get; set; }
6868

6969
/// <summary>
70-
/// A declaration of which security schemes are applied for this operation.
71-
/// The list of values describes alternative security schemes that can be used
72-
/// (that is, there is a logical OR between the security requirements).
73-
/// This definition overrides any declared top-level security. To remove a
70+
/// A declaration of which security schemes are applied for this operation.
71+
/// The list of values describes alternative security schemes that can be used
72+
/// (that is, there is a logical OR between the security requirements).
73+
/// This definition overrides any declared top-level security. To remove a
7474
/// top-level security declaration, an empty array can be used.
7575
/// </summary>
7676
public IList<Dictionary<string, List<string>>> Security { get; set; }
@@ -150,8 +150,8 @@ private void CheckParameters(ComparisonContext context, Operation priorOperation
150150
var currentRoot = (context.CurrentRoot as ServiceDefinition);
151151
var previousRoot = (context.PreviousRoot as ServiceDefinition);
152152

153-
var priorOperationParameters = priorOperation.Parameters.Select(param =>
154-
string.IsNullOrWhiteSpace(param.Reference) ?
153+
var priorOperationParameters = priorOperation.Parameters.Select(param =>
154+
string.IsNullOrWhiteSpace(param.Reference) ?
155155
param : FindReferencedParameter(param.Reference, previousRoot.Parameters));
156156
foreach (var oldParam in priorOperationParameters)
157157
{
@@ -173,8 +173,8 @@ private void CheckParameters(ComparisonContext context, Operation priorOperation
173173
}
174174

175175
// Check that no required parameters were added.
176-
var requiredParamters = Parameters.Select(param =>
177-
string.IsNullOrWhiteSpace(param.Reference) ?
176+
var requiredParamters = Parameters.Select(param =>
177+
string.IsNullOrWhiteSpace(param.Reference) ?
178178
param : FindReferencedParameter(param.Reference, currentRoot.Parameters))
179179
.Where(p => p != null && p.IsRequired);
180180
foreach (var newParam in requiredParamters)

0 commit comments

Comments
 (0)