Skip to content

Commit

Permalink
Merge pull request #959 from RicoSuter/master
Browse files Browse the repository at this point in the history
Release v9.13.36
  • Loading branch information
RicoSuter authored Apr 26, 2019
2 parents 924f3b6 + b62a333 commit da99fed
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard1.3;netstandard2.0;net451</TargetFrameworks>
<Description>JSON Schema reader, generator and validator for .NET</Description>
<Version>9.13.35</Version>
<Version>9.13.36</Version>
<PackageTags>json schema validation generator .net</PackageTags>
<Copyright>Copyright © Rico Suter, 2018</Copyright>
<PackageLicenseUrl>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</PackageLicenseUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard1.3;netstandard2.0;net451</TargetFrameworks>
<Description>JSON Schema reader, generator and validator for .NET</Description>
<Version>9.13.35</Version>
<Version>9.13.36</Version>
<PackageTags>json schema validation generator .net</PackageTags>
<Copyright>Copyright © Rico Suter, 2018</Copyright>
<PackageLicenseUrl>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</PackageLicenseUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard1.3;netstandard2.0;net451</TargetFrameworks>
<Description>JSON Schema reader, generator and validator for .NET</Description>
<Version>9.13.35</Version>
<Version>9.13.36</Version>
<PackageTags>json schema validation generator .net</PackageTags>
<Copyright>Copyright © Rico Suter, 2018</Copyright>
<PackageLicenseUrl>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</PackageLicenseUrl>
Expand Down
2 changes: 1 addition & 1 deletion src/NJsonSchema.Yaml/NJsonSchema.Yaml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard1.3;netstandard2.0;net45</TargetFrameworks>
<Description>JSON Schema reader, generator and validator for .NET</Description>
<Version>9.13.35</Version>
<Version>9.13.36</Version>
<PackageTags>json schema validation generator .net</PackageTags>
<Copyright>Copyright © Rico Suter, 2018</Copyright>
<PackageLicenseUrl>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</PackageLicenseUrl>
Expand Down
2 changes: 1 addition & 1 deletion src/NJsonSchema/Annotations/JsonSchemaAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace NJsonSchema.Annotations
{
/// <summary>Annotation to specify the JSON Schema type for the given class.</summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Struct)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Struct | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
public class JsonSchemaAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="JsonSchemaAttribute"/> class.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace NJsonSchema.Annotations
{
/// <summary>Adds an extension data property to a class or property.</summary>
/// <seealso cref="System.Attribute" />
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = true)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true)]
public class JsonSchemaExtensionDataAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="JsonSchemaExtensionDataAttribute"/> class.</summary>
Expand Down
2 changes: 1 addition & 1 deletion src/NJsonSchema/Annotations/JsonSchemaTypeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace NJsonSchema.Annotations
{
/// <summary>Specifies the type to use for JSON Schema generation.</summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Class, AllowMultiple = false)]
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.Property | AttributeTargets.Class, AllowMultiple = false)]
public class JsonSchemaTypeAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="JsonSchemaTypeAttribute"/> class.</summary>
Expand Down
26 changes: 13 additions & 13 deletions src/NJsonSchema/Infrastructure/DynamicApis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public static async Task<string> HttpGetAsync(string url)

using (dynamic client = (IDisposable)Activator.CreateInstance(HttpClientType))
{
var response = await client.GetAsync(url);
var response = await client.GetAsync(url).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
return await response.Content.ReadAsStringAsync();
return await response.Content.ReadAsStringAsync().ConfigureAwait(false);
}
}

Expand Down Expand Up @@ -112,45 +112,45 @@ public static Task DirectoryCreateDirectoryAsync(string directory)
/// <param name="filePath">The file path.</param>
/// <returns>true or false</returns>
/// <exception cref="NotSupportedException">The System.IO.Directory API is not available on this platform.</exception>
public static async Task<bool> DirectoryExistsAsync(string filePath)
public static Task<bool> DirectoryExistsAsync(string filePath)
{
if (!SupportsDirectoryApis)
throw new NotSupportedException("The System.IO.Directory API is not available on this platform.");

if (string.IsNullOrEmpty(filePath))
return false;
return FromResult(false);

return await FromResult((bool)DirectoryType.GetRuntimeMethod("Exists",
new[] { typeof(string) }).Invoke(null, new object[] { filePath })).ConfigureAwait(false);
return FromResult((bool)DirectoryType.GetRuntimeMethod("Exists",
new[] { typeof(string) }).Invoke(null, new object[] { filePath }));
}

/// <summary>Checks whether a file exists.</summary>
/// <param name="filePath">The file path.</param>
/// <returns>true or false</returns>
/// <exception cref="NotSupportedException">The System.IO.File API is not available on this platform.</exception>
public static async Task<bool> FileExistsAsync(string filePath)
public static Task<bool> FileExistsAsync(string filePath)
{
if (!SupportsFileApis)
throw new NotSupportedException("The System.IO.File API is not available on this platform.");

if (string.IsNullOrEmpty(filePath))
return false;
return FromResult(false);

return await FromResult((bool)FileType.GetRuntimeMethod("Exists",
new[] { typeof(string) }).Invoke(null, new object[] { filePath })).ConfigureAwait(false);
return FromResult((bool)FileType.GetRuntimeMethod("Exists",
new[] { typeof(string) }).Invoke(null, new object[] { filePath }));
}

/// <summary>Reads all content of a file (UTF8).</summary>
/// <param name="filePath">The file path.</param>
/// <returns>The file content.</returns>
/// <exception cref="NotSupportedException">The System.IO.File API is not available on this platform.</exception>
public static Task<string> FileReadAllTextAsync(string filePath)
public static async Task<string> FileReadAllTextAsync(string filePath)
{
if (!SupportsFileApis)
throw new NotSupportedException("The System.IO.File API is not available on this platform.");

return Task.Factory.StartNew(() => (string)FileType.GetRuntimeMethod("ReadAllText",
new[] { typeof(string), typeof(Encoding) }).Invoke(null, new object[] { filePath, Encoding.UTF8 }));
return await Task.Factory.StartNew(() => (string)FileType.GetRuntimeMethod("ReadAllText",
new[] { typeof(string), typeof(Encoding) }).Invoke(null, new object[] { filePath, Encoding.UTF8 })).ConfigureAwait(false);
}

/// <summary>Writes text to a file (UTF8).</summary>
Expand Down
2 changes: 1 addition & 1 deletion src/NJsonSchema/JsonSchema4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public static async Task<JsonSchema4> FromFileAsync(string filePath)
/// <exception cref="NotSupportedException">The System.IO.File API is not available on this platform.</exception>
public static async Task<JsonSchema4> FromFileAsync(string filePath, Func<JsonSchema4, JsonReferenceResolver> referenceResolverFactory)
{
var data = await DynamicApis.FileReadAllTextAsync(filePath);
var data = await DynamicApis.FileReadAllTextAsync(filePath).ConfigureAwait(false);
return await FromJsonAsync(data, filePath, referenceResolverFactory).ConfigureAwait(false);
}

Expand Down
2 changes: 1 addition & 1 deletion src/NJsonSchema/NJsonSchema.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard1.0;netstandard2.0;net40;net45</TargetFrameworks>
<Description>JSON Schema reader, generator and validator for .NET</Description>
<Version>9.13.35</Version>
<Version>9.13.36</Version>
<PackageTags>json schema validation generator .net</PackageTags>
<Copyright>Copyright © Rico Suter, 2018</Copyright>
<PackageLicenseUrl>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</PackageLicenseUrl>
Expand Down

0 comments on commit da99fed

Please sign in to comment.