svix_webhook_with_clone/models/validation_error.rs
1/*
2 * Svix API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.1.1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[allow(unused_imports)]
12use crate::models;
13#[allow(unused_imports)]
14use serde::{Deserialize, Serialize};
15
16 /// ValidationError : Validation errors have their own schema to provide context for invalid requests eg. mismatched types and out of bounds values. There may be any number of these per 422 UNPROCESSABLE ENTITY error.
17 #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
18 pub struct ValidationError {
19 /// The location as a [`Vec`] of [`String`]s -- often in the form `[\"body\", \"field_name\"]`, `[\"query\", \"field_name\"]`, etc. They may, however, be arbitrarily deep.
20 #[serde(rename = "loc")]
21 pub loc: Vec<String>,
22 /// The message accompanying the validation error item.
23 #[serde(rename = "msg")]
24 pub msg: String,
25 /// The type of error, often \"type_error\" or \"value_error\", but sometimes with more context like as \"value_error.number.not_ge\"
26 #[serde(rename = "type")]
27 pub r#type: String,
28 }
29
30 impl ValidationError {
31 /// Validation errors have their own schema to provide context for invalid requests eg. mismatched types and out of bounds values. There may be any number of these per 422 UNPROCESSABLE ENTITY error.
32 pub fn new(loc: Vec<String>, msg: String, r#type: String) -> ValidationError {
33 ValidationError {
34 loc,
35 msg,
36 r#type,
37 }
38 }
39 }
40