commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
40d9bfd5177cc581f7e261c1806279eaf250eaa1 | Graham Esau | 2020-09-25T17:34:57 | Forbid unsafe code | diff --git a/schemars/src/lib.rs b/schemars/src/lib.rs
index 2eba2f9..bb189bb 100644
--- a/schemars/src/lib.rs
+++ b/schemars/src/lib.rs
@@ -1,3 +1,4 @@
+#![forbid(unsafe_code)]
/*!
Generate JSON Schema documents from Rust code
diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs
index 7697011..d50a... | 2 | 3 | 0 |
858543aca14b788d10ce3407b4ddecd568ac1ddf | Graham Esau | 2020-09-24T19:42:26 | Revert buggy refactor | diff --git a/schemars/src/visit.rs b/schemars/src/visit.rs
index af595bd..182b572 100644
--- a/schemars/src/visit.rs
+++ b/schemars/src/visit.rs
@@ -141,21 +141,21 @@ impl Visitor for ReplaceBoolSchemas {
}
fn visit_schema_object(&mut self, schema: &mut SchemaObject) {
- if !self.skip_additional_prop... | 1 | 12 | 12 |
ac8dd4c368d2df2b508396a0865c66ca3b9cb98f | Graham Esau | 2020-09-21T07:46:28 | Fix build (hopefully) | diff --git a/schemars/tests/nonzero_ints.rs b/schemars/tests/nonzero_ints.rs
index d282186..99478ce 100644
--- a/schemars/tests/nonzero_ints.rs
+++ b/schemars/tests/nonzero_ints.rs
@@ -1,6 +1,4 @@
mod util;
-
-use super::*;
use schemars::JsonSchema;
use util::*; | 1 | 0 | 2 |
7a1e02eefd1751077dc45a5aafab8c68271fb77c | Graham Esau | 2020-09-21T07:03:10 | Pin dyn-clone to v1.0.1
v1.0.2 relies on alloc so does not work in rustc 1.32 | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index de6c19b..60f091e 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -16,7 +16,7 @@ build = "build.rs"
schemars_derive = { version = "=0.8.0-alpha-4", optional = true, path = "../schemars_derive" }
serde = { version = "1.0", features = ["derive"] ... | 1 | 1 | 1 |
37f0e4bc712fc8c658eccc157cd941b965b95a9d | Graham Esau | 2020-06-12T20:38:21 | v0.8.0-alpha-4 | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index d43ce77..de6c19b 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -3,7 +3,7 @@ name = "schemars"
description = "Generate JSON Schemas from Rust code"
homepage = "https://graham.cool/schemars/"
repository = "https://github.com/GREsau/schemars"
... | 2 | 3 | 3 |
8f85178a7ae0dbb4b9b73b2c13c7e71986ca019b | Graham Esau | 2020-06-12T20:38:13 | Add SetSingleExample visitor for openapi 3.0 | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index 27616de..04992ab 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -79,6 +79,9 @@ impl SchemaSettings {
Box::new(ReplaceBoolSchemas {
skip_additional_properties: true,
}),
+ Box... | 2 | 29 | 0 |
a618a90eb4cf80171e6a276c6e305d8fb9dbd522 | Ralph Bisschops | 2020-06-07T21:24:36 | Adding `IndexMap` under feature flag `preserve_order` (#36) | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index 7d84eb6..cb727c9 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -19,7 +19,7 @@ serde_json = "1.0"
dyn-clone = "1.0"
chrono = { version = "0.4", default-features = false, optional = true }
-indexmap = { version = "1.2", optional = true }
+in... | 3 | 27 | 6 |
a02947462d6525154a4e9a4e1b0695d022d02a4d | Graham Esau | 2020-06-07T20:46:08 | Split Visitor into two traits | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index 7535084..a107e77 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -1,6 +1,8 @@
use crate::flatten::Merge;
use crate::schema::*;
use crate::{visit::*, JsonSchema, Map};
+use dyn_clone::DynClone;
+use std::{any::Any, fmt::Debug};
/// Settings... | 3 | 121 | 74 |
656a70e02c456e54557fbe16bc111926c65f2d08 | Graham Esau | 2020-06-05T22:51:54 | Allow mutable Visitors | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index ecdc923..7535084 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -236,7 +236,7 @@ impl SchemaGenerator {
schema,
};
- for visitor in &self.settings.visitors.0 {
+ for visitor in &mut self.settings.visitors.0... | 2 | 15 | 15 |
5b316fb31b4c97f6d889506447e108ed7996e2bc | Ferenc Tamás | 2020-06-05T22:45:17 | Removed Any bound from Visitor (#41) | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index 9579347..b3f02a9 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -101,7 +101,7 @@ impl SchemaSettings {
}
/// TODO document
- pub fn with_visitor(mut self, visitor: impl Visitor) -> Self {
+ pub fn with_visitor(mut self, visito... | 2 | 3 | 3 |
be6cd1080d61a65c27300ebc6304e184406e0ad3 | Graham Esau | 2020-05-17T16:22:42 | Allow unused braces in macro output.
Fixes warnings in beta/nightly rustc | diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs
index 006d78a..7697011 100644
--- a/schemars_derive/src/lib.rs
+++ b/schemars_derive/src/lib.rs
@@ -106,6 +106,7 @@ fn derive_json_schema(mut input: syn::DeriveInput) -> TokenStream {
quote! {
#[automatically_derived]
+ #[allow(... | 1 | 1 | 0 |
75419fa3d5fcbae112966957cee9280d8c40ef1e | Graham Esau | 2020-05-17T10:27:11 | Fix rustc 1.32 build | diff --git a/schemars_derive/src/metadata.rs b/schemars_derive/src/metadata.rs
index 88ee2df..4724223 100644
--- a/schemars_derive/src/metadata.rs
+++ b/schemars_derive/src/metadata.rs
@@ -33,8 +33,8 @@ impl ToTokens for SchemaMetadata<'_> {
impl<'a> SchemaMetadata<'a> {
pub fn from_attrs(attrs: &'a Attrs) -> Sel... | 1 | 3 | 3 |
42e3c8fd7f2172dd471ea1a313bd4c9b17dfeeb2 | Graham Esau | 2020-05-17T10:00:44 | Fix local build | diff --git a/schemars/src/lib.rs b/schemars/src/lib.rs
index fa545d9..0aad758 100644
--- a/schemars/src/lib.rs
+++ b/schemars/src/lib.rs
@@ -231,6 +231,8 @@ pub mod gen;
/// JSON Schema types.
pub mod schema;
+#[cfg(feature = "schemars_derive")]
+extern crate schemars_derive;
#[cfg(feature = "schemars_derive")]
p... | 1 | 2 | 0 |
f47bb24ddf107c5e96d21325080375a0b8fa2988 | Graham Esau | 2020-05-16T11:25:05 | Fix error in doc comment (copy-paste fail!) | diff --git a/schemars/src/lib.rs b/schemars/src/lib.rs
index 377f31f..b529a8f 100644
--- a/schemars/src/lib.rs
+++ b/schemars/src/lib.rs
@@ -111,9 +111,9 @@ use schemars::{schema_for, JsonSchema};
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, JsonSchema)]
-#[serde(rename_all = "camelCase")]
... | 1 | 2 | 2 |
bfb3f062539e0e0926aeade0e578596a484d2b8d | Graham Esau | 2020-05-16T11:10:54 | Avoid setting ObjectValidation unnecessarily | diff --git a/schemars_derive/src/schema_exprs.rs b/schemars_derive/src/schema_exprs.rs
index ec1a5a5..72c6694 100644
--- a/schemars_derive/src/schema_exprs.rs
+++ b/schemars_derive/src/schema_exprs.rs
@@ -362,8 +362,14 @@ fn expr_for_struct(fields: &[Field], cattrs: Option<&serde_attr::Container>) ->
})
... | 1 | 9 | 10 |
9d951b34ce3925550cf5051b41fe3e8b6da19496 | Graham Esau | 2020-05-12T20:19:43 | Fix rustc 1.32 build | diff --git a/schemars_derive/src/ast/mod.rs b/schemars_derive/src/ast/mod.rs
index 9688878..e0ac3fc 100644
--- a/schemars_derive/src/ast/mod.rs
+++ b/schemars_derive/src/ast/mod.rs
@@ -73,7 +73,7 @@ impl<'a> Field<'a> {
match &self.attrs.with {
None => self.ty,
Some(WithAttr::Type(ty)... | 1 | 1 | 1 |
780c7286a66334524c1944f85a4a097b7e01fa01 | Graham Esau | 2020-05-12T20:17:34 | Refactor attribute parsing to make it more extensible | diff --git a/schemars_derive/src/ast/from_serde.rs b/schemars_derive/src/ast/from_serde.rs
index 416f209..60d2898 100644
--- a/schemars_derive/src/ast/from_serde.rs
+++ b/schemars_derive/src/ast/from_serde.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::attr::get_with_from_attrs;
+use crate::attr::Attrs;
use serde_deriv... | 4 | 172 | 46 |
631120ead8e6bddf0c51d7a9007fd9b6481eda7b | Graham Esau | 2020-05-10T21:16:17 | Fix rustc 1.32 build | diff --git a/schemars_derive/src/ast/from_serde.rs b/schemars_derive/src/ast/from_serde.rs
index eb91b48..416f209 100644
--- a/schemars_derive/src/ast/from_serde.rs
+++ b/schemars_derive/src/ast/from_serde.rs
@@ -36,11 +36,11 @@ impl<'a> FromSerde for Data<'a> {
fn from_serde(errors: &Ctxt, serde: Self::SerdeTyp... | 1 | 4 | 4 |
70b5a1a2e663779c3d6905000709d0a36ad6f9e5 | Graham Esau | 2020-05-10T21:09:15 | Refactor of AST parsing | diff --git a/schemars_derive/src/ast/from_serde.rs b/schemars_derive/src/ast/from_serde.rs
new file mode 100644
index 0000000..eb91b48
--- /dev/null
+++ b/schemars_derive/src/ast/from_serde.rs
@@ -0,0 +1,76 @@
+use super::*;
+use crate::attr::get_with_from_attrs;
+use serde_derive_internals::ast as serde_ast;
+use serd... | 4 | 197 | 76 |
0920fe8fd71eca6b3f805536efab36bbc177568a | Graham Esau | 2020-04-11T21:12:22 | Fix rustc 1.32 build | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index 41e9641..81a9c7a 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -350,7 +350,7 @@ impl SchemaGenerator {
pub fn apply_metadata(&self, schema: Schema, metadata: Option<Metadata>) -> Schema {
match metadata {
None => ret... | 1 | 1 | 1 |
873ab3ae027c81afbb85059fdd1ba88b86cef3dc | Atsuki Takahashi | 2020-03-24T18:05:37 | Specify full path for String (#19) | diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs
index 98e3810..c94a74b 100644
--- a/schemars_derive/src/lib.rs
+++ b/schemars_derive/src/lib.rs
@@ -81,7 +81,7 @@ pub fn derive_json_schema(input: proc_macro::TokenStream) -> proc_macro::TokenSt
let impl_block = quote! {
#[automatically_... | 1 | 1 | 1 |
3e1ab76c21329ec9c0bc1eaf3d9af0a439ff2ec7 | Graham Esau | 2020-02-29T23:36:39 | Parse types as syn::Type, not syn::ExprPath.
#[schemars(with= "()")] should now work! | diff --git a/schemars_derive/src/attr/mod.rs b/schemars_derive/src/attr/mod.rs
index 2c11908..6330fa7 100644
--- a/schemars_derive/src/attr/mod.rs
+++ b/schemars_derive/src/attr/mod.rs
@@ -7,7 +7,7 @@ pub use schemars_to_serde::process_serde_attrs;
use proc_macro2::{Group, Span, TokenStream, TokenTree};
use syn::pars... | 1 | 1 | 1 |
d7c92223301492c5d23322f2a944a858ba06786c | Graham Esau | 2020-02-29T19:57:34 | Refactor apply_metadata() to remove clone | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index 17fed1d..e0aa203 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -343,10 +343,12 @@ impl SchemaGenerator {
}
}
- // TODO should this take a Schema instead of SchemaObject?
- pub(crate) fn apply_metadata(&self, schema: &mut ... | 3 | 10 | 13 |
1605a8a34da89cfa18c98c7a85e129797984d016 | Graham Esau | 2019-12-29T18:45:55 | Small refactor | diff --git a/docs/_includes/examples/custom_settings.rs b/docs/_includes/examples/custom_settings.rs
index 8c90980..335daf3 100644
--- a/docs/_includes/examples/custom_settings.rs
+++ b/docs/_includes/examples/custom_settings.rs
@@ -8,19 +8,16 @@ pub struct MyStruct {
}
#[derive(JsonSchema)]
-pub enum MyEnum {
... | 2 | 20 | 26 |
233b1a41658cdd25ac7f26450e9ad4561d8c4063 | Graham Esau | 2019-12-29T14:45:23 | Add private field to SchemaSettings to prevent struct initialization.
This means future additions to SchemaSettings will not be breaking changes. | diff --git a/schemars/examples/custom_settings.rs b/schemars/examples/custom_settings.rs
index 8c90980..335daf3 100644
--- a/schemars/examples/custom_settings.rs
+++ b/schemars/examples/custom_settings.rs
@@ -8,19 +8,16 @@ pub struct MyStruct {
}
#[derive(JsonSchema)]
-pub enum MyEnum {
+pub enum MyEnum {
... | 4 | 41 | 27 |
40f459603a95d0075b5f4abcbac65179d5333e65 | Graham Esau | 2019-12-27T16:47:50 | Add link to website | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index 4f4f082..1b1adcc 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -1,6 +1,7 @@
[package]
name = "schemars"
description = "Generate JSON Schemas from Rust code"
+homepage = "https://graham.cool/schemars/"
repository = "https://github.com/GREsa... | 2 | 2 | 0 |
d30238c981aeb31bf0572aa6ca747618b346a144 | Graham Esau | 2019-12-23T20:50:26 | 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 enu... | diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs
index 51d31c1..0ac5e6d 100644
--- a/schemars_derive/src/lib.rs
+++ b/schemars_derive/src/lib.rs
@@ -35,7 +35,7 @@ pub fn derive_json_schema(input: proc_macro::TokenStream) -> proc_macro::TokenSt
Data::Struct(Style::Unit, _) => schema_for_unit... | 1 | 13 | 17 |
fc592e5dd7c40fca93abb34b016c893958afe750 | Graham Esau | 2019-12-16T21:36:20 | Ensure root schemas do not have a $ref property.
If necessary, wrap the `$ref` in an `allOf`. | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index 4f2d301..d0faf02 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -231,7 +231,8 @@ impl SchemaGenerator {
/// add them to the `SchemaGenerator`'s schema definitions and include them in the returned `SchemaObject`'s
/// [`definitions`](.... | 1 | 4 | 2 |
b5e1821f3a4147ed97c5bec66a1f81634e3bf57c | Graham Esau | 2019-12-09T21:56:19 | Don't include "doc" in list of helper attributes | diff --git a/schemars/tests/docs.rs b/schemars/tests/docs.rs
index 5f5081e..bcbb513 100644
--- a/schemars/tests/docs.rs
+++ b/schemars/tests/docs.rs
@@ -23,10 +23,10 @@ pub struct MyStruct {
#[derive(Debug, JsonSchema)]
pub struct MyUnitStruct;
-/// # This is the enum's title
-/// This is
+#[doc = " # This is the e... | 2 | 4 | 4 |
3fb625e08c27793a38fcc8a0a27e1faaae4cf44d | Graham Esau | 2019-12-09T20:57:38 | Refactoring of schemars_derive | diff --git a/schemars_derive/src/doc_attrs.rs b/schemars_derive/src/attr/doc.rs
similarity index 72%
rename from schemars_derive/src/doc_attrs.rs
rename to schemars_derive/src/attr/doc.rs
index aea190c..26a5090 100644
--- a/schemars_derive/src/doc_attrs.rs
+++ b/schemars_derive/src/attr/doc.rs
@@ -1,13 +1,13 @@
use sy... | 5 | 152 | 138 |
dca9e2d920af5145adb702919be2e93d7f54623d | Graham Esau | 2019-12-09T18:43:43 | Pass fewer attributes to serde_derive_internals | diff --git a/schemars_derive/src/preprocess.rs b/schemars_derive/src/preprocess.rs
index 008b605..34a71d5 100644
--- a/schemars_derive/src/preprocess.rs
+++ b/schemars_derive/src/preprocess.rs
@@ -1,30 +1,30 @@
use quote::ToTokens;
use serde_derive_internals::Ctxt;
-use std::collections::BTreeSet;
+use std::collectio... | 1 | 16 | 16 |
1f021fa5ae4f18b871d0b7915fddbbf68f6eca6a | Graham Esau | 2019-12-09T17:37:49 | Format project with rustfmt | diff --git a/schemars/examples/main.rs b/schemars/examples/main.rs
index cc02a51..851cf0a 100644
--- a/schemars/examples/main.rs
+++ b/schemars/examples/main.rs
@@ -10,7 +10,7 @@ pub struct MyStruct {
#[derive(JsonSchema)]
pub enum MyEnum {
Unit,
- StringNewType(String)
+ StringNewType(String),
}
fn ma... | 6 | 13 | 9 |
e4d69f89e7261e8d3aa6470566c4d30b127a7bb7 | Graham Esau | 2019-12-09T13:07:39 | v0.6.0-alpha-2 | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index 23c99b2..9ced40e 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -2,7 +2,7 @@
name = "schemars"
description = "Generate JSON Schemas from Rust code"
repository = "https://github.com/GREsau/schemars"
-version = "0.6.0-alpha"
+version = "0.6.0-... | 2 | 3 | 3 |
8301a38b8f367788cead5d6764bd02ef550f0b01 | Graham Esau | 2019-12-09T11:44:00 | v0.6.0-alpha | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index a15ca10..23c99b2 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -2,7 +2,7 @@
name = "schemars"
description = "Generate JSON Schemas from Rust code"
repository = "https://github.com/GREsau/schemars"
-version = "0.6.0-doc"
+version = "0.6.0-al... | 2 | 3 | 3 |
ae397b228d682631adf70a2fb380501bc0775020 | Graham Esau | 2019-12-08T22:47:33 | Do not use explicit #[doc] comments in test
This breaks the build on nightly | diff --git a/schemars/tests/docs.rs b/schemars/tests/docs.rs
index bcbb513..5f5081e 100644
--- a/schemars/tests/docs.rs
+++ b/schemars/tests/docs.rs
@@ -23,10 +23,10 @@ pub struct MyStruct {
#[derive(Debug, JsonSchema)]
pub struct MyUnitStruct;
-#[doc = " # This is the enum's title "]
-#[doc = " This is "]
+/// # T... | 1 | 3 | 3 |
9579d6a94ce3d07f30b4eb77c9d221db6ca9cddc | Graham Esau | 2019-12-08T22:34:48 | Fix rustc 1.32.0 build | diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs
index 84409d4..a795f6a 100644
--- a/schemars_derive/src/lib.rs
+++ b/schemars_derive/src/lib.rs
@@ -411,13 +411,15 @@ fn get_with_from_attr(attr: &syn::Attribute) -> Option<syn::LitStr> {
_ => return None,
};
for nm in nested_metas ... | 1 | 9 | 7 |
1e9f36122dbc534757fb430c985cf43d6d20cf1c | Graham Esau | 2019-12-08T12:00:21 | Minor refactoring/cleanup | diff --git a/schemars_derive/src/doc_attrs.rs b/schemars_derive/src/doc_attrs.rs
index ba822e4..aea190c 100644
--- a/schemars_derive/src/doc_attrs.rs
+++ b/schemars_derive/src/doc_attrs.rs
@@ -14,14 +14,14 @@ pub fn get_title_and_desc_from_docs(attrs: &[Attribute]) -> (Option<String>, Opt
.trim_start_match... | 2 | 11 | 12 |
ba79de696a8a370e9a3d15f091a9c0b995d1f677 | Graham Esau | 2019-12-08T11:47:56 | Document SchemaGenerator.make_extensible() | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index 87ec2be..4f2d301 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -121,9 +121,29 @@ impl SchemaGenerator {
&self.settings
}
- // TODO document/rename
- #[doc(hidden)]
- pub fn objectify(&self, schema: SchemaObject) -> Sch... | 3 | 25 | 5 |
a1c3daaed8ea20007cee943983eb14f7d1caa4c4 | Graham Esau | 2019-12-07T23:05:55 | Join adjacent lines in descriptions from #[doc]s | diff --git a/schemars/tests/docs.rs b/schemars/tests/docs.rs
index 6877fd5..bcbb513 100644
--- a/schemars/tests/docs.rs
+++ b/schemars/tests/docs.rs
@@ -19,13 +19,14 @@ pub struct MyStruct {
}
/// # A Unit
+///
#[derive(Debug, JsonSchema)]
pub struct MyUnitStruct;
#[doc = " # This is the enum's title "]
-#[doc... | 2 | 32 | 21 |
feefd418d40c71e649ff24975af5fd8bf764fb73 | Graham Esau | 2019-12-07T22:14:23 | Set schema title and description from #[doc]s
Work in progress | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index 20d83bc..87ec2be 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -121,6 +121,22 @@ impl SchemaGenerator {
&self.settings
}
+ // TODO document/rename
+ #[doc(hidden)]
+ pub fn objectify(&self, schema: SchemaObject) -> Sch... | 6 | 262 | 47 |
1044718dbd1e54d8cbef1439eb8e162e0a5717ba | Graham Esau | 2019-10-30T22:11:53 | Add missing doc comment for "title" | diff --git a/schemars/src/schema.rs b/schemars/src/schema.rs
index b0f79f7..796e3df 100644
--- a/schemars/src/schema.rs
+++ b/schemars/src/schema.rs
@@ -213,6 +213,9 @@ pub struct Metadata {
/// See [JSON Schema 8.2.2. The "$id" Keyword](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.2.2).
... | 1 | 3 | 0 |
a35b4694754efe7c5cf3cfea22797381a9487316 | Graham Esau | 2019-10-29T11:25:01 | Implement JsonSchema for nonzero unsigned ints | diff --git a/schemars/src/json_schema_impls/mod.rs b/schemars/src/json_schema_impls/mod.rs
index 58b27c2..a505ecd 100644
--- a/schemars/src/json_schema_impls/mod.rs
+++ b/schemars/src/json_schema_impls/mod.rs
@@ -32,16 +32,17 @@ macro_rules! forward_impl {
}
mod array;
+#[cfg(std_atomic)]
+mod atomic;
#[cfg(featur... | 2 | 47 | 2 |
b334bef91a28f452431966ccf05ebc41acb797a6 | Graham Esau | 2019-10-27T21:24:29 | Implement JsonSchema for std::net types | diff --git a/schemars/src/json_schema_impls/core.rs b/schemars/src/json_schema_impls/core.rs
index ccdcd57..a0426e7 100644
--- a/schemars/src/json_schema_impls/core.rs
+++ b/schemars/src/json_schema_impls/core.rs
@@ -115,6 +115,18 @@ impl<T: ?Sized> JsonSchema for std::marker::PhantomData<T> {
}
}
+impl<'a> Jso... | 2 | 24 | 14 |
ebb7173dfc976b6b8b28a0513e14786b817c2d55 | Graham Esau | 2019-10-27T19:41:37 | Implement JsonSchema for fmt::Arguments | diff --git a/schemars/src/json_schema_impls/primitives.rs b/schemars/src/json_schema_impls/primitives.rs
index f5ab16d..a38a9fe 100644
--- a/schemars/src/json_schema_impls/primitives.rs
+++ b/schemars/src/json_schema_impls/primitives.rs
@@ -71,3 +71,15 @@ impl JsonSchema for char {
.into()
}
}
+
+impl<'a... | 1 | 12 | 0 |
be59422c13255c062dcfa762a813315f7b949329 | Graham Esau | 2019-10-27T19:41:25 | Implement JsonSchema for CStr/CString | diff --git a/schemars/src/json_schema_impls/os.rs b/schemars/src/json_schema_impls/ffi.rs
similarity index 71%
rename from schemars/src/json_schema_impls/os.rs
rename to schemars/src/json_schema_impls/ffi.rs
index ec4dcbf..027ded2 100644
--- a/schemars/src/json_schema_impls/os.rs
+++ b/schemars/src/json_schema_impls/ff... | 3 | 26 | 2 |
437b38dd8b354eb14412c3bfe91fe8303af816c8 | Graham Esau | 2019-10-27T19:32:47 | Implement JsonSchema for Path/PathBuf | diff --git a/schemars/src/json_schema_impls/primitives.rs b/schemars/src/json_schema_impls/primitives.rs
index 83abacd..f5ab16d 100644
--- a/schemars/src/json_schema_impls/primitives.rs
+++ b/schemars/src/json_schema_impls/primitives.rs
@@ -1,6 +1,7 @@
use crate::gen::SchemaGenerator;
use crate::schema::*;
use crate... | 1 | 3 | 0 |
e6c178117cb303e18c7031738a7c53b1ea1aa4f2 | Graham Esau | 2019-10-27T19:02:38 | Implement JsonSchema for Weak/Wrapping/Reverse | diff --git a/schemars/src/json_schema_impls/deref.rs b/schemars/src/json_schema_impls/deref.rs
deleted file mode 100644
index d836090..0000000
--- a/schemars/src/json_schema_impls/deref.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-use crate::gen::SchemaGenerator;
-use crate::schema::Schema;
-use crate::JsonSchema;
-
-macro_rules... | 3 | 44 | 40 |
ff90f96b2d837b719fadb7f630cfb709cc4122a5 | Graham Esau | 2019-10-27T11:50:05 | Remove JsonSchema impl for Infallible
This isn't used in serde, and requires rust 1.34+ | diff --git a/schemars/src/json_schema_impls/core.rs b/schemars/src/json_schema_impls/core.rs
index f0bf60c..1734ddb 100644
--- a/schemars/src/json_schema_impls/core.rs
+++ b/schemars/src/json_schema_impls/core.rs
@@ -85,18 +85,6 @@ impl<T: ?Sized> JsonSchema for std::marker::PhantomData<T> {
}
}
-impl JsonSchem... | 1 | 0 | 12 |
fba1753bba0cc447aeb9352a568f8fbd10319eba | Graham Esau | 2019-10-22T21:58:24 | Undo last change affecting internal tagged enums.
It broke things! | diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs
index 547cf3c..7aaee6e 100644
--- a/schemars_derive/src/lib.rs
+++ b/schemars_derive/src/lib.rs
@@ -199,7 +199,7 @@ fn schema_for_internal_tagged_enum<'a>(
let field = &variant.fields[0];
let ty = get_json_schema_type... | 1 | 1 | 1 |
5c307b92fb9233a01c027023ac26df55353e662c | Graham Esau | 2019-10-21T20:45:29 | Do not implement JsonSchema for internal types by default.
It will be implemented only if the derive_json_schema feature is enabled | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index 8d2f091..01580ad 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -19,9 +19,16 @@ chrono = { version = "0.4", default-features = false, optional = true }
[dev-dependencies]
pretty_assertions = "0.6.1"
+[features]
+derive_json_schema = []
+
[... | 2 | 30 | 13 |
67028aceed602963168faebb4b1cb4008f69c8ea | Graham Esau | 2019-10-21T18:04:16 | Add more doc comments | diff --git a/schemars/src/schema.rs b/schemars/src/schema.rs
index bfad05c..0d0ba7a 100644
--- a/schemars/src/schema.rs
+++ b/schemars/src/schema.rs
@@ -50,31 +50,55 @@ impl From<bool> for Schema {
}
}
+/// A JSON Schema object.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default, JsonSchema)]
#... | 1 | 30 | 0 |
aaeb46db0d1c17c2bb58fd3ec11e73a2501e6f60 | Graham Esau | 2019-10-20T21:34:25 | Add more doc comments | diff --git a/schemars/src/flatten.rs b/schemars/src/flatten.rs
index a34cb76..31524c4 100644
--- a/schemars/src/flatten.rs
+++ b/schemars/src/flatten.rs
@@ -2,6 +2,7 @@ use crate::schema::*;
use crate::{Map, Set};
impl Schema {
+ #[doc(hidden)]
pub fn flatten(self, other: Self) -> Schema {
if is_nu... | 3 | 199 | 11 |
9223ca1ed9625549a8103a85555e9c8da6265a70 | Graham Esau | 2019-10-20T18:36:49 | Add more doc comments | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index c04c842..e6d6af2 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -1,19 +1,38 @@
use crate::schema::*;
use crate::{JsonSchema, Map};
+/// Settings to customize how a Schema is generated.
#[derive(Debug, PartialEq, Clone)]
pub struct SchemaS... | 4 | 79 | 14 |
9a85e0b2a1888972fd8c436a405ceda5e4941a69 | Graham Esau | 2019-10-20T14:46:09 | Start adding doc comments | diff --git a/schemars/src/lib.rs b/schemars/src/lib.rs
index 7b6d644..d9ca37d 100644
--- a/schemars/src/lib.rs
+++ b/schemars/src/lib.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::large_enum_variant)]
-
pub type Map<K, V> = std::collections::BTreeMap<K, V>;
pub type Set<T> = std::collections::BTreeSet<T>;
@@ -8,22 +6,55 @@ ... | 4 | 49 | 2 |
317c317e950d6a1b2025341d559ebb04f15d8119 | Graham Esau | 2019-10-20T13:34:15 | Make schema_for macro pattern stricter | diff --git a/schemars/src/macros.rs b/schemars/src/macros.rs
index b6446f3..e2b611d 100644
--- a/schemars/src/macros.rs
+++ b/schemars/src/macros.rs
@@ -1,6 +1,6 @@
#[macro_export]
macro_rules! schema_for {
- ($($type:tt)+) => {
- $crate::gen::SchemaGenerator::default().into_root_schema_for::<$($type)+>()
+... | 1 | 2 | 2 |
fb6bb85cb7770a186d4e0e589542951a99f067a5 | Graham Esau | 2019-10-20T13:33:54 | Remove JsonSchemaError/Result | diff --git a/schemars/src/error.rs b/schemars/src/error.rs
deleted file mode 100644
index 8a0f59e..0000000
--- a/schemars/src/error.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-use crate::schema::Schema;
-use std::error::Error;
-use std::fmt;
-
-pub type Result<T> = std::result::Result<T, JsonSchemaError>;
-
-#[derive(Debug, Clo... | 4 | 15 | 81 |
18c2d417e359a71bed7e0f61cf4d062134c284d4 | Graham Esau | 2019-10-19T20:03:34 | Fix schema generation for flatten Options | diff --git a/schemars/src/json_schema_impls/core.rs b/schemars/src/json_schema_impls/core.rs
index 813a5d1..f0bf60c 100644
--- a/schemars/src/json_schema_impls/core.rs
+++ b/schemars/src/json_schema_impls/core.rs
@@ -46,8 +46,16 @@ impl<T: JsonSchema> JsonSchema for Option<T> {
schema
}
- fn json_sch... | 5 | 34 | 13 |
5bf8b3075354a690561a7b81fcd1ed7fd56d87bf | Graham Esau | 2019-10-19T19:33:26 | Schema generation now never returns an error | diff --git a/schemars/examples/structs.rs b/schemars/examples/structs.rs
index 2c53101..05f4b20 100644
--- a/schemars/examples/structs.rs
+++ b/schemars/examples/structs.rs
@@ -1,4 +1,4 @@
-use schemars::{JsonSchema, schema_for};
+use schemars::{schema_for, JsonSchema};
use serde::{Deserialize, Serialize};
#[derive... | 18 | 167 | 160 |
f38f58d1e84f5dc1ab5b5abb782d4abf237eddf8 | Graham Esau | 2019-10-13T21:42:34 | Move root schema definitions into Metadata | diff --git a/schemars/src/flatten.rs b/schemars/src/flatten.rs
index 82f452c..506e719 100644
--- a/schemars/src/flatten.rs
+++ b/schemars/src/flatten.rs
@@ -35,12 +35,13 @@ macro_rules! impl_merge {
}
impl_merge!(SchemaObject {
- merge: definitions extensions instance_type enum_values
+ merge: extensions inst... | 3 | 6 | 5 |
c78d721fc58bc993620ff8831a690c05081e0e2b | Graham Esau | 2019-10-13T21:38:20 | 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. | diff --git a/schemars/src/flatten.rs b/schemars/src/flatten.rs
index 90b15c6..82f452c 100644
--- a/schemars/src/flatten.rs
+++ b/schemars/src/flatten.rs
@@ -36,9 +36,16 @@ macro_rules! impl_merge {
impl_merge!(SchemaObject {
merge: definitions extensions instance_type enum_values
- number string array ob... | 6 | 89 | 61 |
7d162a8fb595db5ee5975e3c05e59e02d25b8ccc | Graham Esau | 2019-10-12T11:56:51 | Update syn/quote/proc-macro2 to 1.0 | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index fdef5d3..f4d6d77 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -2,14 +2,14 @@
name = "schemars"
description = "Generate JSON Schemas from Rust code"
repository = "https://github.com/GREsau/schemars"
-version = "0.1.9"
+version = "0.1.10"
a... | 4 | 45 | 35 |
01632b37fc5f7670ebdcc54d3435adca9ca5760d | Graham Esau | 2019-10-06T16:15:59 | Always enable syn extra-traits feature.
ExprPath's PartialEq implementation is required by schemars_derive | diff --git a/schemars_derive/Cargo.toml b/schemars_derive/Cargo.toml
index 2a8c5fd..88c9b81 100644
--- a/schemars_derive/Cargo.toml
+++ b/schemars_derive/Cargo.toml
@@ -14,9 +14,8 @@ proc-macro = true
[dependencies]
proc-macro2 = "0.4"
quote = "0.6.13"
-syn = "0.15.44"
+syn = { version = "0.15.44", features = ["extr... | 1 | 1 | 2 |
d7a214526f84ab621f5ec5dc7b98d5a3890ed4bc | Graham Esau | 2019-09-14T19:36:59 | Prevent possibility of infinite loop | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index fa7d162..4c4dd1d 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -149,7 +149,7 @@ impl SchemaGenerator {
}
pub fn get_schema_object(&self, mut schema: Schema) -> Result<SchemaObject> {
- loop {
+ for _ in 0..100 {
... | 1 | 5 | 1 |
b9e9360b5c70769c0105ff83e546c9e143931f64 | Graham Esau | 2019-09-14T19:30:03 | Refactor out some unneeded clones | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index 40c45a8..fa7d162 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -90,10 +90,10 @@ impl SchemaGenerator {
}
let name = T::schema_name();
+ let reference = format!("{}{}", self.settings().definitions_path, name);
... | 2 | 31 | 30 |
00f79281dbf047ce6604e69e8230914bd93fdf14 | Graham Esau | 2019-09-14T17:17:19 | Refactor schema flattening | diff --git a/schemars/src/flatten.rs b/schemars/src/flatten.rs
new file mode 100644
index 0000000..930f8de
--- /dev/null
+++ b/schemars/src/flatten.rs
@@ -0,0 +1,139 @@
+use crate::schema::*;
+use crate::{JsonSchemaError, Map, Result, Set};
+
+impl Schema {
+ pub fn flatten(self, other: Self) -> Result {
+ le... | 3 | 143 | 88 |
8d68e36f7c1e0cf454d85eb78faa33e3bb8aead5 | Graham Esau | 2019-09-08T22:13:26 | Add unit test for serde attribute processing | diff --git a/schemars_derive/Cargo.toml b/schemars_derive/Cargo.toml
index 7e67edc..2a8c5fd 100644
--- a/schemars_derive/Cargo.toml
+++ b/schemars_derive/Cargo.toml
@@ -14,5 +14,9 @@ proc-macro = true
[dependencies]
proc-macro2 = "0.4"
quote = "0.6.13"
-syn = "0.15.22"
+syn = "0.15.44"
serde_derive_internals = "0.2... | 3 | 53 | 10 |
af1fa5fe9ed54a75bee48292e3fd5c8ea0bf7ce2 | Graham Esau | 2019-09-08T21:46:18 | Do not ignore all serde attributes if there are also schemars attributes | diff --git a/schemars/tests/property_name.rs b/schemars/tests/property_name.rs
index 2bd61c8..3356146 100644
--- a/schemars/tests/property_name.rs
+++ b/schemars/tests/property_name.rs
@@ -16,4 +16,4 @@ struct MyStruct {
#[test]
fn set_struct_property_names() -> TestResult {
test_default_generated_schema::<MyStr... | 4 | 105 | 37 |
e9e0526adc3c35e101a1c9b5472a2b4b94cf7261 | Graham Esau | 2019-09-08T13:44:32 | Implement JsonSchema for more deref types | diff --git a/schemars/src/json_schema_impls/core.rs b/schemars/src/json_schema_impls/core.rs
index 1deaec8..4f456a2 100644
--- a/schemars/src/json_schema_impls/core.rs
+++ b/schemars/src/json_schema_impls/core.rs
@@ -48,6 +48,18 @@ impl<T: ?Sized> JsonSchema for std::marker::PhantomData<T> {
}
}
+impl JsonSchem... | 3 | 18 | 3 |
7285dde99aae7019e9888410fc5ea9bd1eeaa7e4 | Graham Esau | 2019-09-07T22:45:40 | Add tuple unit test | diff --git a/schemars/src/json_schema_impls/tuple.rs b/schemars/src/json_schema_impls/tuple.rs
index a5cd969..987a748 100644
--- a/schemars/src/json_schema_impls/tuple.rs
+++ b/schemars/src/json_schema_impls/tuple.rs
@@ -50,3 +50,28 @@ tuple_impls! {
15 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14)
1... | 1 | 25 | 0 |
3fcdc7266207da7943073928a89e7b6f202678b9 | Graham Esau | 2019-09-07T22:23:01 | Add unit tests for map JsonSchemas | diff --git a/schemars/src/json_schema_impls/maps.rs b/schemars/src/json_schema_impls/maps.rs
index f1f376a..e823ad1 100644
--- a/schemars/src/json_schema_impls/maps.rs
+++ b/schemars/src/json_schema_impls/maps.rs
@@ -41,3 +41,71 @@ macro_rules! map_impl {
map_impl!(<K: Ord, V> JsonSchema for std::collections::BTreeM... | 1 | 68 | 0 |
45e37a9c818674fdb4d9b50f821dfe0dc8406366 | Graham Esau | 2019-09-07T21:39:13 | Add unit tests for Option schemas | diff --git a/schemars/src/json_schema_impls/array.rs b/schemars/src/json_schema_impls/array.rs
index 8ea11cc..b14ca55 100644
--- a/schemars/src/json_schema_impls/array.rs
+++ b/schemars/src/json_schema_impls/array.rs
@@ -73,4 +73,17 @@ mod tests {
assert_eq!(schema.extensions.get("maxItems"), Some(&json!(8)));... | 3 | 67 | 4 |
00148bdf5741e0cbf39b73101d33d9566c2f8115 | Graham Esau | 2019-09-07T20:58:31 | Split JsonSchema implementations into separate files | diff --git a/schemars/src/json_schema_impls.rs b/schemars/src/json_schema_impls.rs
deleted file mode 100644
index 6d9e8f1..0000000
--- a/schemars/src/json_schema_impls.rs
+++ /dev/null
@@ -1,354 +0,0 @@
-use crate::gen::{BoolSchemas, SchemaGenerator};
-use crate::schema::*;
-use crate::{JsonSchema, Map, Result};
-use s... | 11 | 439 | 354 |
717e3baed95e513186b18b8f17473ad0e99ed1c8 | Graham Esau | 2019-09-03T18:28:17 | Clippy fixes | diff --git a/schemars/src/json_schema_impls.rs b/schemars/src/json_schema_impls.rs
index 89dbad1..dae6098 100644
--- a/schemars/src/json_schema_impls.rs
+++ b/schemars/src/json_schema_impls.rs
@@ -131,7 +131,7 @@ macro_rules! array_impls {
}
array_impls! {
- 01 02 03 04 05 06 07 08 09 10
+ 1 2 3 4 5 6 ... | 3 | 8 | 6 |
9938c498a079276b23130e6502b02325a062ed46 | Graham Esau | 2019-09-03T18:26:37 | Add workspace cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..0540418
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,5 @@
+[workspace]
+members = [
+ "schemars",
+ "schemars_derive"
+] | 1 | 5 | 0 |
10ab02f167f6590924d7d541fa91bdf680fe1f0b | Graham Esau | 2019-08-27T20:46:27 | Remove explicit lifetime from get_schema_object | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index 985679d..40c45a8 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -148,7 +148,8 @@ impl SchemaGenerator {
})
}
- pub fn get_schema_object<'a>(&'a self, mut schema: &'a Schema) -> Result<SchemaObject> {
+ pub fn get_schema_ob... | 1 | 2 | 1 |
f45181aac3de0248cc0130dad9b2a47e8fc31cec | Graham Esau | 2019-08-11T16:58:07 | 0.1.6 - implement JsonSchema for unsized types | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index bd45a8a..84f2b6b 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -2,14 +2,14 @@
name = "schemars"
description = "Generate JSON Schemas from Rust code"
repository = "https://github.com/GREsau/schemars"
-version = "0.1.5"
+version = "0.1.6"
au... | 4 | 6 | 6 |
6eba5df7b3d42d5591698da5550b96ea528acfc7 | Graham Esau | 2019-08-11T13:55:15 | Fix schemars_derive dependency | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index 6d25a40..bd45a8a 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -2,14 +2,14 @@
name = "schemars"
description = "Generate JSON Schemas from Rust code"
repository = "https://github.com/GREsau/schemars"
-version = "0.1.4"
+version = "0.1.5"
au... | 2 | 3 | 3 |
a00f488559d9581284cfba6e375ffc3fe9237290 | Graham Esau | 2019-08-11T13:46:03 | Make get_schema_object public | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index cad2c21..985679d 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -148,7 +148,7 @@ impl SchemaGenerator {
})
}
- pub(crate) fn get_schema_object<'a>(&'a self, mut schema: &'a Schema) -> Result<SchemaObject> {
+ pub fn get_sc... | 1 | 1 | 1 |
870dc3a2de01802f9d32e103fd4ee6f65a1e5bf7 | Graham Esau | 2019-08-11T13:35:26 | Rename MakeSchema to JsonSchema | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index 0d949fa..6d25a40 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -2,7 +2,7 @@
name = "schemars"
description = "Generate JSON Schemas from Rust code"
repository = "https://github.com/GREsau/schemars"
-version = "0.1.3"
+version = "0.1.4"
auth... | 16 | 116 | 129 |
936fb8c96ebb5932ed0fdb4d419a0ded7e5349da | Graham Esau | 2019-08-08T21:45:21 | Fix schema generation for complex enum variants | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index 1c39db8..7f11d1f 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -2,14 +2,14 @@
name = "schemars"
description = "Generate JSON Schemas from Rust code"
repository = "https://github.com/GREsau/schemars"
-version = "0.1.1"
+version = "0.1.2"
au... | 3 | 12 | 8 |
87b56f2a77ee60b885267cb43fbc3384565c2f05 | Graham Esau | 2019-08-08T18:00:48 | Add package info to Cargo.toml | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index 35ef431..67eec45 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -1,10 +1,12 @@
[package]
name = "schemars"
+description = "Generate JSON Schemas from Rust code"
+repository = "https://github.com/GREsau/schemars"
version = "0.1.0"
-authors = ... | 1 | 5 | 3 |
cf661afa13e9f4ba45199c87ec94d34f25716856 | Graham Esau | 2019-08-08T17:50:41 | Add package info to Cargo.toml | diff --git a/schemars_derive/Cargo.toml b/schemars_derive/Cargo.toml
index cb57ab4..af6f032 100644
--- a/schemars_derive/Cargo.toml
+++ b/schemars_derive/Cargo.toml
@@ -1,10 +1,12 @@
[package]
name = "schemars_derive"
+description = "Macros for #[derive(MakeSchema)], for use with schemars"
+repository = "https://gith... | 1 | 4 | 2 |
8afce08c547bc30dac880e5479a1eb85a0d359f0 | Graham Esau | 2019-08-08T17:43:15 | Slightly abstract away map/set types | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index 935c398..8523908 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -1,7 +1,6 @@
use crate::make_schema::MakeSchema;
use crate::schema::*;
-use crate::{MakeSchemaError, Result};
-use std::collections::BTreeMap as Map;
+use crate::{MakeSchemaError... | 5 | 10 | 12 |
d14db450cf6b24b57910410028532f2ab182f859 | Graham Esau | 2019-08-07T12:32:44 | Test for default name of struct with type params | diff --git a/schemars/src/make_schema.rs b/schemars/src/make_schema.rs
index 1937714..dea9770 100644
--- a/schemars/src/make_schema.rs
+++ b/schemars/src/make_schema.rs
@@ -306,6 +306,18 @@ impl<T: MakeSchema> MakeSchema for Option<T> {
}
}
+impl<T> MakeSchema for std::marker::PhantomData<T> {
+ no_ref_schem... | 4 | 100 | 2 |
51ed13218c24c83b7b10f8cbfbcaa5ceea908a18 | Graham Esau | 2019-08-06T19:56:04 | Allow making a schema to fail by returning an Err | diff --git a/schemars/src/error.rs b/schemars/src/error.rs
new file mode 100644
index 0000000..410deac
--- /dev/null
+++ b/schemars/src/error.rs
@@ -0,0 +1,26 @@
+use std::fmt;
+use std::error::Error;
+use crate::schema::Schema;
+
+pub type Result<T = Schema> = std::result::Result<T, MakeSchemaError>;
+
+#[derive(Debug... | 8 | 151 | 101 |
2aa1835240fdec48de25d18a1605ea262d08b1a0 | Graham Esau | 2019-08-06T17:57:36 | Add test for flattened structs (currently ignored) | diff --git a/schemars/tests/flatten.rs b/schemars/tests/flatten.rs
new file mode 100644
index 0000000..9ad3812
--- /dev/null
+++ b/schemars/tests/flatten.rs
@@ -0,0 +1,37 @@
+use pretty_assertions::assert_eq;
+use schemars::{schema_for, MakeSchema};
+use serde::{Deserialize, Serialize};
+
+#[derive(Serialize, Deseriali... | 1 | 37 | 0 |
933eb1ac40f65b0b801ba40dc9622aabbd8d75c3 | Graham Esau | 2019-08-06T07:55:25 | Use pretty_assertions in tests | diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml
index f694cb6..35ef431 100644
--- a/schemars/Cargo.toml
+++ b/schemars/Cargo.toml
@@ -10,3 +10,6 @@ edition = "2018"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
schemars_derive = { version = "0.1.0", path = "../schemars_derive" }
+
+[de... | 2 | 26 | 27 |
48465b51cf42664ddcce99645a60f0eaec8dffd3 | Graham Esau | 2019-08-06T06:48:44 | Refactor nullable schema generation | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index f8d7b8b..7370d70 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -7,7 +7,7 @@ use std::iter::FromIterator;
#[derive(Debug, PartialEq, Clone)]
pub struct SchemaSettings {
pub option_nullable: bool,
- pub option_any_of_null: bool,
+ p... | 2 | 16 | 23 |
1f514f2be7adfafcd6fbccb63a2fd36866fd0166 | Graham Esau | 2019-08-05T22:30:53 | Add some config for openapi3 compatibility | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index 01f2f00..0227d06 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -4,19 +4,90 @@ use std::collections::BTreeMap as Map;
use std::collections::BTreeSet as Set;
use std::iter::FromIterator;
-#[derive(Debug, Default)]
+#[derive(Debug, PartialEq,... | 3 | 108 | 14 |
ef5c584118f0c19385607bba929939d90c2f043d | Graham Esau | 2019-08-05T20:20:16 | Add `schema_for` macro | diff --git a/schemars/src/lib.rs b/schemars/src/lib.rs
index 587a0ee..99195cc 100644
--- a/schemars/src/lib.rs
+++ b/schemars/src/lib.rs
@@ -2,6 +2,9 @@ pub mod gen;
pub mod make_schema;
pub mod schema;
+#[macro_use]
+mod macros;
+
pub use make_schema::MakeSchema;
pub use schemars_derive::*;
diff --git a/schema... | 4 | 14 | 6 |
463ba518b696f776140ec9a19fb86c1ed8623991 | Graham Esau | 2019-08-05T20:05:31 | Refactor subschema generation | diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs
index aa4f9e6..01f2f00 100644
--- a/schemars/src/gen.rs
+++ b/schemars/src/gen.rs
@@ -23,25 +23,33 @@ impl SchemaGenerator {
}
let type_id = T::schema_type_id();
- // TODO is there a nicer way to do this?
- if !self.definitions.con... | 1 | 26 | 18 |
c552e6d208eb05582dd90af8872151d3a136dba3 | Graham Esau | 2019-08-05T19:05:31 | Change some derived traits in model structs | diff --git a/schemars/src/schema.rs b/schemars/src/schema.rs
index 589b05f..2ae521c 100644
--- a/schemars/src/schema.rs
+++ b/schemars/src/schema.rs
@@ -32,13 +32,13 @@ impl From<SchemaRef> for Schema {
}
}
-#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, MakeSchema)]
+#[derive(Serialize, Des... | 1 | 4 | 4 |
076cf423c336629710c999a200b39ca8a02723ff | Graham Esau | 2019-08-05T13:30:44 | Fix error in map schema generation | diff --git a/schemars/src/make_schema.rs b/schemars/src/make_schema.rs
index 401a5d4..ab8a6ee 100644
--- a/schemars/src/make_schema.rs
+++ b/schemars/src/make_schema.rs
@@ -234,7 +234,7 @@ macro_rules! map_impl {
let mut extensions = Map::new();
extensions.insert(
... | 1 | 1 | 1 |
d79f0f56b020f0e7ac4a521fb1979faa8cc982c6 | Graham Esau | 2019-08-05T12:16:06 | Schema now implements MakeSchema | diff --git a/schemars/src/generator.rs b/schemars/src/gen.rs
similarity index 100%
rename from schemars/src/generator.rs
rename to schemars/src/gen.rs
diff --git a/schemars/src/lib.rs b/schemars/src/lib.rs
index 13f3091..a288e1b 100644
--- a/schemars/src/lib.rs
+++ b/schemars/src/lib.rs
@@ -1,8 +1,8 @@
-pub mod generat... | 6 | 30 | 59 |
d90a29f3f853371d178b7f52a50dfa25dd7bcf07 | Graham Esau | 2019-08-04T21:52:03 | Struct-like enum variants work! | diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs
index 0c2999d..9bfa5b7 100644
--- a/schemars_derive/src/lib.rs
+++ b/schemars_derive/src/lib.rs
@@ -86,6 +86,7 @@ fn schema_for_enum(variants: &[Variant]) -> TokenStream {
}
schemas.extend(complex_variants.into_iter().map(|variant| {
+ ... | 1 | 3 | 2 |
8b034f4dd8d483b63451f0f0091048f93ecaa53b | Graham Esau | 2019-08-04T21:45:05 | Tuple enums | diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs
index d135804..0c2999d 100644
--- a/schemars_derive/src/lib.rs
+++ b/schemars_derive/src/lib.rs
@@ -94,7 +94,12 @@ fn schema_for_enum(variants: &[Variant]) -> TokenStream {
gen.subschema_for::<#ty>()
}
... | 1 | 6 | 1 |
3be97a7da42d85db7915b9f595d9300c276e0f25 | Graham Esau | 2019-08-04T21:28:33 | Handle newtype enum variants | diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs
index f126e73..d135804 100644
--- a/schemars_derive/src/lib.rs
+++ b/schemars_derive/src/lib.rs
@@ -23,7 +23,7 @@ pub fn derive_make_schema(input: proc_macro::TokenStream) -> proc_macro::TokenSt
let name = cont.ident;
let (impl_generics, ty_... | 1 | 60 | 17 |
d628f7c162a1c249e8c5a9a92f4bc45928ddf26e | Graham Esau | 2019-08-04T20:35:01 | Refactoring derive macros | diff --git a/schemars/src/make_schema.rs b/schemars/src/make_schema.rs
index 1a210a6..0f29343 100644
--- a/schemars/src/make_schema.rs
+++ b/schemars/src/make_schema.rs
@@ -35,8 +35,6 @@ macro_rules! no_ref_schema {
};
}
-// TODO structs, enums, tuples
-
// TODO any other serde types other than serde_json valu... | 2 | 24 | 21 |
d1a319c5f280c8b4f30ce9f6d31ce227ef78586f | Graham Esau | 2019-08-04T18:49:41 | Generate schemas for simple enums | diff --git a/schemars/src/main.rs b/schemars/src/main.rs
index e77c95f..533a945 100644
--- a/schemars/src/main.rs
+++ b/schemars/src/main.rs
@@ -2,7 +2,7 @@ use schemars::MakeSchema;
use serde::{Deserialize, Serialize};
use serde_json::Result;
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Serialize, Deseriali... | 2 | 23 | 3 |
48d6cda0b8aec28031b7763e8c24640c9e8c48a6 | Graham Esau | 2019-08-04T17:43:20 | Use serde internals to determine property names | diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs
index 4de6832..bf83f82 100644
--- a/schemars_derive/src/lib.rs
+++ b/schemars_derive/src/lib.rs
@@ -4,21 +4,27 @@ extern crate quote;
extern crate syn;
extern crate proc_macro;
-extern crate proc_macro2;
-use proc_macro2::TokenStream;
+use proc_... | 1 | 28 | 21 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.