Beispiel #1
0
        /// <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()));
        }
Beispiel #2
0
 /// <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.Success()));
 }