Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redundant CheckArguments #1422

Merged
merged 2 commits into from
Oct 24, 2023
Merged
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
31 changes: 8 additions & 23 deletions src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void WriteProperty(this IOpenApiWriter writer, string name, string
return;
}

CheckArguments(writer, name);
Utils.CheckArgumentNullOrEmpty(name);
writer.WritePropertyName(name);
writer.WriteValue(value);
}
Expand All @@ -40,7 +40,7 @@ public static void WriteProperty(this IOpenApiWriter writer, string name, string
/// <param name="value">The property value.</param>
public static void WriteRequiredProperty(this IOpenApiWriter writer, string name, string value)
{
CheckArguments(writer, name);
Utils.CheckArgumentNullOrEmpty(name);
writer.WritePropertyName(name);
if (value == null)
{
Expand All @@ -66,7 +66,7 @@ public static void WriteProperty(this IOpenApiWriter writer, string name, bool v
return;
}

CheckArguments(writer, name);
Utils.CheckArgumentNullOrEmpty(name);
writer.WritePropertyName(name);
writer.WriteValue(value);
}
Expand All @@ -89,7 +89,7 @@ public static void WriteProperty(
return;
}

CheckArguments(writer, name);
Utils.CheckArgumentNullOrEmpty(name);
writer.WritePropertyName(name);
writer.WriteValue(value.Value);
}
Expand Down Expand Up @@ -120,7 +120,7 @@ public static void WriteProperty<T>(this IOpenApiWriter writer, string name, T?
public static void WriteProperty<T>(this IOpenApiWriter writer, string name, T value)
where T : struct
{
CheckArguments(writer, name);
Utils.CheckArgumentNullOrEmpty(name);
writer.WritePropertyName(name);
writer.WriteValue(value);
}
Expand Down Expand Up @@ -166,7 +166,7 @@ public static void WriteRequiredObject<T>(
Action<IOpenApiWriter, T> action)
where T : IOpenApiElement
{
CheckArguments(writer, name, action);
Utils.CheckArgumentNull(action);

writer.WritePropertyName(name);
if (value != null)
Expand Down Expand Up @@ -339,7 +339,7 @@ private static void WriteCollectionInternal<T>(
IEnumerable<T> elements,
Action<IOpenApiWriter, T> action)
{
CheckArguments(writer, name, action);
Utils.CheckArgumentNull(action);

writer.WritePropertyName(name);
writer.WriteStartArray();
Expand Down Expand Up @@ -376,7 +376,7 @@ private static void WriteMapInternal<T>(
IDictionary<string, T> elements,
Action<IOpenApiWriter, string, T> action)
{
CheckArguments(writer, name, action);
Utils.CheckArgumentNull(action);

writer.WritePropertyName(name);
writer.WriteStartObject();
Expand All @@ -399,20 +399,5 @@ private static void WriteMapInternal<T>(

writer.WriteEndObject();
}

private static void CheckArguments<T>(IOpenApiWriter writer, string name, Action<IOpenApiWriter, T> action)
{
Utils.CheckArgumentNull(action);
}

private static void CheckArguments<T>(IOpenApiWriter writer, string name, Action<IOpenApiWriter, string, T> action)
{
Utils.CheckArgumentNull(action);
}

private static void CheckArguments(IOpenApiWriter writer, string name)
{
Utils.CheckArgumentNullOrEmpty(name);
}
}
}