| 1 | #![allow(clippy::approx_constant)] |
| 2 | |
| 3 | use craterust-analyzer cargo schemars 1.2.2 crate/::preluderust-analyzer cargo schemars 1.2.2 prelude/::*; |
| 4 | use pretty_assertionsrust-analyzer cargo pretty_assertions 1.4.1 crate/::assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!; |
| 5 | |
| 6 | static THREErust-analyzer cargo schemars 1.2.2 extend/THREE.: f64 = 3.0; |
| 7 | |
| 8 | #[allow(dead_code)] |
| 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:)] |
| 10 | #[schemars(extend("obj" = {"array": [null, ()]}))] |
| 11 | #[schemars(extend("3" = THREErust-analyzer cargo schemars 1.2.2 extend/THREE.), extend("pi" = THREErust-analyzer cargo schemars 1.2.2 extend/THREE. +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Add<Self>`]add(). 0.14))] |
| 12 | struct Structrust-analyzer cargo schemars 1.2.2 extend/Struct# { |
| 13 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 14 | valuerust-analyzer cargo schemars 1.2.2 extend/Struct#value.: Valuerust-analyzer cargo serde_json 1.0.151 value/Value#, |
| 15 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("type" = ["number", "string"]))] |
| 16 | intrust-analyzer cargo schemars 1.2.2 extend/Struct#int.: i32, |
| 17 | } |
| 18 | |
| 19 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 20 | fn extend_structrust-analyzer cargo schemars 1.2.2 extend/extend_struct().() { |
| 21 | testrust-analyzer cargo schemars 1.2.2 test!!(Structrust-analyzer cargo schemars 1.2.2 extend/Struct#).assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().().customrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]custom().(|schema, _| { |
| 22 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("obj"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!({ "array": [null, null] }))); |
| 23 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("3"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!(3.0))); |
| 24 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("pi"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!(3.14))); |
| 25 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!( |
| 26 | schema.as_valuerust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]as_value().().pointerrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]pointer().("/properties/value"), |
| 27 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!({ "foo": "bar" })) |
| 28 | ); |
| 29 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!( |
| 30 | schema.as_valuerust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]as_value().().pointerrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]pointer().("/properties/int/type"), |
| 31 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!(["number", "string"])) |
| 32 | ); |
| 33 | }); |
| 34 | } |
| 35 | |
| 36 | #[allow(dead_code)] |
| 37 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:)] |
| 38 | #[schemars(extend("obj" = {"array": [null, ()]}))] |
| 39 | #[schemars(extend("3" = THREErust-analyzer cargo schemars 1.2.2 extend/THREE.), extend("pi" = THREErust-analyzer cargo schemars 1.2.2 extend/THREE. +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Add<Self>`]add(). 0.14))] |
| 40 | struct TupleStructrust-analyzer cargo schemars 1.2.2 extend/TupleStruct#( |
| 41 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] Valuerust-analyzer cargo serde_json 1.0.151 value/Value#, |
| 42 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("type" = ["number", "string"]))] usize, |
| 43 | ); |
| 44 | |
| 45 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 46 | fn extend_tuple_structrust-analyzer cargo schemars 1.2.2 extend/extend_tuple_struct().() { |
| 47 | testrust-analyzer cargo schemars 1.2.2 test!!(TupleStructrust-analyzer cargo schemars 1.2.2 extend/TupleStruct#).assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().().customrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]custom().(|schema, _| { |
| 48 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("obj"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!({ "array": [null, null] }))); |
| 49 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("3"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!(3.0))); |
| 50 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("pi"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!(3.14))); |
| 51 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!( |
| 52 | schema.as_valuerust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]as_value().().pointerrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]pointer().("/prefixItems/0"), |
| 53 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!({ "foo": "bar" })) |
| 54 | ); |
| 55 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!( |
| 56 | schema.as_valuerust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]as_value().().pointerrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]pointer().("/prefixItems/1/type"), |
| 57 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!(["number", "string"])) |
| 58 | ); |
| 59 | }); |
| 60 | } |
| 61 | |
| 62 | #[allow(dead_code)] |
| 63 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:)] |
| 64 | #[schemars(extend("foo" = "bar"))] |
| 65 | enum ExternalEnumrust-analyzer cargo schemars 1.2.2 extend/ExternalEnum# { |
| 66 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 67 | Unitrust-analyzer cargo schemars 1.2.2 extend/ExternalEnum#Unit#, |
| 68 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 69 | NewTyperust-analyzer cargo schemars 1.2.2 extend/ExternalEnum#NewType#(Valuerust-analyzer cargo serde_json 1.0.151 value/Value#), |
| 70 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 71 | Tuplerust-analyzer cargo schemars 1.2.2 extend/ExternalEnum#Tuple#(i32, bool), |
| 72 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 73 | Structrust-analyzer cargo schemars 1.2.2 extend/ExternalEnum#Struct# { irust-analyzer cargo schemars 1.2.2 extend/ExternalEnum#Struct#i.: i32, brust-analyzer cargo schemars 1.2.2 extend/ExternalEnum#Struct#b.: bool }, |
| 74 | } |
| 75 | |
| 76 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 77 | fn extend_externally_tagged_enumrust-analyzer cargo schemars 1.2.2 extend/extend_externally_tagged_enum().() { |
| 78 | testrust-analyzer cargo schemars 1.2.2 test!!(ExternalEnumrust-analyzer cargo schemars 1.2.2 extend/ExternalEnum#).assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().().customrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]custom().(|schema, _| { |
| 79 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("foo"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!("bar"))); |
| 80 | |
| 81 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4 { |
| 82 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!( |
| 83 | schema.as_valuerust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]as_value().().pointerrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]pointer().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/oneOf/{i}/foo")), |
| 84 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!("bar")) |
| 85 | ); |
| 86 | } |
| 87 | }); |
| 88 | } |
| 89 | |
| 90 | #[allow(dead_code)] |
| 91 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:)] |
| 92 | #[schemars(tag = "t", extend("foo" = "bar"))] |
| 93 | enum InternalEnumrust-analyzer cargo schemars 1.2.2 extend/InternalEnum# { |
| 94 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 95 | Unitrust-analyzer cargo schemars 1.2.2 extend/InternalEnum#Unit#, |
| 96 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 97 | NewTyperust-analyzer cargo schemars 1.2.2 extend/InternalEnum#NewType#(Valuerust-analyzer cargo serde_json 1.0.151 value/Value#), |
| 98 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 99 | Structrust-analyzer cargo schemars 1.2.2 extend/InternalEnum#Struct# { irust-analyzer cargo schemars 1.2.2 extend/InternalEnum#Struct#i.: i32, brust-analyzer cargo schemars 1.2.2 extend/InternalEnum#Struct#b.: bool }, |
| 100 | } |
| 101 | |
| 102 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 103 | fn extend_internally_tagged_enumrust-analyzer cargo schemars 1.2.2 extend/extend_internally_tagged_enum().() { |
| 104 | testrust-analyzer cargo schemars 1.2.2 test!!(InternalEnumrust-analyzer cargo schemars 1.2.2 extend/InternalEnum#).assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().().customrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]custom().(|schema, _| { |
| 105 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("foo"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!("bar"))); |
| 106 | |
| 107 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3 { |
| 108 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!( |
| 109 | schema.as_valuerust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]as_value().().pointerrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]pointer().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/oneOf/{i}/foo")), |
| 110 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!("bar")) |
| 111 | ); |
| 112 | } |
| 113 | }); |
| 114 | } |
| 115 | |
| 116 | #[allow(dead_code)] |
| 117 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:)] |
| 118 | #[schemars(tag = "t", content = "c", extend("foo" = "bar"))] |
| 119 | enum AdjacentEnumrust-analyzer cargo schemars 1.2.2 extend/AdjacentEnum# { |
| 120 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 121 | Unitrust-analyzer cargo schemars 1.2.2 extend/AdjacentEnum#Unit#, |
| 122 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 123 | NewTyperust-analyzer cargo schemars 1.2.2 extend/AdjacentEnum#NewType#(Valuerust-analyzer cargo serde_json 1.0.151 value/Value#), |
| 124 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 125 | Tuplerust-analyzer cargo schemars 1.2.2 extend/AdjacentEnum#Tuple#(i32, bool), |
| 126 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 127 | Structrust-analyzer cargo schemars 1.2.2 extend/AdjacentEnum#Struct# { irust-analyzer cargo schemars 1.2.2 extend/AdjacentEnum#Struct#i.: i32, brust-analyzer cargo schemars 1.2.2 extend/AdjacentEnum#Struct#b.: bool }, |
| 128 | } |
| 129 | |
| 130 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 131 | fn extend_adjacently_tagged_enumrust-analyzer cargo schemars 1.2.2 extend/extend_adjacently_tagged_enum().() { |
| 132 | testrust-analyzer cargo schemars 1.2.2 test!!(AdjacentEnumrust-analyzer cargo schemars 1.2.2 extend/AdjacentEnum#).assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().().customrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]custom().(|schema, _| { |
| 133 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("foo"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!("bar"))); |
| 134 | |
| 135 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4 { |
| 136 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!( |
| 137 | schema.as_valuerust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]as_value().().pointerrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]pointer().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/oneOf/{i}/foo")), |
| 138 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!("bar")) |
| 139 | ); |
| 140 | } |
| 141 | }); |
| 142 | } |
| 143 | |
| 144 | #[allow(dead_code)] |
| 145 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:)] |
| 146 | #[schemars(untagged, extend("foo" = "bar"))] |
| 147 | enum UntaggedEnumrust-analyzer cargo schemars 1.2.2 extend/UntaggedEnum# { |
| 148 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 149 | Unitrust-analyzer cargo schemars 1.2.2 extend/UntaggedEnum#Unit#, |
| 150 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 151 | NewTyperust-analyzer cargo schemars 1.2.2 extend/UntaggedEnum#NewType#(Valuerust-analyzer cargo serde_json 1.0.151 value/Value#), |
| 152 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 153 | Tuplerust-analyzer cargo schemars 1.2.2 extend/UntaggedEnum#Tuple#(i32, bool), |
| 154 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("foo" = "bar"))] |
| 155 | Structrust-analyzer cargo schemars 1.2.2 extend/UntaggedEnum#Struct# { irust-analyzer cargo schemars 1.2.2 extend/UntaggedEnum#Struct#i.: i32, brust-analyzer cargo schemars 1.2.2 extend/UntaggedEnum#Struct#b.: bool }, |
| 156 | } |
| 157 | |
| 158 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 159 | fn extend_untagged_enumrust-analyzer cargo schemars 1.2.2 extend/extend_untagged_enum().() { |
| 160 | testrust-analyzer cargo schemars 1.2.2 test!!(UntaggedEnumrust-analyzer cargo schemars 1.2.2 extend/UntaggedEnum#).assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().().customrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]custom().(|schema, _| { |
| 161 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(schema.getrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]get().("foo"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!("bar"))); |
| 162 | |
| 163 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4 { |
| 164 | assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!( |
| 165 | schema.as_valuerust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]as_value().().pointerrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]pointer().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/anyOf/{i}/foo")), |
| 166 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&jsonrust-analyzer cargo serde_json 1.0.151 macros/json!!("bar")) |
| 167 | ); |
| 168 | } |
| 169 | }); |
| 170 | } |