commit_hash
stringlengths
40
40
author
stringlengths
1
57
date
timestamp[s]date
2010-07-26 04:45:09
2026-04-14 18:21:10
message
stringlengths
8
1.39M
diff
stringlengths
68
51.2k
files_changed
int64
1
136
insertions
int64
0
2.35k
deletions
int64
0
1.9k
8fddad6ab73b58b4b57457a7a347273d8d0b465e
Andrew Dunham
2015-07-09T22:33:48
Make the Automaton trait generic over the pattern type
diff --git a/examples/dict-search.rs b/examples/dict-search.rs index 2900fd5..f234a8e 100644 --- a/examples/dict-search.rs +++ b/examples/dict-search.rs @@ -60,7 +60,7 @@ fn run(args: &Args) -> Result<(), Box<Error>> { } fn write_matches<A, I>(aut: &A, it: I) -> Result<(), Box<Error>> - where A: Automaton, I...
4
31
21
9b606b2f4f65acd42ea8665aab41e5e0e4a48cfe
Andrew Gallant
2015-07-03T14:10:36
Add a more concise Debug impl for `FullAcAutomaton`.
diff --git a/src/full.rs b/src/full.rs index 1eeb42d..79785a6 100644 --- a/src/full.rs +++ b/src/full.rs @@ -1,3 +1,5 @@ +use std::fmt; + use memchr::memchr; use super::{ @@ -15,7 +17,7 @@ use super::autiter::Automaton; /// This is as fast as it gets, but it is guaranteed to use a lot of memory. /// Namely, it wi...
1
9
1
e849fe8c0825c6dc70063508db145fd213e3bc6a
Andrew Gallant
2015-06-27T00:24:08
remove comment
diff --git a/src/full.rs b/src/full.rs index c90c617..1eeb42d 100644 --- a/src/full.rs +++ b/src/full.rs @@ -18,7 +18,6 @@ use super::autiter::Automaton; #[derive(Clone, Debug)] pub struct FullAcAutomaton { pats: Vec<String>, - // i * #states + si trans: Vec<StateIdx>, // row-major, where states are row...
1
0
1
3990fe359cdd813448f9f727c193a978b7b4f324
Andrew Gallant
2015-06-20T04:53:49
Export iterator types.
diff --git a/src/lib.rs b/src/lib.rs index d6e494f..9b83d86 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -130,7 +130,10 @@ use std::iter::FromIterator; use memchr::memchr; -pub use self::autiter::{Automaton, Match}; +pub use self::autiter::{ + Automaton, Match, + Matches, MatchesOverlapping, StreamMatches, St...
1
4
1
01626f9df41bcd9ce6442434e2b6de95264b65ed
Andrew Gallant
2015-06-20T04:42:15
Refactor and introduce new "full" automaton. The "full" automaton is one in which the entire state transition graph is pre-computed so that it can fly through the input very quickly. The downside is that it can take a lot of memory. To support N > 1 automatons, I've introduced a new trait `Automaton` which encapsulat...
diff --git a/Cargo.toml b/Cargo.toml index 5c4d704..6cc840f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,12 @@ license = "Unlicense/MIT" [lib] name = "aho_corasick" +[[bin]] +name = "aho-corasick-dot" +test = false +doc = false +bench = false + [dependencies] memchr = "0.1.*" diff --git a/benches/bench...
7
639
299
3a60b87889b9fa73cb0c2b92b7713f4939359675
Andrew Gallant
2015-06-18T10:48:30
Fixes #1
diff --git a/Cargo.toml b/Cargo.toml index 27c32d4..58ae79a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "aho-corasick" version = "0.1.4" #:version authors = ["Andrew Gallant <jamslam@gmail.com>"] description = "Fast multiple substring searching with finite state machines." -documentation = "http...
1
1
1
caab20ad01c0f9a1ba889120ffb6a80c804885a4
Andrew Gallant
2015-06-17T23:33:43
Add a method to retrieve all patterns matched by the automaton.
diff --git a/src/lib.rs b/src/lib.rs index e9f175c..010a2ac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -250,6 +250,13 @@ impl<T: Transitions> AcAutomaton<T> { } } + /// Returns all of the patterns matched by this automaton. + /// + /// The order of the patterns is the order in which they were ...
1
7
0
751fa626d1b89ef5f25002213ee14a7b2b7bcb86
Andrew Gallant
2015-06-16T23:19:02
fix benchmarks
diff --git a/benches/bench.rs b/benches/bench.rs index 3184111..22283e8 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -32,7 +32,8 @@ fn haystack_same(letter: char) -> String { macro_rules! aut_benches { ($prefix:ident, $aut:expr) => { mod $prefix { -use aho_corasick::AcAutomaton; +#![allow(unused_impo...
1
2
1
563e3de64b8361fed79397a9fd05eb75a799a56c
Andrew Gallant
2015-06-16T23:06:29
Support sparse and sparse/dense transition schemes. The perf benefits for small number of small keywords are totally worth the memory expense.
diff --git a/benches/bench.rs b/benches/bench.rs index 0295732..3184111 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -5,12 +5,16 @@ extern crate test; use std::iter; -use aho_corasick::AcAutomaton; +use aho_corasick::{AcAutomaton, Transitions}; use test::Bencher; const HAYSTACK_RANDOM: &'static str ...
2
165
99
a0e6f6a9a6d1ce12acc5aff06a546104962e21ec
Andrew Gallant
2015-06-13T03:52:41
Basic algo done. Now it needs to be tuned and prettied up.
diff --git a/benches/bench.rs b/benches/bench.rs new file mode 100644 index 0000000..db007b6 --- /dev/null +++ b/benches/bench.rs @@ -0,0 +1,114 @@ +#![feature(test)] + +extern crate aho_corasick; +extern crate test; + +use std::iter; + +use aho_corasick::{Builder}; +use test::Bencher; + +#[bench] +fn one_byte(b: &mut ...
2
158
1
2ac8ff5300551d9eeb6aa1c26ec405d8b116228a
Brett Etter
2025-12-25T21:20:13
Added better map support (#452) * Added better map support * Made map still output properties even with additional enabled. * Removed early return * Handled multiple patterns or properties with the same value. --------- Co-authored-by: Sammy Harris <41593264+stegaBOB@users.noreply.github.com>
diff --git a/schemars/src/generate.rs b/schemars/src/generate.rs index 7149d6a..35dc261 100644 --- a/schemars/src/generate.rs +++ b/schemars/src/generate.rs @@ -611,7 +611,7 @@ impl SchemaGenerator { /// Returns `self.settings.definitions_path` as a plain JSON pointer to the definitions object, /// i.e. wit...
2
106
20
228d41038a87d9e5978c796f8ce397d2c694a3be
Graham Esau
2025-11-03T21:58:24
Set `#[must_use]` on pure functions Any call to these functions that doesn't use the return value is probably a mistake
diff --git a/schemars/src/_private/mod.rs b/schemars/src/_private/mod.rs index c1f9450..cab0b22 100644 --- a/schemars/src/_private/mod.rs +++ b/schemars/src/_private/mod.rs @@ -116,6 +116,7 @@ impl<T: Serialize> MaybeSerializeWrapper<T> { } /// Create a schema for a unit enum variant +#[must_use] pub fn new_unit_...
6
42
6
30a6d3da9c31c11d7f49bf00ee7f4ead44d5af9b
Graham Esau
2025-11-04T18:03:19
Typo in doc comments ("mata-schema")
diff --git a/schemars/src/consts.rs b/schemars/src/consts.rs index 30c63fc..60e91c5 100644 --- a/schemars/src/consts.rs +++ b/schemars/src/consts.rs @@ -4,19 +4,19 @@ Constants associated with JSON Schema generation. /// Known values of the `$schema` property. pub mod meta_schemas { - /// The mata-schema for [JS...
1
4
4
725c9b3e2aea7e2eb25d7f3940027066c60a6591
Graham Esau
2025-11-02T21:44:34
Resolve `mismatched_lifetime_syntaxes` lint
diff --git a/schemars/src/encoding.rs b/schemars/src/encoding.rs index abbf8aa..dfef663 100644 --- a/schemars/src/encoding.rs +++ b/schemars/src/encoding.rs @@ -3,7 +3,7 @@ use alloc::borrow::Cow; use core::fmt::Write as _; /// Encodes a string for insertion into a JSON Pointer in URI fragment representation. -pub ...
2
4
4
87b0f14ca830f4d6bdf4fafb5ed444df48139e67
Mikey Lombardi
2025-10-20T21:40:59
(GH-478) Fix `pointer_mut()` to resolve `#/$defs` pointers Prior to this change, the implementation for `Schema::pointer_mut()` was unable to resolve URI fragment identifiers like `#/$defs/foo`, while `Schema::pointer()` did correctly resolve the same identifier. This change: - Updates the implementation logic for `...
diff --git a/schemars/src/schema.rs b/schemars/src/schema.rs index aef5683..781e1fa 100644 --- a/schemars/src/schema.rs +++ b/schemars/src/schema.rs @@ -310,6 +310,9 @@ impl Schema { /// If the `Schema`'s underlying JSON value is an object, looks up a value by a JSON Pointer /// and returns a mutable referenc...
1
15
6
cc8ff127f79d5697e5d4020d891003c131cb12d8
Graham Esau
2025-07-05T16:16:29
Fix impls for atomic types in non-nightly `#[cfg(target_has_atomic)]` (without a value) is nightly-only
diff --git a/schemars/src/json_schema_impls/mod.rs b/schemars/src/json_schema_impls/mod.rs index 9ec7937..e8b0656 100644 --- a/schemars/src/json_schema_impls/mod.rs +++ b/schemars/src/json_schema_impls/mod.rs @@ -52,7 +52,6 @@ mod std_time; mod tuple; mod wrapper; -#[cfg(target_has_atomic)] mod atomic; #[cfg(fe...
1
0
1
167edf3a47b4bff96d384c7b6ab431853cf8eb82
Graham Esau
2025-06-28T11:27:14
Accept comments on both transparent struct and its field (#448)
diff --git a/schemars/tests/integration/transparent.rs b/schemars/tests/integration/transparent.rs index 53366ff..5991349 100644 --- a/schemars/tests/integration/transparent.rs +++ b/schemars/tests/integration/transparent.rs @@ -18,6 +18,7 @@ fn transparent_struct() { #[serde(transparent)] /// A doc comment pub stru...
2
13
7
75f670a403724facd825667fb0b67eeedb01ab6c
David Knaack
2025-06-28T11:24:09
Improve `json_schema!`-macro compability with older rust editions (#447) `TryFrom` is only available in the prelude for Rust 2021+
diff --git a/schemars/src/macros.rs b/schemars/src/macros.rs index 165ed86..e2af3a9 100644 --- a/schemars/src/macros.rs +++ b/schemars/src/macros.rs @@ -102,7 +102,7 @@ macro_rules! json_schema { ( {$($json_object:tt)*} ) => { - $crate::Schema::try_from($crate::_private::serde_json::json!({$($...
1
1
1
98a707d3804a6b3a0ccc417fb17dae7acfeb5e42
Graham Esau
2025-06-24T17:06:49
Fix deriving with `no_std` (#442) With `no_std`, the `std` prelude is not used, so `ToOwned` is not imported, causing: ``` error[E0599]: no method named `to_owned` found for reference `&'static str` in the current scope ... help: items from traits can only be used if the trait is in scope help: trait `ToOwned` which p...
diff --git a/schemars/tests/no_std.rs b/schemars/tests/no_std.rs new file mode 100644 index 0000000..2e85660 --- /dev/null +++ b/schemars/tests/no_std.rs @@ -0,0 +1,23 @@ +#![no_std] + +use schemars::{schema_for, JsonSchema}; + +#[derive(JsonSchema, Default)] +pub struct MyStruct { + /// A number + pub my_int: i3...
4
30
7
1905e9a5a70ccee910055835147c129a9ec8c8c5
ヤーノシュ
2025-06-23T07:03:37
fix: (somewhat) avoid duplicate compilation of subschema_for
diff --git a/schemars/src/generate.rs b/schemars/src/generate.rs index 6b0117e..82977d8 100644 --- a/schemars/src/generate.rs +++ b/schemars/src/generate.rs @@ -294,51 +294,80 @@ impl SchemaGenerator { /// If `T`'s schema depends on any [non-inlined](JsonSchema::inline_schema) schemas, then /// this method wi...
1
62
33
d8c0020418a8cc5fbc4c0fb82621e4fc56ce2794
Graham Esau
2025-06-22T19:49:30
Minor refactor - `expr_for_struct` now uses `expr_for_field`
diff --git a/schemars_derive/src/schema_exprs.rs b/schemars_derive/src/schema_exprs.rs index 2f1a379..7584900 100644 --- a/schemars_derive/src/schema_exprs.rs +++ b/schemars_derive/src/schema_exprs.rs @@ -696,9 +696,22 @@ fn expr_for_struct( schemars::_private::flatten(&mut #SCHEMA, #schema_expr); ...
1
18
22
c07bda334c97bc81071870eb6b0d1f086daa3ac8
Graham Esau
2025-06-22T18:10:05
Handle URI fragment JSON pointers in `schema.pointer(...)` (#438) This means `$ref` values can now be directly passed to the `pointer` method
diff --git a/schemars/src/encoding.rs b/schemars/src/encoding.rs new file mode 100644 index 0000000..abbf8aa --- /dev/null +++ b/schemars/src/encoding.rs @@ -0,0 +1,111 @@ +use crate::_alloc_prelude::*; +use alloc::borrow::Cow; +use core::fmt::Write as _; + +/// Encodes a string for insertion into a JSON Pointer in URI...
4
128
39
7907883ae8d8e7111a835bbbe6bca964a960b7d6
Graham Esau
2025-06-21T21:49:36
Correctly encode names used in `$ref` values (#436) `$ref` values are URI references, usually a URI fragment identifier representing a JSON pointer. `~` and `/` have special meaning in JSON Pointers, so need encoding to `~0` and `~1` respectively (see https://datatracker.ietf.org/doc/html/rfc6901#section-3). Some ot...
diff --git a/schemars/src/generate.rs b/schemars/src/generate.rs index 6d2c0fe..7716358 100644 --- a/schemars/src/generate.rs +++ b/schemars/src/generate.rs @@ -12,6 +12,7 @@ use crate::Schema; use crate::_alloc_prelude::*; use crate::{transform::*, JsonSchema}; use alloc::collections::{BTreeMap, BTreeSet}; +use cor...
2
56
3
24a65e9e32ff1a7b0fd22bb72599c4b6c66e8a7f
Graham Esau
2025-06-19T15:44:39
Remove deprecated items (#435)
diff --git a/schemars/src/generate.rs b/schemars/src/generate.rs index 998a32d..6d2c0fe 100644 --- a/schemars/src/generate.rs +++ b/schemars/src/generate.rs @@ -28,16 +28,6 @@ type CowStr = alloc::borrow::Cow<'static, str>; #[non_exhaustive] #[allow(clippy::struct_excessive_bools)] pub struct SchemaSettings { - /...
2
13
55
675123955dace0f9db05dc9a055ced5301ffda4c
Graham Esau
2025-06-19T15:33:10
Remove unneeded `Debug` derive
diff --git a/schemars_derive/src/attr/custom_meta.rs b/schemars_derive/src/attr/custom_meta.rs index 44989aa..53f2738 100644 --- a/schemars_derive/src/attr/custom_meta.rs +++ b/schemars_derive/src/attr/custom_meta.rs @@ -2,7 +2,7 @@ use quote::ToTokens; use syn::{parse::Parse, Meta, MetaList, MetaNameValue, Path}; ...
1
1
1
69ac6acc2a6e399cdc775e46baae97533ba35e36
Graham Esau
2025-06-19T15:31:43
Clippy fixes
diff --git a/schemars_derive/src/ast/mod.rs b/schemars_derive/src/ast/mod.rs index 76eec24..5937138 100644 --- a/schemars_derive/src/ast/mod.rs +++ b/schemars_derive/src/ast/mod.rs @@ -52,7 +52,7 @@ impl<'a> Container<'a> { .map(|serde| Self::from_serde(&ctxt, serde)); ctxt.check() - ...
9
110
109
cf2bb8da9f178a5509fdaaf5a61c6a54d9e2e75b
Graham Esau
2025-06-18T18:00:49
Simplify `json_schema_internal` helper
diff --git a/schemars/src/generate.rs b/schemars/src/generate.rs index b245e4f..998a32d 100644 --- a/schemars/src/generate.rs +++ b/schemars/src/generate.rs @@ -351,15 +351,15 @@ impl SchemaGenerator { let reference = format!("#{}/{}", self.definitions_path_stripped(), name); if !self.defini...
1
11
29
e4653c7c738299ca865269970ec1aad6b77f6a01
Graham Esau
2025-06-13T12:15:35
Remove unnecessary lifetime
diff --git a/schemars_derive/src/bound.rs b/schemars_derive/src/bound.rs index 98235ed..f5c7ec5 100644 --- a/schemars_derive/src/bound.rs +++ b/schemars_derive/src/bound.rs @@ -103,7 +103,7 @@ struct FindTyParams<'ast> { relevant_type_params: BTreeSet<&'ast Ident>, } -impl<'ast> FindTyParams<'ast> { +impl FindT...
1
1
1
4fbb73c6f527c94b8846862b6b12c0d368488d61
Graham Esau
2025-06-12T17:26:41
Improve error span for invalid `transform` attributes
diff --git a/schemars_derive/src/attr/mod.rs b/schemars_derive/src/attr/mod.rs index 85dcb33..1c3a439 100644 --- a/schemars_derive/src/attr/mod.rs +++ b/schemars_derive/src/attr/mod.rs @@ -10,7 +10,9 @@ use parse_meta::{ use proc_macro2::TokenStream; use quote::ToTokens; use serde_derive_internals::Ctxt; -use syn::{...
1
4
2
0cfa127d40c69c2f86e752c84f9c1ace823f19bf
Graham Esau
2025-06-01T08:47:24
Add `get_mut`, `pointer`, `pointer_mut` methods to `Schema` (#416)
diff --git a/docs/_includes/examples/custom_serialization.rs b/docs/_includes/examples/custom_serialization.rs index 8e2a695..7a049c8 100644 --- a/docs/_includes/examples/custom_serialization.rs +++ b/docs/_includes/examples/custom_serialization.rs @@ -21,9 +21,7 @@ pub struct MyStruct { fn make_custom_schema(genera...
9
89
26
d871ec13160ff5052310cb280ecc8916ae283da1
Graham Esau
2025-05-31T17:29:40
Remove usage of `extra-traits` syn feature (#414)
diff --git a/schemars_derive/Cargo.toml b/schemars_derive/Cargo.toml index 4050387..2022cf2 100644 --- a/schemars_derive/Cargo.toml +++ b/schemars_derive/Cargo.toml @@ -18,8 +18,9 @@ proc-macro = true [dependencies] proc-macro2 = "1.0" quote = "1.0" -syn = { version = "2.0", features = ["extra-traits"] } +syn = "2.0...
4
9
11
b24c8417283e60985ee766c0fd6e58aaa2c30e46
Graham Esau
2025-05-25T17:53:21
Add `RestrictFormats` transform (#405)
diff --git a/schemars/src/consts.rs b/schemars/src/consts.rs new file mode 100644 index 0000000..30c63fc --- /dev/null +++ b/schemars/src/consts.rs @@ -0,0 +1,26 @@ +/*! +Constants associated with JSON Schema generation. +*/ + +/// Known values of the `$schema` property. +pub mod meta_schemas { + /// The mata-schema...
4
275
10
04db03b15f0eb3cc0dfa3baee3168cf2f63189c1
Graham Esau
2025-05-25T16:25:53
Re-enable some clippy lints
diff --git a/schemars/src/generate.rs b/schemars/src/generate.rs index 80ae7b2..e6b258c 100644 --- a/schemars/src/generate.rs +++ b/schemars/src/generate.rs @@ -302,9 +302,11 @@ impl SchemaGenerator { && (!self.settings.inline_subschemas || self.pending_schema_ids.contains(&uid)); if return_ref ...
2
7
8
413e4a0c019f71e02b790e922951b4bed64a6fa6
Graham Esau
2025-05-25T09:16:01
Add flag to `take_definitions` to optionally apply transforms (#404)
diff --git a/schemars/src/generate.rs b/schemars/src/generate.rs index e37f791..80ae7b2 100644 --- a/schemars/src/generate.rs +++ b/schemars/src/generate.rs @@ -371,8 +371,19 @@ impl SchemaGenerator { /// /// The keys of the returned `Map` are the [schema names](JsonSchema::schema_name), and the /// valu...
8
37
7
9d58bdcd7a002f9ea42f403831b3e83082926ad8
Graham Esau
2025-05-25T08:37:29
Change `String` settings to `Cow<'static, str>` (#403) This makes it easier to construct a `SchemaSettings` in a `const` context
diff --git a/schemars/src/generate.rs b/schemars/src/generate.rs index edba78a..e37f791 100644 --- a/schemars/src/generate.rs +++ b/schemars/src/generate.rs @@ -42,11 +42,11 @@ pub struct SchemaSettings { /// A single leading `#` and/or single trailing `/` are ignored. /// /// Defaults to `"/$defs"`. - ...
2
12
13
fb54a6d17fe7dcb52164f4044f36e900ad771d38
Graham Esau
2025-05-24T21:38:50
Deprecate `as_any`/`as_any_mut`, add downcast methods to `dyn GenTransform` (#402)
diff --git a/schemars/src/generate.rs b/schemars/src/generate.rs index 8b6846a..fee32de 100644 --- a/schemars/src/generate.rs +++ b/schemars/src/generate.rs @@ -626,11 +626,31 @@ fn json_pointer_mut<'a>( /// } /// /// let v: &dyn GenTransform = &MyTransform; -/// assert!(v.as_any().is::<MyTransform>()); +/// assert!...
1
52
11
1628525ae015bfc0a1a3ab2f2bc12d007533e4ee
Graham Esau
2025-05-11T18:57:30
Silence `clippy::incompatible_msrv` in garde test garde is downgraded to a compatible git rev in ci.yml
diff --git a/schemars/tests/integration/garde.rs b/schemars/tests/integration/garde.rs index e7ca2a5..54c3786 100644 --- a/schemars/tests/integration/garde.rs +++ b/schemars/tests/integration/garde.rs @@ -1,3 +1,5 @@ +#![allow(clippy::incompatible_msrv)] + use crate::prelude::*; use garde::Validate;
1
2
0
3c048ef88c988c7c5e254c8d85d6c0cdbbe4cc5c
Graham Esau
2025-05-11T18:54:14
Resolve `clippy::unnecessary_semicolon`
diff --git a/schemars/src/_private/mod.rs b/schemars/src/_private/mod.rs index aa5c6fe..baf90f9 100644 --- a/schemars/src/_private/mod.rs +++ b/schemars/src/_private/mod.rs @@ -279,7 +279,7 @@ pub fn flatten(schema: &mut Schema, other: Schema) { _ => { // leave the original...
3
3
3
f8c1fe21b72a367a4814530e1b1a1f3693e86088
Dmitry Dygalo
2024-09-20T07:58:17
chore: Update jsonschema to 0.20.0 Signed-off-by: Dmitry Dygalo <dmitry.dygalo@workato.com>
diff --git a/Cargo.lock b/Cargo.lock index 30bc80c..0f30998 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -416,9 +416,9 @@ dependencies = [ [[package]] name = "jsonschema" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2be7aa9f08a262039c0b5eb11b7...
3
17
17
13ffa14d1f65bbcc85e1f5c24fc8d8c7c36fb381
Andre Popovitch
2024-12-27T20:47:15
Fix clippy lints
diff --git a/schemars/src/generate.rs b/schemars/src/generate.rs index 375fa08..498d3b4 100644 --- a/schemars/src/generate.rs +++ b/schemars/src/generate.rs @@ -671,13 +671,14 @@ where impl Debug for Box<dyn GenTransform> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + #[allow(...
3
7
7
497333e91bde18be48800a82e9d7ff3c78ded95c
Graham Esau
2024-09-01T10:30:54
Replace placeholder error message
diff --git a/schemars_derive/src/schema_exprs.rs b/schemars_derive/src/schema_exprs.rs index 976bbe0..3e1b486 100644 --- a/schemars_derive/src/schema_exprs.rs +++ b/schemars_derive/src/schema_exprs.rs @@ -76,7 +76,12 @@ pub fn expr_for_repr(cont: &Container) -> Result<SchemaExpr, syn::Error> { let variants = mat...
1
6
1
5d58a4d3f04473b160987a3b84dda8db3484c75b
Graham Esau
2024-08-30T12:05:33
Wrap comment lines at 100 chars
diff --git a/schemars/src/generate.rs b/schemars/src/generate.rs index 2e8da07..e51ee66 100644 --- a/schemars/src/generate.rs +++ b/schemars/src/generate.rs @@ -21,7 +21,8 @@ type CowStr = alloc::borrow::Cow<'static, str>; /// Settings to customize how Schemas are generated. /// /// The default settings currently co...
9
147
92
9bba81892fa71b8c71db48c33f1ce3b66b6197e6
Graham Esau
2024-08-29T18:47:19
Move private crate exports into `_private` module
diff --git a/schemars/src/_private/mod.rs b/schemars/src/_private/mod.rs index 404d015..613c9dc 100644 --- a/schemars/src/_private/mod.rs +++ b/schemars/src/_private/mod.rs @@ -7,6 +7,9 @@ use serde_json::{json, map::Entry, Map, Value}; mod regex_syntax; mod rustdoc; +pub extern crate alloc; +pub extern crate serde...
6
34
37
a85f0fc7bc6a9962101480fdf4b6ec01f4e9b290
Graham Esau
2024-08-28T08:16:29
Rust rustfmt
diff --git a/schemars/src/json_schema_impls/either1.rs b/schemars/src/json_schema_impls/either1.rs index ba8a706..0e9a129 100644 --- a/schemars/src/json_schema_impls/either1.rs +++ b/schemars/src/json_schema_impls/either1.rs @@ -1,5 +1,5 @@ -use crate::_alloc_prelude::*; use crate::SchemaGenerator; +use crate::_alloc_...
4
10
6
d7ff81de96d8e7a61212df2af490631e73f0b2f5
Graham Esau
2024-08-27T18:26:02
Fix `regex` attribute when it uses dereferencing
diff --git a/schemars/tests/validate.rs b/schemars/tests/validate.rs index 9e07fd5..1595e71 100644 --- a/schemars/tests/validate.rs +++ b/schemars/tests/validate.rs @@ -3,8 +3,16 @@ use schemars::JsonSchema; use std::collections::BTreeMap; use util::*; +struct FakeRegex(&'static str); + +impl std::fmt::Display for ...
2
12
4
0f6daccc0aa9a76c5bb448b05563fb6e83cb8c98
Graham Esau
2024-08-24T14:01:31
Use `OccupiedEntry::remove_entry()`
diff --git a/Cargo.lock b/Cargo.lock index f30be91..5dd5506 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -383,9 +383,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.125" +version = "1.0.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8e735a073ccf5be70aa806...
3
4
6
5547e77bcd782dbf22461fd7938c5b24f300525e
Graham Esau
2024-08-24T10:35:28
Resolve clippy lint `multiple_bound_locations`
diff --git a/schemars/src/ser.rs b/schemars/src/ser.rs index 4b4117f..079c566 100644 --- a/schemars/src/ser.rs +++ b/schemars/src/ser.rs @@ -74,9 +74,9 @@ impl<'a> serde::Serializer for Serializer<'a> { forward_to_subschema_for!(serialize_str, &str); forward_to_subschema_for!(serialize_bytes, &[u8]); - f...
1
24
32
4db53a1bcecacffe1a4da2d5829534aeb56fc56c
Graham Esau
2024-08-21T16:05:30
Add link to docs site from rustdoc comment
diff --git a/schemars/src/lib.rs b/schemars/src/lib.rs index 252609c..5dffb03 100644 --- a/schemars/src/lib.rs +++ b/schemars/src/lib.rs @@ -67,7 +67,9 @@ pub mod r#gen { /// /// This is implemented for many Rust primitive and standard library types. /// -/// This can also be automatically derived on most custom typ...
1
3
1
0af8f50086154f6878e7a3c7f8ae6153ec1b9361
Bilal Mahmoud
2024-08-17T12:28:56
Add absolute import for `Result` (#307) This changes it so that the `Result` used in the derived schema code is using the absolute path to the `Result` enum, otherwise type aliases, such as: `error_stack::Result` cannot be used.
diff --git a/schemars_derive/src/schema_exprs.rs b/schemars_derive/src/schema_exprs.rs index 1f5df99..3278e99 100644 --- a/schemars_derive/src/schema_exprs.rs +++ b/schemars_derive/src/schema_exprs.rs @@ -556,7 +556,7 @@ fn field_default_expr(field: &Field, container_has_default: bool) -> Option<Toke ...
1
1
1
599fbb38b6c255241ebc995231ba4c0554d32b3c
Graham Esau
2024-08-16T21:27:45
Fix `JsonSchema` impls for atomics This was broken in 1c3442839423ca21846f1900e0d7962a2e8217bc
diff --git a/schemars/src/json_schema_impls/mod.rs b/schemars/src/json_schema_impls/mod.rs index ca9ff28..6260b2b 100644 --- a/schemars/src/json_schema_impls/mod.rs +++ b/schemars/src/json_schema_impls/mod.rs @@ -52,7 +52,7 @@ mod time; mod tuple; mod wrapper; -#[cfg(std_atomic)] +#[cfg(target_has_atomic)] mod ato...
1
1
1
1c3442839423ca21846f1900e0d7962a2e8217bc
Graham Esau
2024-08-14T10:57:28
Remove build.rs, use `target_has_atomic` instead `target_has_atomic` has been stable since rust 1.60
diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index e8ead19..56982b8 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -10,7 +10,6 @@ license = "MIT" readme = "README.md" keywords = ["rust", "json-schema", "serde"] categories = ["encoding"] -build = "build.rs" rust-version = "1.60" [dependen...
3
19
28
faf15e78595c34279809aa265b46a8cd4401c2e0
Graham Esau
2024-08-12T17:24:38
Merge metadata setters and transform applications if they're both specified
diff --git a/schemars_derive/src/metadata.rs b/schemars_derive/src/metadata.rs index 8f2dc3b..1cae499 100644 --- a/schemars_derive/src/metadata.rs +++ b/schemars_derive/src/metadata.rs @@ -17,14 +17,7 @@ pub struct SchemaMetadata<'a> { impl<'a> SchemaMetadata<'a> { pub fn apply_to_schema(&self, schema_expr: &mut ...
1
3
9
eb3077742f5d4034bdcf85cfc81d84e5e898fac4
Graham Esau
2024-08-12T17:21:25
Optimise applying metadata This reduces the output MIR size of the example code from https://github.com/GREsau/schemars/issues/246 by ~50% (from 18k to 9k lines)
diff --git a/schemars/src/_private.rs b/schemars/src/_private.rs index cdaec3a..c507c5f 100644 --- a/schemars/src/_private.rs +++ b/schemars/src/_private.rs @@ -135,6 +135,10 @@ pub fn insert_object_property<T: ?Sized + JsonSchema>( } } +pub fn insert_metadata_property(schema: &mut Schema, key: &str, value: imp...
2
12
9
29067a0331ec09997e116faa1f1a773e375284c7
Graham Esau
2024-08-09T10:03:12
Add `GenTransform::as_any_mut` and add examples
diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs index c825172..f6553eb 100644 --- a/schemars/src/gen.rs +++ b/schemars/src/gen.rs @@ -528,7 +528,40 @@ fn json_pointer_mut<'a>( /// ``` pub trait GenTransform: Transform + DynClone + Any + Send { /// Upcasts this transform into an [`Any`], which can be used ...
1
37
0
a1c3bcd5cfc5f6cf3a8a9d34ab0dd055714f36a2
Graham Esau
2024-08-08T21:04:39
Add `Send` requirement to `GenTransform` This means `SchemaSettings` and `SchemaGenerator` are both now `Send`
diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs index 781a2e5..c825172 100644 --- a/schemars/src/gen.rs +++ b/schemars/src/gen.rs @@ -140,7 +140,7 @@ impl SchemaSettings { } /// Appends the given transform to the list of [transforms](SchemaSettings::transforms) for these `SchemaSettings`. - pub fn...
1
11
3
324be32de6bf0b4e409b8a4ca148c67fe8c2e4ec
Graham Esau
2024-08-07T18:20:01
Replace `visit::Visitor` with `transform::Transform`
diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs index 1dc4bcf..781a2e5 100644 --- a/schemars/src/gen.rs +++ b/schemars/src/gen.rs @@ -8,7 +8,7 @@ There are two main types in this module: */ use crate::Schema; -use crate::{visit::*, JsonSchema}; +use crate::{transform::*, JsonSchema}; use dyn_clone::DynClone...
5
432
273
71b45a8ba3ff5fcc16a0fd89fe76ab258ff322b5
Graham Esau
2024-08-04T16:26:08
Remove irrelevant comments I'm reasonably satisfied that the current behaviour of enum variants with `with`/`schema_with` attributes is correct
diff --git a/schemars/tests/enum.rs b/schemars/tests/enum.rs index 70bd9d2..4c57f34 100644 --- a/schemars/tests/enum.rs +++ b/schemars/tests/enum.rs @@ -31,7 +31,6 @@ enum External { }, UnitTwo, Tuple(i32, bool), - // FIXME this should probably only replace the "payload" of the enum #[schemars(wi...
3
0
12
ef9c8dc56b483e787744915e21ce6eeff5ddc845
Graham Esau
2024-08-04T15:59:10
Fix doctest
diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs index f39cdf7..1dc4bcf 100644 --- a/schemars/src/gen.rs +++ b/schemars/src/gen.rs @@ -534,7 +534,11 @@ fn json_pointer_mut<'a>( /// #[derive(Debug, Clone)] /// struct MyVisitor; /// -/// impl Visitor for MyVisitor { } +/// impl Visitor for MyVisitor { +/// fn ...
1
5
1
ade95a54d5b6678550759c6a34dad9d9148582fa
Graham Esau
2024-08-04T15:45:39
Remove default implementation of `Visitor::visit_schema()` Since it's now the only method, there's no good reason to implement the trait without implementing that method.
diff --git a/schemars/src/visit.rs b/schemars/src/visit.rs index 850c1eb..35453e0 100644 --- a/schemars/src/visit.rs +++ b/schemars/src/visit.rs @@ -36,9 +36,7 @@ pub trait Visitor { /// Override this method to modify a [`Schema`] and (optionally) its subschemas. /// /// When overriding this method, you ...
1
1
3
3ee7c7f5e566ec50ba3b0a0a9a1acea32adfe2ad
Graham Esau
2024-05-27T10:14:43
v1.0.0-alpha.1
diff --git a/Cargo.lock b/Cargo.lock index 4653cb9..729d10c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -303,7 +303,7 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "schemars" -version = "0.8.21" +version = "1.0.0-alpha.1" dependencies = [ "arrayvec", "bigde...
3
5
5
fe05631f214416ceba756d8a464eebcb742a0c42
Graham Esau
2024-05-23T16:44:50
impl JsonSchema for Schema
diff --git a/schemars/src/schema.rs b/schemars/src/schema.rs index 27cb048..6eb55e8 100644 --- a/schemars/src/schema.rs +++ b/schemars/src/schema.rs @@ -2,8 +2,7 @@ JSON Schema types. */ -use ref_cast::ref_cast_custom; -use ref_cast::RefCastCustom; +use ref_cast::{ref_cast_custom, RefCastCustom}; use serde::{Deser...
1
17
2
1247b8975ef8e742ab4b2f5f776038900dc69d12
Graham Esau
2024-05-23T13:14:42
Revert to previous behaviour regarding visitors running on `$defs`/`definitions` lazily (only if/when root schema is created). Visitors will now always descend into `$defs`/`definitions`. If a generator is configured to use a different definitions path, then the visitor will also descend into that path (but a plain `V...
diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs index 6446a2c..038228c 100644 --- a/schemars/src/gen.rs +++ b/schemars/src/gen.rs @@ -35,7 +35,9 @@ pub struct SchemaSettings { pub option_add_null_type: bool, /// A JSON pointer to the expected location of referenceable subschemas within the resulting ro...
2
76
49
d32231c082db63835726d01cd31ebe4c1c2e8744
Graham Esau
2024-05-20T14:25:16
Allow running visitors against pre-2020-12 schemas
diff --git a/schemars/src/visit.rs b/schemars/src/visit.rs index 30bdf0d..3789cf5 100644 --- a/schemars/src/visit.rs +++ b/schemars/src/visit.rs @@ -45,6 +45,11 @@ pub trait Visitor { pub fn visit_schema<V: Visitor + ?Sized>(v: &mut V, schema: &mut Schema) { if let Some(obj) = schema.as_object_mut() { fo...
1
18
1
22e89a5dd6c8f7ac57c1c5ac48fb9ab6af7e3ca1
Graham Esau
2024-05-18T22:00:24
Never add a field with the `default` attribute to a schema's `required` properties
diff --git a/schemars/src/_private.rs b/schemars/src/_private.rs index 129d92e..4be6c27 100644 --- a/schemars/src/_private.rs +++ b/schemars/src/_private.rs @@ -129,7 +129,7 @@ pub fn insert_object_property<T: ?Sized + JsonSchema>( properties.insert(key.to_owned(), sub_schema.into()); } - if required...
1
1
1
cf5be1b266add95212bdcec8fecd8c330a119558
Graham Esau
2024-05-13T20:29:16
Ignore failing test The failure reason is arguably a bug in `Schema`'s `PartialEq` impl. This bug is not present in the v1 branch, so the test passes there.
diff --git a/schemars/tests/schema_settings.rs b/schemars/tests/schema_settings.rs index a82570d..d00042b 100644 --- a/schemars/tests/schema_settings.rs +++ b/schemars/tests/schema_settings.rs @@ -40,6 +40,7 @@ fn schema_matches_2019_09() -> TestResult { } #[test] +#[ignore = "Fails due to default/empty `Metadata` ...
1
1
0
b87b6ebb6c564cf1313fe65a6631927e18fa3a4d
Graham Esau
2024-05-13T09:56:55
Remove usage of `is_some_and` (not supported in rustc 1.60)
diff --git a/schemars/src/_private.rs b/schemars/src/_private.rs index 3de9614..0ba27ce 100644 --- a/schemars/src/_private.rs +++ b/schemars/src/_private.rs @@ -81,7 +81,7 @@ pub fn apply_internal_enum_tag( deny_unknown_fields: bool, ) { let obj = schema.ensure_object(); - let is_unit = obj.get("type").is...
1
1
1
d04c17bda49ac6e289134315b9c8544d37a83f87
Graham Esau
2024-05-06T12:54:13
Simplify generated enum code (#286) * simplify the code generated for unit enums * simplify generated code for validating object properties * optimize internal and externally tagged enums --------- Co-authored-by: Robin Appelman <robin@icewind.nl>
diff --git a/schemars/src/_private.rs b/schemars/src/_private.rs index aa6b570..c61ffc1 100644 --- a/schemars/src/_private.rs +++ b/schemars/src/_private.rs @@ -1,7 +1,6 @@ -use crate::flatten::Merge; use crate::gen::SchemaGenerator; -use crate::schema::{Metadata, Schema, SchemaObject}; -use crate::JsonSchema; +use cr...
3
152
124
df00e2fd71ea7139ad8ab713b32a0f6792b6c094
Graham Esau
2024-04-28T17:59:42
Add comment explaining why we double-parse an `Expr`
diff --git a/schemars_derive/src/attr/validation.rs b/schemars_derive/src/attr/validation.rs index b0af2c5..a511ab4 100644 --- a/schemars_derive/src/attr/validation.rs +++ b/schemars_derive/src/attr/validation.rs @@ -510,6 +510,7 @@ fn wrap_string_validation(v: Vec<TokenStream>) -> Option<TokenStream> { } fn str_or...
1
1
0
9501fe319f4eaab4ac9df13103442d703ee62522
Graham Esau
2024-04-28T17:44:43
Update to syn 2 and serde_derive_internals 0.29
diff --git a/schemars/tests/remote_derive_generic.rs b/schemars/tests/remote_derive_generic.rs index 2a5ac54..8599266 100644 --- a/schemars/tests/remote_derive_generic.rs +++ b/schemars/tests/remote_derive_generic.rs @@ -20,6 +20,7 @@ enum OrDef<A, B> { struct Str<'a>(&'a str); +#[allow(dead_code)] #[derive(JsonS...
15
206
235
ae9544aaf96b505f2b1b9a2f583d3c945cf4543d
Graham Esau
2023-11-11T20:28:10
Put schema value into a variable before calling apply_metadata This reduces size of MIR output, which should somewhat mitigate #246
diff --git a/schemars_derive/src/metadata.rs b/schemars_derive/src/metadata.rs index 32dbf67..e963704 100644 --- a/schemars_derive/src/metadata.rs +++ b/schemars_derive/src/metadata.rs @@ -15,12 +15,13 @@ impl<'a> SchemaMetadata<'a> { pub fn apply_to_schema(&self, schema_expr: &mut TokenStream) { let sett...
1
4
3
cc28738f414619a2cae8b3ddd999c7f7d2a98992
Adam Chalmers
2023-09-17T20:05:21
Support bigdecimal 0.4 (#237)
diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index 88cbfd4..75fec92 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -31,7 +31,8 @@ arrayvec07 = { version = "0.7", default-features = false, optional = true, packa url = { version = "2.0", default-features = false, optional = true } bytes = { ver...
2
8
2
6e3248f83054c2544a9ed2ff5441e4fd0b322241
Graham Esau
2023-09-17T19:53:10
Fix bad merge
diff --git a/schemars/src/json_schema_impls/decimal.rs b/schemars/src/json_schema_impls/decimal.rs index 1a2806a..b4c5f92 100644 --- a/schemars/src/json_schema_impls/decimal.rs +++ b/schemars/src/json_schema_impls/decimal.rs @@ -13,7 +13,7 @@ macro_rules! decimal_impl { } fn schema_id() -> C...
1
1
1
30e513ac1423cf6e24463cdfcc9b785aec1c6cc8
Graham Esau
2023-09-09T12:32:54
Use feature resolver version 2
diff --git a/Cargo.toml b/Cargo.toml index 0540418..075df0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,3 +3,4 @@ members = [ "schemars", "schemars_derive" ] +resolver = "2"
1
1
0
e0c867cd6a6b08c4ca8a044bdb66a8d245c8e2ab
Graham Esau
2023-08-28T11:26:15
Forward RawValue's JsonSchema impl to Value
diff --git a/schemars/src/json_schema_impls/serdejson.rs b/schemars/src/json_schema_impls/serdejson.rs index df6ad49..01a492c 100644 --- a/schemars/src/json_schema_impls/serdejson.rs +++ b/schemars/src/json_schema_impls/serdejson.rs @@ -35,14 +35,4 @@ impl JsonSchema for Number { } #[cfg(feature = "raw_value")] -im...
1
1
11
cb392d1829b6f009a3bb605e2cd14af582298e68
Łukasz Biel
2022-10-13T11:09:54
Cover serde_json RawValue type by schemars
diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index 8470a24..71403d7 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -60,6 +60,8 @@ uuid = ["uuid08"] arrayvec = ["arrayvec05"] indexmap1 = ["indexmap"] +raw_value = ["serde_json/raw_value"] + ui_test = [] [[test]] diff --git a/schemars/src/...
2
15
0
aeb989486e94d41f4010fccc082fe673d6ea810f
David Knaack
2023-06-27T13:15:13
Add support for indexmap v2
diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index de80438..8470a24 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -21,6 +21,7 @@ dyn-clone = "1.0" chrono = { version = "0.4", default-features = false, optional = true } indexmap = { version = "1.2", features = ["serde-1"], optional = true }...
4
31
0
1ac9d19a244c3422ba5ec18105ef19274bcb3a9d
Graham Esau
2023-08-20T16:54:47
Don't duplicate entire README in doc comment
diff --git a/schemars/src/lib.rs b/schemars/src/lib.rs index 796ec27..9905b01 100644 --- a/schemars/src/lib.rs +++ b/schemars/src/lib.rs @@ -1,287 +1,5 @@ #![forbid(unsafe_code)] -/*! -Generate JSON Schema documents from Rust code - -## Basic Usage - -If you don't really care about the specifics, the easiest way to ge...
2
2
284
3d56977ecf7cb12ab8ce9b8d65f93a65751169f4
Graham Esau
2023-08-20T16:23:41
Update to rust 2021 edition
diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index 850ef13..e02f0e0 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -5,7 +5,7 @@ homepage = "https://graham.cool/schemars/" repository = "https://github.com/GREsau/schemars" version = "0.8.12" authors = ["Graham Esau <gesau@hotmail.co.uk>"] -edi...
2
2
2
9dc816fafcc797061fdad936bf651fad23e64fbb
Simon Warta
2022-12-03T00:06:58
Set a reasonable min version for serde_json serde_json 1.0.25 brings in the json! macro that is used here (https://github.com/serde-rs/json/releases/tag/v1.0.25)
diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index bf5d6b9..9f3fedd 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -15,7 +15,7 @@ build = "build.rs" [dependencies] schemars_derive = { version = "=0.8.11", optional = true, path = "../schemars_derive" } serde = { version = "1.0", features = ["...
1
1
1
824993ca76d1233576bb9d4677a9c8bce24626fd
Graham Esau
2023-02-26T19:59:17
Apply clippy fixes
diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs index 8ae1740..58eaa61 100644 --- a/schemars/src/gen.rs +++ b/schemars/src/gen.rs @@ -263,7 +263,7 @@ impl SchemaGenerator { /// The keys of the returned `Map` are the [schema names](JsonSchema::schema_name), and the values are the schemas /// themselves....
6
26
28
39bae201eb25f5918ce3d4e91d563ae63077d25a
Graham Esau
2023-02-26T19:47:10
Run cargo fmt
diff --git a/schemars/src/json_schema_impls/decimal.rs b/schemars/src/json_schema_impls/decimal.rs index 6058a7f..d7fc8a1 100644 --- a/schemars/src/json_schema_impls/decimal.rs +++ b/schemars/src/json_schema_impls/decimal.rs @@ -25,7 +25,7 @@ macro_rules! decimal_impl { }; } -#[cfg(feature="rust_decimal")] +#[c...
4
29
27
c59e5b5e1c4deeb1e0fb38808f350c54e2c235ee
Graham Esau
2022-08-15T10:00:08
Fix test
diff --git a/schemars_derive/src/attr/schemars_to_serde.rs b/schemars_derive/src/attr/schemars_to_serde.rs index aef2ebf..781f5da 100644 --- a/schemars_derive/src/attr/schemars_to_serde.rs +++ b/schemars_derive/src/attr/schemars_to_serde.rs @@ -189,7 +189,7 @@ mod tests { #[serde(skip_serializing_if = ...
1
1
1
4754a13fb3fa33d074259db2e04841905c2997b3
Graham Esau
2022-08-15T09:51:25
Ignore `bound` set in serde attrs
diff --git a/schemars_derive/src/attr/schemars_to_serde.rs b/schemars_derive/src/attr/schemars_to_serde.rs index dd871b0..aef2ebf 100644 --- a/schemars_derive/src/attr/schemars_to_serde.rs +++ b/schemars_derive/src/attr/schemars_to_serde.rs @@ -20,6 +20,7 @@ pub(crate) static SERDE_KEYWORDS: &[&str] = &[ "flatten"...
1
9
5
6ada120cd3cdcf0a5ab8b5e1e8f572c4224037be
Randy Barlow
2022-08-17T16:03:53
Fix a typo Signed-off-by: Randy Barlow <randy.barlow@deepgram.com>
diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs index 2634e12..8ae1740 100644 --- a/schemars/src/gen.rs +++ b/schemars/src/gen.rs @@ -2,7 +2,7 @@ JSON Schema generator and settings. This module is useful if you want more control over how the schema generated than the [`schema_for!`] macro gives you. -There a...
1
1
1
043d794e3931543b81d99b4959089c675fea0943
Graham Esau
2022-05-15T21:55:10
Fix build warnings from tests Deriving `Debug` is no longer enough to suppress warnings about unused fields
diff --git a/schemars/tests/chrono.rs b/schemars/tests/chrono.rs index 056e6fe..7f518d7 100644 --- a/schemars/tests/chrono.rs +++ b/schemars/tests/chrono.rs @@ -3,7 +3,8 @@ use chrono::prelude::*; use schemars::JsonSchema; use util::*; -#[derive(Debug, JsonSchema)] +#[allow(dead_code)] +#[derive(JsonSchema)] struc...
30
188
136
115a9eebf2d7673a84bef814684b66666f54e021
Andy Weiss
2022-03-02T17:26:16
Add license notice to regex_syntax.rs The comment in the code says this code was copied from another source with an appropriate link. However just local to this file it is not clear what the license terms of that code are. I added the license notice to this file that governs the particular code that was copied over. ...
diff --git a/schemars_derive/src/regex_syntax.rs b/schemars_derive/src/regex_syntax.rs index 353bf8d..750d1e2 100644 --- a/schemars_derive/src/regex_syntax.rs +++ b/schemars_derive/src/regex_syntax.rs @@ -1,5 +1,31 @@ // Copied from regex_syntax crate to avoid pulling in the whole crate just for a utility function //...
1
26
0
85ed613e4a3cc67f0be602b82cc0b77208493458
Graham Esau
2022-05-15T21:26:13
Remove unnecessary derives on test struct
diff --git a/schemars/tests/default.rs b/schemars/tests/default.rs index 4623994..c44a3c2 100644 --- a/schemars/tests/default.rs +++ b/schemars/tests/default.rs @@ -55,7 +55,7 @@ fn schema_default_values() -> TestResult { test_default_generated_schema::<MyStruct>("default") } -#[derive(Default, Deserialize, Ser...
1
1
1
feb6c4b2fec86f8ac2afd973a3b3a2d6f51135f2
Graham Esau
2022-05-15T21:19:52
Use `as` instead of immediately-invoked typed function
diff --git a/schemars_derive/src/schema_exprs.rs b/schemars_derive/src/schema_exprs.rs index 6efa9b8..f41e37a 100644 --- a/schemars_derive/src/schema_exprs.rs +++ b/schemars_derive/src/schema_exprs.rs @@ -581,7 +581,7 @@ fn field_default_expr(field: &Field, container_has_default: bool) -> Option<Toke quote...
1
1
1
f0d2b1c50c292859b47653eb12229e4f29010cef
timando
2021-11-25T21:42:25
Add support for rust_decimal and bigdecimal (#101)
diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index 993f126..013c0d6 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -26,6 +26,8 @@ smallvec = { version = "1.0", optional = true } arrayvec = { version = "0.5", default-features = false, optional = true } url = { version = "2.0", default-features...
3
35
0
de7314f30560c274c19694b6e0403bc2bc8703d8
Graham Esau
2021-09-20T15:48:16
Allow empty #[validate] attributes. Fixes #109
diff --git a/schemars/tests/validate.rs b/schemars/tests/validate.rs index c2060e0..c8b6809 100644 --- a/schemars/tests/validate.rs +++ b/schemars/tests/validate.rs @@ -42,6 +42,7 @@ pub struct Struct { #[validate(required)] required_option: Option<bool>, #[validate(required)] + #[validate] #[ser...
3
10
4
af69a8ea11905ff8496f67d3052074cc44d962ad
Graham Esau
2021-04-24T12:43:45
Fix doc test
diff --git a/schemars/src/schema.rs b/schemars/src/schema.rs index d358a44..01fce86 100644 --- a/schemars/src/schema.rs +++ b/schemars/src/schema.rs @@ -531,14 +531,16 @@ impl<T: PartialEq> SingleOrVec<T> { /// # Examples /// /// ``` - /// let s = SingleOrVec::Single(10); + /// use schemars::schema...
1
7
5
d99a96fc8aa7e8cd546ed0cd8b86e4b6f1d9857f
Graham Esau
2021-04-24T10:46:07
Add some doc comments
diff --git a/schemars/src/_private.rs b/schemars/src/_private.rs index 1799f41..b914699 100644 --- a/schemars/src/_private.rs +++ b/schemars/src/_private.rs @@ -6,12 +6,11 @@ use crate::JsonSchema; // Helper for generating schemas for flattened `Option` fields. pub fn json_schema_for_flatten<T: ?Sized + JsonSchema>( ...
4
22
11
5f841f2e5ce9e8179dca58b2852ef11626c8af4c
Graham Esau
2021-04-16T15:53:15
Refactoring
diff --git a/schemars_derive/src/attr/mod.rs b/schemars_derive/src/attr/mod.rs index 10ed772..93f76c5 100644 --- a/schemars_derive/src/attr/mod.rs +++ b/schemars_derive/src/attr/mod.rs @@ -5,6 +5,7 @@ mod validation; pub use schemars_to_serde::process_serde_attrs; pub use validation::ValidationAttrs; +use crate::me...
4
118
102
4be21bd8119a0a229328c2ba44a5954344ec7781
Graham Esau
2021-04-16T13:23:10
Refactor out "local_id" for type definitions
diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs index 5325f92..5fa4ac2 100644 --- a/schemars_derive/src/lib.rs +++ b/schemars_derive/src/lib.rs @@ -51,7 +51,7 @@ fn derive_json_schema( let (impl_generics, ty_generics, where_clause) = cont.generics.split_for_impl(); if let Some(transpare...
2
19
22
55b860428e4526ef34886cb877af58256de6b046
Graham Esau
2021-04-15T12:34:04
Refactory of private functions
diff --git a/schemars/src/_private.rs b/schemars/src/_private.rs new file mode 100644 index 0000000..4d1c31f --- /dev/null +++ b/schemars/src/_private.rs @@ -0,0 +1,49 @@ +use crate::flatten::Merge; +use crate::gen::SchemaGenerator; +use crate::schema::{Metadata, Schema, SchemaObject}; +use crate::JsonSchema; + +// Hel...
8
74
87
2d38db903a3811ffefd5ded2cd558f6d2687fc3f
Graham Esau
2021-04-10T13:48:39
Only process "crate" from schemars attr, not serde attr
diff --git a/schemars_derive/src/attr/mod.rs b/schemars_derive/src/attr/mod.rs index 04c89fe..d36568d 100644 --- a/schemars_derive/src/attr/mod.rs +++ b/schemars_derive/src/attr/mod.rs @@ -128,7 +128,7 @@ impl Attrs { } } - Meta(NameValue(m)) if m.path.is_ident("cr...
1
1
1
9c68e080d6f78ab4bec47fecd37e5616b19d1ec6
Graham Esau
2021-04-05T19:47:03
Remove extraneous "and" from tuple schema names
diff --git a/schemars/src/json_schema_impls/tuple.rs b/schemars/src/json_schema_impls/tuple.rs index d9e8971..383f839 100644 --- a/schemars/src/json_schema_impls/tuple.rs +++ b/schemars/src/json_schema_impls/tuple.rs @@ -9,7 +9,9 @@ macro_rules! tuple_impls { no_ref_schema!(); fn sch...
1
3
1
dada8582eecd2f1959616c6a6fd6091cae8bddeb
Graham Esau
2021-03-27T10:34:39
Fix rustc 1.37 build
diff --git a/schemars_derive/src/metadata.rs b/schemars_derive/src/metadata.rs index 2036571..435469a 100644 --- a/schemars_derive/src/metadata.rs +++ b/schemars_derive/src/metadata.rs @@ -35,8 +35,8 @@ impl ToTokens for SchemaMetadata<'_> { impl<'a> SchemaMetadata<'a> { pub fn from_attrs(attrs: &'a Attrs) -> Sel...
1
4
3
ce4946afc1e7c8bfc3c29fe12cdda6ed767a2548
Graham Esau
2021-03-26T22:55:20
Remove unnecessary macro usage
diff --git a/schemars/src/json_schema_impls/url.rs b/schemars/src/json_schema_impls/url.rs index 408146a..ffc5426 100644 --- a/schemars/src/json_schema_impls/url.rs +++ b/schemars/src/json_schema_impls/url.rs @@ -3,28 +3,19 @@ use crate::schema::*; use crate::JsonSchema; use url::Url; -macro_rules! formatted_string...
2
13
21
d85eec3b7aafb468c35d84478c6943b52a51516e
Jan Michael Auer
2021-03-21T18:31:58
Fix clippy field_reassign_with_default in generated code (#65)
diff --git a/schemars_derive/src/metadata.rs b/schemars_derive/src/metadata.rs index 6bc415d..cdbe22d 100644 --- a/schemars_derive/src/metadata.rs +++ b/schemars_derive/src/metadata.rs @@ -22,9 +22,10 @@ impl ToTokens for SchemaMetadata<'_> { } else { tokens.extend(quote! { Some({...
1
11
10