Skip to content

Commit

Permalink
Merge pull request #114 from vladbarosan/fixNull
Browse files Browse the repository at this point in the history
Fix null parameter
  • Loading branch information
Vlad Barosan authored May 14, 2018
2 parents 01ceef7 + 587040b commit 720b650
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 3,534 deletions.
41 changes: 24 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
## 0.1.10
Released on 2018-03-15.
- Fix crash when there are no required parameters. [#107](https://github.com/Azure/openapi-diff/issues/107)
# Changelog

## 0.1.9
Released on 2017-10-23.
- Fix publishing issue of 0.1.8 where some dlls were missing.
## 0.1.11 Released on 2018-05-14

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

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

## 0.1.x
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)
* Fix crash when there are no required parameters. [#107](https://github.com/Azure/openapi-diff/issues/107)

#### Added
- Initial release of oad.
- Added by [Vishrut Shah](https://github.com/vishrutshah).
## 0.1.9 Released on 2017-10-23

* Fix publishing issue of 0.1.8 where some dlls were missing.

## 0.1.8 Released on 2017-10-20

* Updating to use AutoRest 2. This solves [#105](https://github.com/Azure/openapi-diff/issues/105)

## 0.1.7 Released on 2017-08-10.

* Chaining the promises upto `compare` method and gracefully exiting application [#88](https://github.com/Azure/openapi-diff/issues/88)

## 0.1.x 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)

## Added

* Initial release of oad.
46 changes: 28 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
### How to install
```
npm install -g [email protected]
```
# How to install

### Command Usage
```javascript
npm install -g oad@0.1.11
```

## git Usage

```bash
vishrut@visshamac openapi-diff $ oad compare --help
Commands:
compare <old-spec> <new-spec> Compares old and new open api specification for
Expand All @@ -21,33 +23,41 @@ Options:
-j, --inJson A boolean flag indicating whether output format of the
messages is json. [boolean] [default: true]
-h, --help Show help [boolean]
```

## Build dependencies
- [Node](https://nodejs.org) (7.10.0 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 <br>
>
> `dotnet --version ` <br>
> ` 2.0.2 ` <br>

* [Node](https://nodejs.org) (7.10.0 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 <br>
>
> `dotnet --version` <br>
> `2.0.2` <br>
## Build scripts

### How to build
The first step would be to run ```npm install``` so we have all the required modules installed.

The first step would be to run `npm install` so we have all the required modules installed.

#### How to build the whole repo
```
gulp

```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
```
Expand Down
30 changes: 15 additions & 15 deletions openapi-diff/src/modeler/AutoRest.Swagger/Model/Operation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public Operation()
public IList<string> Tags { get; set; }

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

/// <summary>
/// A list of MIME types the operation can produce.
/// A list of MIME types the operation can produce.
/// </summary>
public IList<string> Produces { get; set; }

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

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

/// <summary>
/// The transfer protocol for the operation.
/// The transfer protocol for the operation.
/// </summary>
public IList<TransferProtocolScheme> Schemes { get; set; }

public bool Deprecated { get; set; }

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

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

// Check that no required parameters were added.
var requiredParamters = Parameters.Select(param =>
string.IsNullOrWhiteSpace(param.Reference) ?
var requiredParamters = Parameters.Select(param =>
string.IsNullOrWhiteSpace(param.Reference) ?
param : FindReferencedParameter(param.Reference, currentRoot.Parameters))
.Where(p => p != null && p.IsRequired);
foreach (var newParam in requiredParamters)
Expand Down
Loading

0 comments on commit 720b650

Please sign in to comment.