Update to syn 2 and serde_derive_internals 0.29

This commit is contained in:
Graham Esau 2024-04-28 18:44:43 +01:00
parent e04e3a3a81
commit 9501fe319f
15 changed files with 206 additions and 235 deletions

View file

@ -20,6 +20,7 @@ enum OrDef<A, B> {
struct Str<'a>(&'a str);
#[allow(dead_code)]
#[derive(JsonSchema, Serialize)]
#[serde(remote = "Str")]
struct StrDef<'a>(&'a str);

View file

@ -23,6 +23,7 @@ fn struct_normal() -> TestResult {
test_default_generated_schema::<Struct>("schema_with-struct")
}
#[allow(dead_code)]
#[derive(JsonSchema)]
pub struct Tuple(
#[schemars(schema_with = "schema_fn")] DoesntImplementJsonSchema,

View file

@ -21,6 +21,7 @@ fn skip_struct_fields() -> TestResult {
test_default_generated_schema::<MyStruct>("skip_struct_fields")
}
#[allow(dead_code)]
#[derive(JsonSchema)]
struct TupleStruct(
#[schemars(skip)] i32,

View file

@ -18,6 +18,7 @@ fn struct_normal() -> TestResult {
test_default_generated_schema::<Struct>("struct-normal")
}
#[allow(dead_code)]
#[derive(JsonSchema)]
pub struct Tuple(i32, bool, Option<&'static str>);
@ -26,6 +27,7 @@ fn struct_tuple() -> TestResult {
test_default_generated_schema::<Tuple>("struct-tuple")
}
#[allow(dead_code)]
#[derive(JsonSchema)]
pub struct Newtype(i32);

View file

@ -16,10 +16,12 @@ pub struct TransparentStruct {
inner: (),
}
#[allow(dead_code)]
#[derive(JsonSchema)]
#[schemars(transparent)]
pub struct TransparentNewType(Option<InnerStruct>);
#[allow(dead_code)]
#[derive(JsonSchema)]
pub struct InnerStruct(String, i32);

View file

@ -104,6 +104,7 @@ fn validate_schemars_attrs() -> TestResult {
test_default_generated_schema::<Struct2>("validate_schemars_attrs")
}
#[allow(dead_code)]
#[derive(JsonSchema)]
pub struct Tuple(
#[validate(range(max = 10))] u8,
@ -115,6 +116,7 @@ fn validate_tuple() -> TestResult {
test_default_generated_schema::<Tuple>("validate_tuple")
}
#[allow(dead_code)]
#[derive(JsonSchema)]
pub struct NewType(#[validate(range(max = 10))] u8);

View file

@ -12,7 +12,7 @@ pub struct Struct<'a> {
#[schemars(inner(length(min = 5, max = 100)))]
array_str_length: [&'a str; 2],
#[schemars(inner(contains(pattern = "substring...")))]
slice_str_contains: &'a[&'a str],
slice_str_contains: &'a [&'a str],
#[schemars(inner(regex = "STARTS_WITH_HELLO"))]
vec_str_regex: Vec<String>,
#[schemars(inner(length(min = 1, max = 100)))]