Graham Esau
760403e2f5
Update doc comments and make SchemaGenerator
available from crate root
2024-05-27 11:09:15 +01:00
Graham Esau
f8b56cb455
Replace is_referenceable()
with always_inline_schema()
2024-05-26 16:51:42 +01:00
Graham Esau
1aaa162e0b
Make schema_name()
return Cow<'static, str>
instead of String
2024-05-26 15:20:56 +01:00
Graham Esau
342cd5fd09
Define Schema
as a newtype around serde_json::Value
( #289 )
2024-05-12 19:23:54 +01:00
Graham Esau
9501fe319f
Update to syn 2 and serde_derive_internals 0.29
2024-04-28 18:56:06 +01:00
Graham Esau
342b2dff33
Add schema_id(), handles different types with the same name ( #247 )
2023-09-17 20:36:52 +01:00
Graham Esau
37478d764e
Support types with const generics ( #239 )
...
Co-authored-by: Spencer Sharkey <spsharkey@tesla.com>
2023-08-27 20:50:20 +01:00
Graham Esau
39bae201eb
Run cargo fmt
2023-02-26 19:47:10 +00:00
Graham Esau
104dccca50
Add #[schemars(bound = ...)] attribute
...
Based on https://github.com/GREsau/schemars/pull/162
Co-authored-by: teozkr <teo@nullable.se>
2022-10-02 19:46:29 +01:00
Graham Esau
4be21bd811
Refactor out "local_id" for type definitions
2021-04-16 14:23:10 +01:00
Graham Esau
b68132f17d
Merge branch 'master' into validate
2021-04-15 16:08:10 +01:00
Graham Esau
55b860428e
Refactory of private functions
2021-04-15 13:34:04 +01:00
Graham Esau
5dc644000c
Allow schema_with attr on enum variants
2021-04-10 15:16:16 +01:00
Graham Esau
b2b733ba5c
Support for #[schemars(crate = "...")] ( #80 )
2021-04-05 19:34:28 +01:00
Graham Esau
6ab567f3a5
Read #[validate(...)] attributes
2021-03-29 16:38:55 +01:00
Graham Esau
29dc025629
Clippy fixes
2021-03-27 00:45:06 +00:00
Graham Esau
11d95b79e5
Derive JsonSchema_repr ( #76 )
2021-03-25 22:36:28 +00:00
David Hotham
c4ef7bad22
Fix #[schemars(with = ...)] alongside #[serde(transparent)] ( #67 )
...
Co-authored-by: Graham Esau <gesau@hotmail.co.uk>
2021-03-21 13:56:24 +00:00
Graham Esau
40d9bfd517
Forbid unsafe code
2020-09-25 18:34:57 +01:00
Graham Esau
be6cd1080d
Allow unused braces in macro output.
...
Fixes warnings in beta/nightly rustc
2020-05-17 17:22:42 +01:00
Graham Esau
5a28cef598
Respect #[serde(transparent)] attribute ( #17 )
2020-05-16 21:16:59 +01:00
Graham Esau
b1ded882b7
More refactoring of proc macro...
2020-05-11 21:53:36 +01:00
Graham Esau
70b5a1a2e6
Refactor of AST parsing
2020-05-10 22:09:15 +01:00
Graham Esau
08886799bb
Respect with
attributes on enum variants
2020-05-10 17:17:04 +01:00
Graham Esau
11b7a09c93
Enable deriving JsonSchema on adjacent tagged enums
...
Issue #4
2020-04-30 14:21:04 +01:00
Graham Esau
63af0ceb73
Fix skip_serializing_if/serialize_with handling
...
Previously whenever a field with a default value has both `skip_serializing_if` and `with`/`serialize_with` attributes, the value would be converted to a type that performs the custom serialization before checking if it should be serialized. This would cause the wrong type to be given to the skip_serializing_if function, causing a compile error.
Issue #26
2020-04-11 22:06:48 +01:00
Atsuki Takahashi
873ab3ae02
Specify full path for String ( #19 )
2020-03-24 18:05:37 +00:00
Graham Esau
4ad5000232
Make Option<T> fields optional in generated schemas ( #16 )
2020-02-29 19:37:20 +00:00
Graham Esau
58cc7fac25
Run cargo fmt
2019-12-29 22:09:54 +00:00
Graham Esau
781f40b061
Improve schema naming for deriving on remote types
2019-12-27 15:37:59 +00:00
Graham Esau
d30238c981
Do not pass container attributes through enums/variants
...
When deriving JsonSchema over a struct-style enum variant, do not apply the enum's container attributes to the variant. This couldn't cause any problems in practice because the only container attribute we explicitly set is "default", which cannot be set on an enum.
2019-12-23 20:50:26 +00:00
Graham Esau
b5e1821f3a
Don't include "doc" in list of helper attributes
2019-12-09 21:56:19 +00:00
Graham Esau
3fb625e08c
Refactoring of schemars_derive
2019-12-09 20:57:38 +00:00
Graham Esau
26c4099bbe
Do not serialize schema default if it would be skipped by skip_serializing_if
attribute
2019-12-09 12:34:28 +00:00
Graham Esau
9579d6a94c
Fix rustc 1.32.0 build
2019-12-08 22:34:48 +00:00
Graham Esau
4c4fb1cf36
Rewrite attribute parsing logic
2019-12-08 22:28:49 +00:00
Graham Esau
b748a90c3f
Respect serialize_with attr when serializing default
2019-12-08 20:04:54 +00:00
Graham Esau
7e23e2ad7a
Set "default" on generated schemas ( #6 )
2019-12-08 15:17:08 +00:00
Graham Esau
1e9f36122d
Minor refactoring/cleanup
2019-12-08 12:03:46 +00:00
Graham Esau
d92b741b9b
Get title/description from #[doc] on enum variants
2019-12-08 12:03:46 +00:00
Graham Esau
feefd418d4
Set schema title and description from #[doc]s
...
Work in progress
2019-12-08 12:03:46 +00:00
Graham Esau
60bfc6ee49
Make prepositions/conjunctions in generated schema names lowercase
2019-10-27 22:48:35 +00:00
Graham Esau
fba1753bba
Undo last change affecting internal tagged enums.
...
It broke things!
2019-10-22 22:58:24 +01:00
Graham Esau
792fbbb86e
Add more info to README
2019-10-22 22:49:24 +01:00
Graham Esau
18c2d417e3
Fix schema generation for flatten Options
2019-10-19 21:03:34 +01:00
Graham Esau
5bf8b30753
Schema generation now never returns an error
2019-10-19 20:33:26 +01:00
Graham Esau
2bc3957cb8
Set readOnly/writeOnly on properties
2019-10-14 20:00:57 +01:00
Graham Esau
c78d721fc5
Further reduce memory footprint of SchemaObject.
...
More fields are now wrapped in Option<Box<_>>, reducing size of JsonSchema (depending on system) from 424 to 240 bytes.
2019-10-13 22:38:20 +01:00
Graham Esau
72629a3c37
Reduce memory footprint of SchemaObject.
...
Nested validation structs are now wrapped in Option<Box<_>>, reducing size of JsonSchema (depending on system) from 688 to 424 bytes.
2019-10-13 20:42:29 +01:00
Graham Esau
7d162a8fb5
Update syn/quote/proc-macro2 to 1.0
2019-10-12 12:56:51 +01:00