Commit graph

530 commits

Author SHA1 Message Date
Graham Esau
e0c2c31dc9 Update changelog for 1.0.0-alpha.2 2024-06-05 21:22:25 +01:00
Graham Esau
3150f98fc8 v1.0.0-alpha.2 2024-06-05 21:15:16 +01:00
Graham Esau
840315b2dd
Add #[schemars(extend("key" = value))] attribute (#297) 2024-06-05 21:09:52 +01:00
Graham Esau
3271fbd96a Update changelog for 1.0.0-alpha.1 2024-05-27 15:16:20 +01:00
Graham Esau
a20c197b99
Update readme - link to v1 branch/PR 2024-05-27 14:31:03 +01:00
Graham Esau
97b70aa82c Update readme for v1 2024-05-27 14:25:45 +01:00
Graham Esau
3ee7c7f5e5 v1.0.0-alpha.1 2024-05-27 11:14:43 +01:00
Graham Esau
760403e2f5 Update doc comments and make SchemaGenerator available from crate root 2024-05-27 11:09:15 +01:00
Graham Esau
fb6e1a5c61 Regenerate example schemas 2024-05-26 21:22:48 +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
fe05631f21 impl JsonSchema for Schema 2024-05-23 17:44:50 +01:00
Graham Esau
1819dceb24 Merge branch 'master' into v1 2024-05-23 17:31:52 +01:00
Graham Esau
5e20a37a1a v0.8.21 2024-05-23 17:26:07 +01:00
Graham Esau
a9a9c7e8ed
Fix "null" default not being set on schema (#296)
Fixes #295
2024-05-23 17:25:07 +01:00
Graham Esau
1247b8975e 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 `Visitor` would NOT.
2024-05-23 14:14:42 +01:00
Graham Esau
d32231c082 Allow running visitors against pre-2020-12 schemas 2024-05-20 15:25:16 +01:00
Graham Esau
3aa0e7fa3c
Support JSON Schema draft 2020-12 and use it by default (#294) 2024-05-19 20:49:45 +01:00
Graham Esau
95475ad1b4 Use $defs instead of definitions in draft 2019-09
This also changes the strategy for running visitors on subschemas - it is now done eagerly, as soon as they're added to the definitions map.
2024-05-19 18:07:51 +01:00
Graham Esau
22e89a5dd6 Never add a field with the default attribute to a schema's required properties 2024-05-18 23:00:24 +01:00
Graham Esau
7ecaa7feab
Revert unintentional change in behaviour when combining default and required attributes (#293)
Never add a field with the `default` attribute to a schema's `required` properties
2024-05-18 22:37:40 +01:00
Graham Esau
d3b6ff5aeb Re-add preserve_order feature, to preserve order of struct fields in a schema's properties 2024-05-18 21:55:05 +01:00
Graham Esau
c4d42ec11a Refactor flatten and move it to _private, remove TempFixupForTests, regenerate test schemas 2024-05-13 22:02:32 +01:00
Graham Esau
18300c67bb
Use const instead of single-valued enum (#291) 2024-05-13 21:30:51 +01:00
Graham Esau
cf5be1b266 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.
2024-05-13 21:29:16 +01:00
Graham Esau
8c2c32bce0 Regenerate example schemas 2024-05-13 18:33:55 +01:00
Graham Esau
f5d2142714 Regenerate test schemas 2024-05-13 18:33:48 +01:00
Graham Esau
4dde683358 Update OpenAPI 3.0 schema URI 2024-05-13 18:17:21 +01:00
Graham Esau
dec3c67e87 Remove test schemas for now-removed RootSchema 2024-05-13 17:58:09 +01:00
Graham Esau
efff7e2606 Merge branch 'master' into v1 2024-05-13 17:55:02 +01:00
Graham Esau
449bb1a0ca Add more tests for different schema settings
This is mainly to keep this coverage around in v1, where the `schema_for_schema` tests are no longer viable
2024-05-13 17:53:56 +01:00
Graham Esau
b87b6ebb6c Remove usage of is_some_and (not supported in rustc 1.60) 2024-05-13 10:56:55 +01:00
Graham Esau
3b3870ca82 Simplify flatten
No longer use it for internally-tagged enums. Instead, use a private helper that adds the tag property.
2024-05-13 10:52:42 +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
7f6a7b7e32 Typo in changelog 2024-05-06 18:17:37 +01:00
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
df00e2fd71 Add comment explaining why we double-parse an Expr 2024-04-28 18:59:42 +01:00
Graham Esau
bbedf130ce Include Cargo.lock file in git
This should make builds (especially for MSRV) much more stable, at the cost of no longer testing schemars compatibility with new dependency versions.
2024-04-28 18:56:06 +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
ae9544aaf9 Put schema value into a variable before calling apply_metadata
This reduces size of MIR output, which should somewhat mitigate #246
2023-11-11 20:28:10 +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