Commit graph

138 commits

Author SHA1 Message Date
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
Graham Esau
5021204dfb Add examples schema keyword 2020-04-09 17:03:27 +01:00
Graham Esau
4ad5000232
Make Option<T> fields optional in generated schemas (#16) 2020-02-29 19:37:20 +00:00
Graham Esau
6bebd73701 Add test for allow_ref_siblings behaviour 2019-12-29 22:30:17 +00:00
Graham Esau
58cc7fac25 Run cargo fmt 2019-12-29 22:09:54 +00:00
Graham Esau
0198ede4b6 Add JSON Schema 2019-09 settings 2019-12-29 18:05:10 +00:00
Graham Esau
a97d54bcad Implement JsonSchema on smallvec + arrayvec types
Documentation still needs updating.
2019-12-28 20:11:38 +00:00
Graham Esau
008d70e52a Implement JsonSchema on Uuid 2019-12-27 22:41:28 +00:00
Graham Esau
fbd019baae Implement JsonSchema on Either 2019-12-27 22:16:01 +00:00
Graham Esau
fd42debc4d Implement JsonSchema on indexmap types 2019-12-27 21:44:50 +00:00
Graham Esau
781f40b061 Improve schema naming for deriving on remote types 2019-12-27 15:37:59 +00:00
Graham Esau
ea28450c30 Add test for remote deriving with generic types 2019-12-27 14:38:58 +00:00
Graham Esau
b5e1821f3a Don't include "doc" in list of helper attributes 2019-12-09 21:56:19 +00:00
Graham Esau
1f021fa5ae Format project with rustfmt 2019-12-09 17:37:49 +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
ae397b228d Do not use explicit #[doc] comments in test
This breaks the build on nightly
2019-12-08 22:47:33 +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
81eb53b590 Add test for defaults in derived schemas
Currently ignored as defaults are not yet implemented.
2019-12-08 13:12:09 +00:00
Graham Esau
89d3024beb Do not inline referenceable schemas to set nullable 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
a1c3daaed8 Join adjacent lines in descriptions from #[doc]s 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
5503f0697f Implement JsonSchema for Bound 2019-10-30 19:39:44 +00:00
Graham Esau
3f56d6b282 Give unsigned int schemas explicit minimum value
Update tests
2019-10-30 19:34:05 +00:00
Graham Esau
ae716de64a Give unsigned int schemas explicit minimum value 2019-10-30 19:28:11 +00:00
Graham Esau
50f00be97b Implement JsonSchema for nonzero signed ints 2019-10-29 21:40:50 +00:00
Graham Esau
60bfc6ee49 Make prepositions/conjunctions in generated schema names lowercase 2019-10-27 22:48:35 +00:00
Graham Esau
09d76c93e4 Schemas with different "format"s should have different names 2019-10-27 22:42:14 +00:00
Graham Esau
fe861ac3a1 Implement JsonSchema for Range/RangeInclusive 2019-10-27 22:30:01 +00:00
Graham Esau
be59422c13 Implement JsonSchema for CStr/CString 2019-10-27 19:41:25 +00:00
Graham Esau
c6a20764fe Implement JsonSchema for OsStr/OsString 2019-10-27 19:26:17 +00:00
Graham Esau
e11d5e5a98 Implement JsonSchema for std::time types 2019-10-27 18:57:36 +00:00
Graham Esau
155190c9ab Implement JsonSchema for Result<T,E> 2019-10-27 18:40:57 +00:00
Graham Esau
79e395d101 Set openapi3 meta-schema 2019-10-27 11:35:07 +00:00
Graham Esau
ec42b51bf5 Regenerate test expected outputs 2019-10-23 18:26:06 +01:00
Graham Esau
ef7ec38696 Introduce separate RootSchema type 2019-10-23 18:23:12 +01:00
Graham Esau
9a85e0b2a1 Start adding doc comments 2019-10-20 15:46:09 +01:00
Graham Esau
fb6bb85cb7 Remove JsonSchemaError/Result 2019-10-20 14:33:54 +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