/// <summary>
 /// Initialises a new instance of the <see cref="HttpSchemaValidationErrorBodyResult" /> class.
 /// </summary>
 /// <param name="httpStatusCode">
 /// The status code. Inherited from the Azure API management error
 /// model.
 /// </param>
 /// <param name="errorIdentifier">
 /// An error identifier. The format of this identifier is dependent on
 /// the local system.
 /// </param>
 /// <param name="validationException">Schema validation exception</param>
 public HttpSchemaValidationErrorBodyResult(
     HttpStatusCode httpStatusCode,
     string errorIdentifier,
     JsonSchemaValidationException validationException)
     : base(BuildErrorBody(httpStatusCode, errorIdentifier, validationException))
 {
 }
 private static HttpDetailedErrorBody BuildErrorBody(
     HttpStatusCode httpStatusCode,
     string errorIdentifier,
     JsonSchemaValidationException validationException)
 {
     return(new HttpDetailedErrorBody
     {
         StatusCode = httpStatusCode,
         ErrorIdentifier = errorIdentifier,
         Message = "The supplied body was well-formed JSON but it failed validation",
         Details = validationException.ValidationErrors.SelectMany(GetValidationErrorDetailsString).ToArray(),
     });
 }
 /// <summary>
 /// Initialises a new instance of the <see cref="HttpSchemaValidationErrorBodyResult" /> class.
 /// </summary>
 /// <param name="errorIdentifier">
 /// An error identifier. The format of this identifier is dependent on
 /// the local system.
 /// </param>
 /// <param name="validationException">Schema validation exception</param>
 public HttpSchemaValidationErrorBodyResult(
     string errorIdentifier,
     JsonSchemaValidationException validationException)
     : this(HttpStatusCode.BadRequest, errorIdentifier, validationException)
 {
 }
Beispiel #4
0
 /// <summary>
 /// Gets an instance of <see cref="HttpErrorBodyResult" /> to return
 /// when the user provides a well-formed request, but it does not pass
 /// the schema validation.
 /// </summary>
 /// <param name="validationException">
 /// Details on why the schema validation failed.
 /// </param>
 /// <param name="runContext">
 /// An instance of <see cref="FunctionRunContext" />.
 /// </param>
 /// <returns>
 /// An instance of <see cref="HttpErrorBodyResult" />.
 /// </returns>
 protected abstract HttpErrorBodyResult GetSchemaValidationResponse(
     JsonSchemaValidationException validationException,
     FunctionRunContext runContext);