Skip to content

Commit

Permalink
Simplify null checks and remove unnecessary usings
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieKimani1 committed Oct 23, 2024
1 parent 264226b commit 125bda9
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ private OpenApiCallback Target
/// </param>
public OpenApiCallbackReference(string referenceId, OpenApiDocument hostDocument, string externalResource = null)
{
if (string.IsNullOrEmpty(referenceId))
{
Utils.CheckArgumentNullOrEmpty(referenceId);
}
Utils.CheckArgumentNullOrEmpty(referenceId);

_reference = new OpenApiReference()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Nodes;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;

Expand Down Expand Up @@ -44,10 +43,7 @@ private OpenApiExample Target
/// </param>
public OpenApiExampleReference(string referenceId, OpenApiDocument hostDocument, string externalResource = null)
{
if (string.IsNullOrEmpty(referenceId))
{
Utils.CheckArgumentNullOrEmpty(referenceId);
}
Utils.CheckArgumentNullOrEmpty(referenceId);

_reference = new OpenApiReference()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Nodes;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;

Expand Down Expand Up @@ -41,11 +40,8 @@ private OpenApiHeader Target
/// 2. a Url, for example: http://localhost/pet.json
/// </param>
public OpenApiHeaderReference(string referenceId, OpenApiDocument hostDocument, string externalResource = null)
{
if (string.IsNullOrEmpty(referenceId))
{
Utils.CheckArgumentNullOrEmpty(referenceId);
}
{
Utils.CheckArgumentNullOrEmpty(referenceId);

_reference = new OpenApiReference()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ private OpenApiLink Target
/// </param>
public OpenApiLinkReference(string referenceId, OpenApiDocument hostDocument, string externalResource = null)
{
if (string.IsNullOrEmpty(referenceId))
{
Utils.CheckArgumentNullOrEmpty(referenceId);
}
Utils.CheckArgumentNullOrEmpty(referenceId);

_reference = new OpenApiReference()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Nodes;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;

Expand Down Expand Up @@ -44,10 +43,7 @@ private OpenApiParameter Target
/// </param>
public OpenApiParameterReference(string referenceId, OpenApiDocument hostDocument, string externalResource = null)
{
if (string.IsNullOrEmpty(referenceId))
{
Utils.CheckArgumentNullOrEmpty(referenceId);
}
Utils.CheckArgumentNullOrEmpty(referenceId);

_reference = new OpenApiReference()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ private OpenApiPathItem Target
/// </param>
public OpenApiPathItemReference(string referenceId, OpenApiDocument hostDocument, string externalResource = null)
{
if (string.IsNullOrEmpty(referenceId))
{
Utils.CheckArgumentNullOrEmpty(referenceId);
}
Utils.CheckArgumentNullOrEmpty(referenceId);

_reference = new OpenApiReference()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ private OpenApiRequestBody Target
/// </param>
public OpenApiRequestBodyReference(string referenceId, OpenApiDocument hostDocument, string externalResource = null)
{
if (string.IsNullOrEmpty(referenceId))
{
Utils.CheckArgumentNullOrEmpty(referenceId);
}
Utils.CheckArgumentNullOrEmpty(referenceId);

_reference = new OpenApiReference()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ private OpenApiResponse Target
/// </param>
public OpenApiResponseReference(string referenceId, OpenApiDocument hostDocument, string externalResource = null)
{
if (string.IsNullOrEmpty(referenceId))
{
Utils.CheckArgumentNullOrEmpty(referenceId);
}
Utils.CheckArgumentNullOrEmpty(referenceId);

_reference = new OpenApiReference()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ private OpenApiSchema Target
/// </param>
public OpenApiSchemaReference(string referenceId, OpenApiDocument hostDocument, string externalResource = null)
{
if (string.IsNullOrEmpty(referenceId))
{
Utils.CheckArgumentNullOrEmpty(referenceId);
}
Utils.CheckArgumentNullOrEmpty(referenceId);

_reference = new OpenApiReference()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ private OpenApiSecurityScheme Target
/// <param name="externalResource">The externally referenced file.</param>
public OpenApiSecuritySchemeReference(string referenceId, OpenApiDocument hostDocument, string externalResource = null)
{
if (string.IsNullOrEmpty(referenceId))
{
Utils.CheckArgumentNullOrEmpty(referenceId);
}
Utils.CheckArgumentNullOrEmpty(referenceId);

_reference = new OpenApiReference()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ private OpenApiTag Target
/// <param name="hostDocument">The host OpenAPI document.</param>
public OpenApiTagReference(string referenceId, OpenApiDocument hostDocument)
{
if (string.IsNullOrEmpty(referenceId))
{
Utils.CheckArgumentNullOrEmpty(referenceId);
}
Utils.CheckArgumentNullOrEmpty(referenceId);

_reference = new OpenApiReference()
{
Expand Down

0 comments on commit 125bda9

Please sign in to comment.