-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependencies and fix what broke
- Loading branch information
1 parent
ef77682
commit d5383ed
Showing
43 changed files
with
359 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 6 additions & 9 deletions
15
src/OCPI.Net.Exceptions/Models/ClientApiErrorOcpiException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
namespace OCPI.Exceptions; | ||
|
||
public class ClientApiErrorOcpiException : OcpiExceptionBase | ||
/// <summary> | ||
/// Creates a new <see cref="ClientApiErrorOcpiException"/> | ||
/// </summary> | ||
/// <param name="message">Message to be displayed</param> | ||
/// <param name="innerException">Inner exception</param> | ||
public class ClientApiErrorOcpiException(string message = ClientApiErrorOcpiException.DefaultMessage, Exception? innerException = null) : OcpiExceptionBase(message, OcpiStatusCode.ClientApiError, innerException: innerException) | ||
{ | ||
public const string DefaultMessage = "Unable to use the client’s API."; | ||
|
||
/// <summary> | ||
/// Creates a new <see cref="ClientApiErrorOcpiException"/> | ||
/// </summary> | ||
/// <param name="message">Message to be displayed</param> | ||
/// <param name="innerException">Inner exception</param> | ||
public ClientApiErrorOcpiException(string message = DefaultMessage, Exception? innerException = null) | ||
: base(message, OcpiStatusCode.ClientApiError, innerException: innerException) { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/OCPI.Net.Validation/Extensions/AddOcpiValidationContextExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using OCPI.Validation; | ||
|
||
namespace OCPI; | ||
|
||
public static class AddOcpiValidationContextExtension | ||
{ | ||
public static IServiceCollection AddOcpiValidationContext(this IServiceCollection services) | ||
{ | ||
services.AddHttpContextAccessor(); | ||
services.AddTransient(x => x.GetRequiredService<IHttpContextAccessor>()!.HttpContext!); | ||
|
||
services.AddScoped(x => | ||
{ | ||
var httpContext = x.GetRequiredService<HttpContext>(); | ||
var request = httpContext.Request; | ||
|
||
return new OcpiValidationContext(request); | ||
}); | ||
|
||
return services; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using FluentValidation; | ||
|
||
namespace OCPI.Contracts; | ||
|
||
public interface IOcpiValidator | ||
{ | ||
public OcpiVersion OcpiVersion { get; internal set; } | ||
} | ||
|
||
public interface IOcpiValidator<T> : IOcpiValidator, IActionValidator, IValidator<T> { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.