| 1 | use craterust-analyzer cargo schemars 1.2.2 crate/::preluderust-analyzer cargo schemars 1.2.2 prelude/::*; |
| 2 | use pretty_assertionsrust-analyzer cargo pretty_assertions 1.4.1 crate/::assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!; |
| 3 | |
| 4 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 5 | struct SimpleStructrust-analyzer cargo schemars 1.2.2 schema_name/SimpleStruct# { |
| 6 | foorust-analyzer cargo schemars 1.2.2 schema_name/SimpleStruct#foo.: i32, |
| 7 | } |
| 8 | |
| 9 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 10 | #[schemars(rename = "new-name")] |
| 11 | struct RenamedSimpleStructrust-analyzer cargo schemars 1.2.2 schema_name/RenamedSimpleStruct# { |
| 12 | foorust-analyzer cargo schemars 1.2.2 schema_name/RenamedSimpleStruct#foo.: i32, |
| 13 | } |
| 14 | |
| 15 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 16 | fn simplerust-analyzer cargo schemars 1.2.2 schema_name/simple().() { |
| 17 | testrust-analyzer cargo schemars 1.2.2 test!!(SimpleStructrust-analyzer cargo schemars 1.2.2 schema_name/SimpleStruct#) |
| 18 | .customrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]custom().(|schema, _| assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("title"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&"SimpleStruct".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))); |
| 19 | |
| 20 | testrust-analyzer cargo schemars 1.2.2 test!!(RenamedSimpleStructrust-analyzer cargo schemars 1.2.2 schema_name/RenamedSimpleStruct#) |
| 21 | .customrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]custom().(|schema, _| assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("title"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&"new-name".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))); |
| 22 | } |
| 23 | |
| 24 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 25 | struct TypeParamsrust-analyzer cargo schemars 1.2.2 schema_name/TypeParams#<T, U, V, W> { |
| 26 | trust-analyzer cargo schemars 1.2.2 schema_name/TypeParams#t.: T, |
| 27 | urust-analyzer cargo schemars 1.2.2 schema_name/TypeParams#u.: U, |
| 28 | vrust-analyzer cargo schemars 1.2.2 schema_name/TypeParams#v.: V, |
| 29 | wrust-analyzer cargo schemars 1.2.2 schema_name/TypeParams#w.: W, |
| 30 | } |
| 31 | |
| 32 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 33 | #[schemars(rename = "new name~{W}/{T}/{T}!")] |
| 34 | struct RenamedTypeParamsrust-analyzer cargo schemars 1.2.2 schema_name/RenamedTypeParams#<T, U, V, W> { |
| 35 | trust-analyzer cargo schemars 1.2.2 schema_name/RenamedTypeParams#t.: T, |
| 36 | urust-analyzer cargo schemars 1.2.2 schema_name/RenamedTypeParams#u.: U, |
| 37 | vrust-analyzer cargo schemars 1.2.2 schema_name/RenamedTypeParams#v.: V, |
| 38 | wrust-analyzer cargo schemars 1.2.2 schema_name/RenamedTypeParams#w.: W, |
| 39 | } |
| 40 | |
| 41 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 42 | fn type_paramsrust-analyzer cargo schemars 1.2.2 schema_name/type_params().() { |
| 43 | testrust-analyzer cargo schemars 1.2.2 test!!(TypeParamsrust-analyzer cargo schemars 1.2.2 schema_name/TypeParams#<u8, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, bool, ()>) |
| 44 | .assert_allows_ser_roundtrip_defaultrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip_default().() |
| 45 | .assert_identicalrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_identical().::<TypeParamsrust-analyzer cargo schemars 1.2.2 schema_name/TypeParams#<u8, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<str>, bool, ()>>(); |
| 46 | |
| 47 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!( |
| 48 | <TypeParamsrust-analyzer cargo schemars 1.2.2 schema_name/TypeParams#<u8, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, bool, ()>>::schema_idrust-analyzer cargo schemars 1.2.2 schema_name/impl#[`TypeParams<T, U, V, W>`][JsonSchema]schema_id().(), |
| 49 | <TypeParamsrust-analyzer cargo schemars 1.2.2 schema_name/TypeParams#<(), u8, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, bool>>::schema_idrust-analyzer cargo schemars 1.2.2 schema_name/impl#[`TypeParams<T, U, V, W>`][JsonSchema]schema_id().() |
| 50 | ); |
| 51 | |
| 52 | testrust-analyzer cargo schemars 1.2.2 test!!(RenamedTypeParamsrust-analyzer cargo schemars 1.2.2 schema_name/RenamedTypeParams#<u8, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, bool, ()>) |
| 53 | .assert_allows_ser_roundtrip_defaultrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip_default().() |
| 54 | .assert_identicalrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_identical().::<RenamedTypeParamsrust-analyzer cargo schemars 1.2.2 schema_name/RenamedTypeParams#<u8, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<str>, bool, ()>>() |
| 55 | .customrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]custom().(|schema, _| { |
| 56 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!( |
| 57 | schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("title"), |
| 58 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&"new name~null/uint8/uint8!".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 59 | ) |
| 60 | }); |
| 61 | |
| 62 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!( |
| 63 | <RenamedTypeParamsrust-analyzer cargo schemars 1.2.2 schema_name/RenamedTypeParams#<u8, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, bool, ()>>::schema_idrust-analyzer cargo schemars 1.2.2 schema_name/impl#[`RenamedTypeParams<T, U, V, W>`][JsonSchema]schema_id().(), |
| 64 | <RenamedTypeParamsrust-analyzer cargo schemars 1.2.2 schema_name/RenamedTypeParams#<(), u8, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, bool>>::schema_idrust-analyzer cargo schemars 1.2.2 schema_name/impl#[`RenamedTypeParams<T, U, V, W>`][JsonSchema]schema_id().() |
| 65 | ); |
| 66 | |
| 67 | testrust-analyzer cargo schemars 1.2.2 test!!(( |
| 68 | TypeParamsrust-analyzer cargo schemars 1.2.2 schema_name/TypeParams#<u8, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, bool, ()>, |
| 69 | RenamedTypeParamsrust-analyzer cargo schemars 1.2.2 schema_name/RenamedTypeParams#<u8, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, bool, ()> |
| 70 | )) |
| 71 | .assert_allows_ser_roundtrip_defaultrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip_default().() |
| 72 | .customrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]custom().(|schema, _| { |
| 73 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!( |
| 74 | schema.pointerrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]pointer().("/prefixItems/1/$ref"), |
| 75 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&("#/$defs/new%20name~0null~1uint8~1uint8!".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())), |
| 76 | "name should be correctly encoded for $ref value" |
| 77 | ) |
| 78 | }); |
| 79 | } |
| 80 | |
| 81 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 82 | struct ConstGenericrust-analyzer cargo schemars 1.2.2 schema_name/ConstGeneric#<const INT: usize, const CHAR: char> { |
| 83 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(range(max = INT))] |
| 84 | foorust-analyzer cargo schemars 1.2.2 schema_name/ConstGeneric#foo.: i32, |
| 85 | } |
| 86 | |
| 87 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 88 | #[schemars(rename = "{{new-name-{INT}}}")] |
| 89 | struct RenamedConstGenericrust-analyzer cargo schemars 1.2.2 schema_name/RenamedConstGeneric#<const INT: usize, const CHAR: char> { |
| 90 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(range(max = INT))] |
| 91 | foorust-analyzer cargo schemars 1.2.2 schema_name/RenamedConstGeneric#foo.: i32, |
| 92 | } |
| 93 | |
| 94 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 95 | fn const_genericsrust-analyzer cargo schemars 1.2.2 schema_name/const_generics().() { |
| 96 | testrust-analyzer cargo schemars 1.2.2 test!!(ConstGenericrust-analyzer cargo schemars 1.2.2 schema_name/ConstGeneric#<123, 'X'>).assert_allows_ser_roundtrip_defaultrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip_default().(); |
| 97 | |
| 98 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!( |
| 99 | <ConstGenericrust-analyzer cargo schemars 1.2.2 schema_name/ConstGeneric#<123, 'X'>>::schema_idrust-analyzer cargo schemars 1.2.2 schema_name/impl#[`ConstGeneric<INT, CHAR>`][JsonSchema]schema_id().(), |
| 100 | <ConstGenericrust-analyzer cargo schemars 1.2.2 schema_name/ConstGeneric#<321, 'Y'>>::schema_idrust-analyzer cargo schemars 1.2.2 schema_name/impl#[`ConstGeneric<INT, CHAR>`][JsonSchema]schema_id().() |
| 101 | ); |
| 102 | |
| 103 | testrust-analyzer cargo schemars 1.2.2 test!!(RenamedConstGenericrust-analyzer cargo schemars 1.2.2 schema_name/RenamedConstGeneric#<123, 'X'>) |
| 104 | .assert_allows_ser_roundtrip_defaultrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip_default().() |
| 105 | .customrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]custom().(|schema, _| assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("title"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&"{new-name-123}".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))); |
| 106 | |
| 107 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!( |
| 108 | <RenamedConstGenericrust-analyzer cargo schemars 1.2.2 schema_name/RenamedConstGeneric#<123, 'X'>>::schema_idrust-analyzer cargo schemars 1.2.2 schema_name/impl#[`RenamedConstGeneric<INT, CHAR>`][JsonSchema]schema_id().(), |
| 109 | <RenamedConstGenericrust-analyzer cargo schemars 1.2.2 schema_name/RenamedConstGeneric#<321, 'Y'>>::schema_idrust-analyzer cargo schemars 1.2.2 schema_name/impl#[`RenamedConstGeneric<INT, CHAR>`][JsonSchema]schema_id().() |
| 110 | ); |
| 111 | } |