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
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
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
Matt Campbell
d059686da8
Implement JsonSchema on EnumSet type
2021-10-10 18:49:34 +01:00
Adam Leventhal
0a1200baac
Use oneOf for enums when possible ( #108 )
2021-09-26 18:02:44 +01:00
Graham Esau
de7314f305
Allow empty #[validate] attributes.
...
Fixes #109
2021-09-20 16:48:16 +01:00
Graham Esau
605db3bba8
Emit compilation errors for duplicate validation attributes
2021-09-17 23:04:37 +01:00
Graham Esau
7914593d89
Allow setting validation attributes via #[schemars(...)]
2021-04-18 22:17:53 +01:00
Graham Esau
c013052f59
Support inline regex
2021-04-16 22:31:03 +01:00
Graham Esau
9e507272da
Process validation attributes in tuple structs
2021-04-16 13:56:26 +01:00
Graham Esau
31a5893d10
Process validation attributes in newtype structs
2021-04-16 12:30:52 +01:00
Graham Esau
60a9869448
Refactor out add_schema_as_property
2021-04-16 10:42:03 +01:00
Graham Esau
1a2dafc1a5
Handle required flattened Option fields
2021-04-15 18:11:28 +01:00
Graham Esau
b68132f17d
Merge branch 'master' into validate
2021-04-15 16:08:10 +01:00
Graham Esau
5dc644000c
Allow schema_with attr on enum variants
2021-04-10 15:16:16 +01:00
Graham Esau
9e2ba85772
Also implement JsonSchema for BytesMut
2021-04-05 21:02:49 +01:00
Daniel Hahne
0e3938798f
Support Bytes ( #68 )
2021-04-05 21:02:32 +01:00
Graham Esau
b2b733ba5c
Support for #[schemars(crate = "...")] ( #80 )
2021-04-05 19:34:28 +01:00
Graham Esau
ebd7ff32ce
More fixes for deriving JsonSchema inside macro
2021-04-05 16:40:20 +01:00
Graham Esau
4d3400152e
Fix deriving JsonSchema inside macro ( #79 )
2021-04-05 16:15:34 +01:00
Graham Esau
6ab567f3a5
Read #[validate(...)] attributes
2021-03-29 16:38:55 +01:00
Alastair Feille
f0836d4415
Implement JsonSchema on Url
2021-03-26 23:00:20 +00:00
Graham Esau
11d95b79e5
Derive JsonSchema_repr ( #76 )
2021-03-25 22:36:28 +00:00
Graham Esau
04996efeb3
Don't include number format in schema for value
...
Guessing the format for serde_json::Number can be very misleading, so let's not
2021-03-25 19:47:36 +00:00
Graham Esau
f6482fd460
Generate schema from any serializable value ( #75 )
...
Implement schema_for_value!(...) macro
2021-03-25 18:32:28 +00:00
Graham Esau
7bcd6a2a65
Ensure pending_schema_names is always cleaned up
2021-03-21 21:47:46 +00:00
Graham Esau
1017506ce6
Prevent stack overflow when using inline_subschemas
2021-03-21 20:27:38 +00:00
Alastair Feille
addac6d386
Make HashSet and BTreeSet use the uniqueItems keyword in their schema ( #64 )
...
Co-authored-by: Graham Esau <gesau@hotmail.co.uk>
2021-03-21 14:43:58 +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
6a3bba1e86
Set additionalProperties to false on enums where appropriate
2021-03-20 18:45:29 +00:00
Alexander Berger
364d0e0192
Add support to enforce inlining of all subschemas instead of using references. ( #44 )
...
This is needed to support use cases like openAPIV3Schema in Kubernetes CustomResourceDefinitions.
Co-authored-by: alex.berger@nexiot.ch <alex.berger@nexiot.ch>
2020-09-25 18:50:54 +01:00
Graham Esau
5ddd44a9e5
Regenerate all test expected outputs
...
Properties are now in a different order due to the preserve_order feature flag
2020-09-24 20:47:46 +01:00
Graham Esau
ac8dd4c368
Fix build (hopefully)
2020-09-21 08:46:28 +01:00
Graham Esau
5ca2d08013
Bump MSRV to 1.36.0
2020-09-21 08:42:07 +01:00
Graham Esau
4197bf4183
Add test for invalid schemars attributes
2020-06-05 17:18:48 +01:00
Graham Esau
a829267111
Add Visitor trait, update changelog
2020-06-04 19:23:36 +01:00
Graham Esau
e259955809
Attribute for defining examples ( #23 )
2020-05-17 16:41:19 +01:00
Graham Esau
1b42dc7e3e
Allow overriding title/desc from doc comments ( #13 )
2020-05-17 11:19:48 +01:00
Graham Esau
5a28cef598
Respect #[serde(transparent)] attribute ( #17 )
2020-05-16 21:16:59 +01:00
Graham Esau
509a1c3b7b
Check for #[deprecated] attributes
2020-05-16 16:44:44 +01:00
Denis Kurilov
1190b1fad9
additionalProperties: false
for struct annotated with serde deny_unknown_fields
(#30 )
...
Co-authored-by: Denis Kurilov <denis@routinghub.com>
2020-05-16 12:02:47 +01:00
Graham Esau
ea351f3b42
Set type on enum schemas ( #28 )
2020-05-16 10:41:30 +01:00
Graham Esau
3fd316063a
schema_with
attribute
2020-05-15 17:11:28 +01:00
Graham Esau
b1ded882b7
More refactoring of proc macro...
2020-05-11 21:53:36 +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