Commit graph

324 commits

Author SHA1 Message Date
Graham Esau
8da70a4d45 v0.8.19 2024-05-06 18:13:54 +01:00
Graham Esau
1a40d1b06c Fix deriving JsonSchema on enum without variants
Fixes #287
2024-05-06 18:12:20 +01:00
Graham Esau
4b90b6f8c8 v0.8.18 2024-05-06 13:58:49 +01:00
Graham Esau
d04c17bda4
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>
2024-05-06 13:54:13 +01:00
Graham Esau
e5ef0f8d7b v0.8.17 2024-04-28 19:03:40 +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
e04e3a3a81 v0.8.16 2023-11-11 20:35:26 +00:00
Graham Esau
9415fcb57b v0.8.15 2023-09-17 21:13:54 +01:00
Graham Esau
a8d723342f Cleanup and test updates for bigdecimal04 2023-09-17 21:10:22 +01:00
Adam Chalmers
cc28738f41
Support bigdecimal 0.4 (#237) 2023-09-17 21:05:21 +01:00
Graham Esau
0084f1a655 v0.8.14 2023-09-17 20:56:13 +01:00
Graham Esau
6e3248f830 Fix bad merge 2023-09-17 20:53:10 +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
db1dd47039
Fix schemas for bigdecimal/rust_decimal (#248)
Both of these crates serialise decimals as strings, not as plain numbers
2023-09-17 20:31:24 +01:00
Jakub Jirutka
a5e51b22b3
Add #[schemars(inner(...)] attribute to specify schema for array items (#234) 2023-09-09 13:35:53 +01:00
Graham Esau
6931d70e0a v0.8.13 2023-08-28 21:19:01 +01:00
Graham Esau
e0c867cd6a Forward RawValue's JsonSchema impl to Value 2023-08-28 12:29:36 +01:00
Łukasz Biel
cb392d1829 Cover serde_json RawValue type by schemars 2023-08-28 12:29:36 +01:00
David Knaack
aeb989486e Add support for indexmap v2 2023-08-27 23:01:12 +01:00
Graham Esau
5dbfa49c5e Update MSRV to 1.60 2023-08-27 23:01:12 +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
0303f0334e
add support for semver crate (#238)
---------

Co-authored-by: Omar Tawfik <15987992+OmarTawfik@users.noreply.github.com>
2023-08-27 20:00:36 +01:00
Graham Esau
1ac9d19a24 Don't duplicate entire README in doc comment 2023-08-20 18:14:04 +01:00
Graham Esau
3d56977ecf Update to rust 2021 edition 2023-08-20 18:14:04 +01:00
Graham Esau
072730f6f6 Resolve clippy warnings 2023-08-20 18:14:04 +01:00
Graham Esau
e0495c0c87 Update MSRV to 1.56 2023-08-20 18:14:04 +01:00
Graham Esau
386e3d7f5a v0.8.12 2023-02-26 21:00:48 +00:00
Simon Warta
9dc816fafc 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)
2023-02-26 20:09:18 +00:00
Graham Esau
824993ca76 Apply clippy fixes 2023-02-26 19:59:17 +00:00
Graham Esau
39bae201eb Run cargo fmt 2023-02-26 19:47:10 +00:00
Gleb Pomykalov
587176fe9f
add optional smol_str support (#72)
Co-authored-by: Graham Esau <gesau@hotmail.co.uk>
2023-02-26 19:42:16 +00:00
Graham Esau
5268080b01 v0.8.11 2022-10-02 20:01:43 +01: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
Randy Barlow
6ada120cd3 Fix a typo
Signed-off-by: Randy Barlow <randy.barlow@deepgram.com>
2022-10-02 19:45:46 +01:00
Adam Leventhal
76427ef384
Fix handling of attributes applied to unit variant types (#152) 2022-08-12 15:37:34 +01:00
Graham Esau
9464118c3a v0.8.10 2022-05-17 18:33:47 +01:00
Graham Esau
d93bdc43e3 Revert "Support generic default values"
This feature inadvertently introduced a breaking change (#144)

This reverts commits: feb6c4b2fe
b38a55331b.
2022-05-17 18:17:17 +01:00
Graham Esau
1610294af4 v0.8.9 2022-05-16 22:41:14 +01:00
Graham Esau
74974d3e95
Support uuid v1 and arrayvec 0.7 (#142) 2022-05-16 22:39:48 +01:00
Graham Esau
043d794e39 Fix build warnings from tests
Deriving `Debug` is no longer enough to suppress warnings about unused fields
2022-05-15 22:55:10 +01:00
Graham Esau
85ed613e4a Remove unnecessary derives on test struct 2022-05-15 22:30:38 +01:00
Graeme Coupar
b38a55331b Support generic default values
I'm trying to `derive(JsonSchema)` on a field with a default that relies
on type inference to determine it's return type.  This causes compile
errors because schemars calls the default function without providing
any types for inference to use.

This changes that - wraps the `default` in a closure with a defined
return value that it immediately calls.  Feels a bit hacky, but I
couldn't think of a better way to fix this.
2022-05-15 22:30:38 +01:00
Graham Esau
e9d5f4057e v0.8.8 2021-11-25 22:28:38 +00:00
Adam H. Leventhal
98ad16288b Internally tagged enums don't honor deny_unknown_fields as precisely as
they might.

flatten doesn't act quite as intended with regard to
additional_properties
2021-11-25 21:55:48 +00:00
Graham Esau
d549957183 Document new optional dependencies 2021-11-25 21:42:54 +00:00
timando
f0d2b1c50c
Add support for rust_decimal and bigdecimal (#101) 2021-11-25 21:42:25 +00:00
Graham Esau
3cac0e5048 Add example for optional dependency in readme
Based on https://github.com/GREsau/schemars/pull/118/files
2021-11-25 21:12:30 +00:00
Graham Esau
1a13ba9f9b v0.8.7 2021-11-14 19:23:15 +00:00
Graham Esau
690fe44343 Allow non-Serialize default values.
Default values that don't implement Serialize are now ignored, rather than causing a compile error.
This is done by simulating specialization using a technique copied from Rocket:
5ebefa97c9/core/lib/src/sentinel.rs (L391-L445)

Fixes #115
2021-11-14 19:16:46 +00:00
Graham Esau
6f39a13724 Update examples after 0a1200b 2021-11-14 19:05:09 +00:00