/// <summary>Validates the specified API request context resolver.</summary> /// <param name="apiRequestContextResolver">The API request context resolver.</param> /// <returns></returns> public Task <IList <ApiValidationResult> > Validate(IApiRequestContextResolver apiRequestContextResolver) { var context = apiRequestContextResolver?.GetContext(); var suggestedStatusCode = context.Configuration.ValidationErrorConfiguration.UriBindingErrorStatusCode; return(Task.FromResult(ApiValidationResult.Single("VALIDATOR-3", suggestedHttpStatusCode: suggestedStatusCode))); }
/// <summary>Validates the specified API request context resolver.</summary> /// <param name="contextResolver">The API request context resolver.</param> /// <returns></returns> public Task <IList <ApiValidationResult> > Validate(IApiRequestContextResolver contextResolver) { var context = contextResolver.GetContext(); var body = context.Request.InvocationContext.Models <DataAnnotationsBodyModel>().FirstOrDefault(); var uri = context.Request.InvocationContext.Models <DataAnnotationsUriModel>().FirstOrDefault(); if (body.Value != uri.Value) { return(Task.FromResult(ApiValidationResult.Single("Body value and Uri value must be the same"))); } return(Task.FromResult(ApiValidationResult.Success())); }
/// <summary>Validates the specified API request context resolver.</summary> /// <param name="contextResolver">The API request context resolver.</param> /// <returns></returns> public Task <IList <ApiValidationResult> > Validate(IApiRequestContextResolver contextResolver) { return(Task.FromResult(ApiValidationResult.Single("VALIDATOR-5", suggestedHttpStatusCode: 404))); }
public Task <IList <ApiValidationResult> > Validate(IApiRequestContextResolver contextResolver) { return(Task.FromResult(ApiValidationResult.Single("VALIDATOR-1"))); }