File: fix-tests-no-default-features.patch

package info (click to toggle)
rust-schemars 0.8.22-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,312 kB
  • sloc: makefile: 2
file content (416 lines) | stat: -rw-r--r-- 10,060 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -90,6 +90,7 @@ required-features = [
 [[test]]
 name = "bound"
 path = "tests/bound.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "bytes"
@@ -99,11 +100,12 @@ required-features = ["bytes"]
 [[test]]
 name = "chrono"
 path = "tests/chrono.rs"
-required-features = ["chrono"]
+required-features = ["chrono","derive"]
 
 [[test]]
 name = "crate_alias"
 path = "tests/crate_alias.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "decimal"
@@ -116,18 +118,22 @@ required-features = [
 [[test]]
 name = "default"
 path = "tests/default.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "deprecated"
 path = "tests/deprecated.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "dereference"
 path = "tests/dereference.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "docs"
 path = "tests/docs.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "either"
@@ -137,31 +143,37 @@ required-features = ["either"]
 [[test]]
 name = "enum"
 path = "tests/enum.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "enum_deny_unknown_fields"
 path = "tests/enum_deny_unknown_fields.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "enum_repr"
 path = "tests/enum_repr.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "enumset"
 path = "tests/enumset.rs"
-required-features = ["enumset"]
+required-features = ["enumset", "derive"]
 
 [[test]]
 name = "examples"
 path = "tests/examples.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "ffi"
 path = "tests/ffi.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "flatten"
 path = "tests/flatten.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "from_value"
@@ -170,48 +182,57 @@ path = "tests/from_value.rs"
 [[test]]
 name = "indexmap"
 path = "tests/indexmap.rs"
-required-features = ["indexmap"]
+required-features = ["indexmap", "derive"]
 
 [[test]]
 name = "indexmap2"
 path = "tests/indexmap2.rs"
-required-features = ["indexmap2"]
+required-features = ["indexmap2", "derive"]
 
 [[test]]
 name = "inline_subschemas"
 path = "tests/inline_subschemas.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "macro"
 path = "tests/macro.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "nonzero_ints"
 path = "tests/nonzero_ints.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "property_name"
 path = "tests/property_name.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "range"
 path = "tests/range.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "remote_derive"
 path = "tests/remote_derive.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "remote_derive_generic"
 path = "tests/remote_derive_generic.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "result"
 path = "tests/result.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "same_name"
 path = "tests/same_name.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "schema_for_schema"
@@ -221,6 +242,7 @@ required-features = ["impl_json_schema"]
 [[test]]
 name = "schema_name"
 path = "tests/schema_name.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "schema_settings"
@@ -229,19 +251,22 @@ path = "tests/schema_settings.rs"
 [[test]]
 name = "schema_with_enum"
 path = "tests/schema_with_enum.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "schema_with_struct"
 path = "tests/schema_with_struct.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "semver"
 path = "tests/semver.rs"
-required-features = ["semver"]
+required-features = ["semver", "derive"]
 
 [[test]]
 name = "skip"
 path = "tests/skip.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "smallvec"
@@ -256,28 +281,32 @@ required-features = ["smol_str"]
 [[test]]
 name = "struct"
 path = "tests/struct.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "struct_additional_properties"
 path = "tests/struct_additional_properties.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "time"
 path = "tests/time.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "transparent"
 path = "tests/transparent.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "ui"
 path = "tests/ui.rs"
-required-features = ["ui_test"]
+required-features = ["ui_test", "derive"]
 
 [[test]]
 name = "url"
 path = "tests/url.rs"
-required-features = ["url"]
+required-features = ["url", "derive"]
 
 [[test]]
 name = "uuid"
@@ -289,10 +318,12 @@ required-features = [
 [[test]]
 name = "validate"
 path = "tests/validate.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "validate_inner"
 path = "tests/validate_inner.rs"
+required-features = ["derive"]
 
 [dependencies.arrayvec07]
 version = "0.7"
--- a/README.md
+++ b/README.md
@@ -15,6 +15,8 @@ Generate JSON Schema documents from Rust
 If you don't really care about the specifics, the easiest way to generate a JSON schema for your types is to `#[derive(JsonSchema)]` and use the `schema_for!` macro. All fields of the type must also implement `JsonSchema` - Schemars implements this for many standard library types.
 
 ```rust
+#[cfg(feature = "derive")]
+{
 use schemars::{schema_for, JsonSchema};
 
 #[derive(JsonSchema)]
@@ -32,6 +34,7 @@ pub enum MyEnum {
 
 let schema = schema_for!(MyStruct);
 println!("{}", serde_json::to_string_pretty(&schema).unwrap());
+}
 ```
 
 <details>
@@ -108,6 +111,8 @@ println!("{}", serde_json::to_string_pre
 One of the main aims of this library is compatibility with [Serde](https://github.com/serde-rs/serde). Any generated schema _should_ match how [serde_json](https://github.com/serde-rs/json) would serialize/deserialize to/from JSON. To support this, Schemars will check for any `#[serde(...)]` attributes on types that derive `JsonSchema`, and adjust the generated schema accordingly.
 
 ```rust
+#[cfg(feature = "derive")]
+{
 use schemars::{schema_for, JsonSchema};
 use serde::{Deserialize, Serialize};
 
@@ -130,6 +135,7 @@ pub enum MyEnum {
 
 let schema = schema_for!(MyStruct);
 println!("{}", serde_json::to_string_pretty(&schema).unwrap());
+}
 ```
 
 <details>
--- a/examples/custom_serialization.rs
+++ b/examples/custom_serialization.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::schema::{Schema, SchemaObject};
 use schemars::{r#gen::SchemaGenerator, schema_for, JsonSchema};
 use serde::{Deserialize, Serialize};
--- a/examples/custom_settings.rs
+++ b/examples/custom_settings.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{r#gen::SchemaSettings, JsonSchema};
 
 #[derive(JsonSchema)]
--- a/examples/doc_comments.rs
+++ b/examples/doc_comments.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{schema_for, JsonSchema};
 
 /// # My Amazing Struct
--- a/examples/enum_repr.rs
+++ b/examples/enum_repr.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{schema_for, JsonSchema_repr};
 
 #[derive(JsonSchema_repr)]
--- a/examples/main.rs
+++ b/examples/main.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{schema_for, JsonSchema};
 
 #[derive(JsonSchema)]
--- a/examples/remote_derive.rs
+++ b/examples/remote_derive.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 // Pretend that this is somebody else's crate, not a module.
 mod other_crate {
     // Neither Schemars nor the other crate provides a JsonSchema impl
--- a/examples/schemars_attrs.rs
+++ b/examples/schemars_attrs.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{schema_for, JsonSchema};
 use serde::{Deserialize, Serialize};
 
--- a/examples/serde_attrs.rs
+++ b/examples/serde_attrs.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{schema_for, JsonSchema};
 use serde::{Deserialize, Serialize};
 
--- a/examples/validate.rs
+++ b/examples/validate.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{schema_for, JsonSchema};
 
 #[derive(JsonSchema)]
--- a/src/gen.rs
+++ b/src/gen.rs
@@ -137,6 +137,8 @@ impl SchemaSettings {
 ///
 /// # Example
 /// ```
+/// #[cfg(feature = "derive")]
+/// {
 /// use schemars::{JsonSchema, r#gen::SchemaGenerator};
 ///
 /// #[derive(JsonSchema)]
@@ -146,6 +148,7 @@ impl SchemaSettings {
 ///
 /// let generator = SchemaGenerator::default();
 /// let schema = generator.into_root_schema_for::<MyStruct>();
+/// }
 /// ```
 #[derive(Debug, Default)]
 pub struct SchemaGenerator {
@@ -413,6 +416,8 @@ impl SchemaGenerator {
     ///
     /// # Example
     /// ```
+    /// #[cfg(feature = "derive")]
+    /// {
     /// use schemars::{JsonSchema, r#gen::SchemaGenerator};
     ///
     /// #[derive(JsonSchema)]
@@ -430,6 +435,7 @@ impl SchemaGenerator {
     /// assert!(dereferenced.is_some());
     /// assert!(!dereferenced.unwrap().is_ref());
     /// assert_eq!(dereferenced, generator.definitions().get("MyStruct"));
+    /// }
     /// ```
     pub fn dereference<'a>(&'a self, schema: &Schema) -> Option<&'a Schema> {
         match schema {
--- a/src/json_schema_impls/core.rs
+++ b/src/json_schema_impls/core.rs
@@ -196,6 +196,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "derive")]
     fn schema_for_option_with_ref() {
         use crate as schemars;
         #[derive(JsonSchema)]
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -64,6 +64,8 @@ use schema::Schema;
 /// # Examples
 /// Deriving an implementation:
 /// ```
+/// #[cfg(feature = "derive")]
+/// {
 /// use schemars::{schema_for, JsonSchema};
 ///
 /// #[derive(JsonSchema)]
@@ -72,6 +74,7 @@ use schema::Schema;
 /// }
 ///
 /// let my_schema = schema_for!(MyStruct);
+/// }
 /// ```
 ///
 /// When manually implementing `JsonSchema`, as well as determining an appropriate schema,
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -4,6 +4,8 @@
 ///
 /// # Example
 /// ```
+/// #[cfg(feature = "derive")]
+/// {
 /// use schemars::{schema_for, JsonSchema};
 ///
 /// #[derive(JsonSchema)]
@@ -12,6 +14,7 @@
 /// }
 ///
 /// let my_schema = schema_for!(MyStruct);
+/// }
 /// ```
 #[cfg(doc)]
 #[macro_export]
--- a/tests/schema_settings.rs
+++ b/tests/schema_settings.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 mod util;
 use schemars::r#gen::SchemaSettings;
 use schemars::JsonSchema;