Run cargo fmt
This commit is contained in:
parent
98f981634c
commit
58cc7fac25
22 changed files with 57 additions and 74 deletions
|
@ -24,9 +24,7 @@ pub struct MyStruct {
|
|||
#[derive(JsonSchema)]
|
||||
pub enum MyEnum {
|
||||
StringNewType(String),
|
||||
StructVariant {
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
StructVariant { floats: Vec<f32> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -133,9 +131,7 @@ pub struct MyStruct {
|
|||
#[serde(untagged)]
|
||||
pub enum MyEnum {
|
||||
StringNewType(String),
|
||||
StructVariant {
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
StructVariant { floats: Vec<f32> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -38,7 +38,9 @@ mod as_string {
|
|||
D: Deserializer<'de>,
|
||||
{
|
||||
let string = String::deserialize(deserializer)?;
|
||||
string.parse().map_err(|_| D::Error::custom("Input was not valid"))
|
||||
string
|
||||
.parse()
|
||||
.map_err(|_| D::Error::custom("Input was not valid"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ pub enum MyEnum {
|
|||
StructVariant {
|
||||
/// The floats themselves
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -10,9 +10,7 @@ pub struct MyStruct {
|
|||
#[derive(JsonSchema)]
|
||||
pub enum MyEnum {
|
||||
StringNewType(String),
|
||||
StructVariant {
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
StructVariant { floats: Vec<f32> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -16,9 +16,7 @@ pub struct MyStruct {
|
|||
#[schemars(untagged)]
|
||||
pub enum MyEnum {
|
||||
StringNewType(String),
|
||||
StructVariant {
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
StructVariant { floats: Vec<f32> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -15,9 +15,7 @@ pub struct MyStruct {
|
|||
#[serde(untagged)]
|
||||
pub enum MyEnum {
|
||||
StringNewType(String),
|
||||
StructVariant {
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
StructVariant { floats: Vec<f32> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -38,7 +38,9 @@ mod as_string {
|
|||
D: Deserializer<'de>,
|
||||
{
|
||||
let string = String::deserialize(deserializer)?;
|
||||
string.parse().map_err(|_| D::Error::custom("Input was not valid"))
|
||||
string
|
||||
.parse()
|
||||
.map_err(|_| D::Error::custom("Input was not valid"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ pub enum MyEnum {
|
|||
StructVariant {
|
||||
/// The floats themselves
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -10,9 +10,7 @@ pub struct MyStruct {
|
|||
#[derive(JsonSchema)]
|
||||
pub enum MyEnum {
|
||||
StringNewType(String),
|
||||
StructVariant {
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
StructVariant { floats: Vec<f32> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -16,9 +16,7 @@ pub struct MyStruct {
|
|||
#[schemars(untagged)]
|
||||
pub enum MyEnum {
|
||||
StringNewType(String),
|
||||
StructVariant {
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
StructVariant { floats: Vec<f32> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -15,9 +15,7 @@ pub struct MyStruct {
|
|||
#[serde(untagged)]
|
||||
pub enum MyEnum {
|
||||
StringNewType(String),
|
||||
StructVariant {
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
StructVariant { floats: Vec<f32> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -192,7 +192,7 @@ impl SchemaGenerator {
|
|||
/// assert_eq!(extensible_schema, extensible_schema2);
|
||||
/// ```
|
||||
pub fn make_extensible(&self, schema: SchemaObject) -> SchemaObject {
|
||||
if schema.is_ref() && !self.settings().allow_ref_siblings{
|
||||
if schema.is_ref() && !self.settings().allow_ref_siblings {
|
||||
SchemaObject {
|
||||
subschemas: Some(Box::new(SubschemaValidation {
|
||||
all_of: Some(vec![schema.into()]),
|
||||
|
|
|
@ -15,7 +15,11 @@ where
|
|||
no_ref_schema!();
|
||||
|
||||
fn schema_name() -> String {
|
||||
format!("Array_up_to_size_{}_of_{}", A::CAPACITY, A::Item::schema_name())
|
||||
format!(
|
||||
"Array_up_to_size_{}_of_{}",
|
||||
A::CAPACITY,
|
||||
A::Item::schema_name()
|
||||
)
|
||||
}
|
||||
|
||||
fn json_schema(gen: &mut SchemaGenerator) -> Schema {
|
||||
|
|
|
@ -69,8 +69,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn schema_for_map_any_value_no_bool_schema() {
|
||||
let settings =
|
||||
SchemaSettings::default().with(|s| s.bool_schemas = BoolSchemas::Disabled);
|
||||
let settings = SchemaSettings::default().with(|s| s.bool_schemas = BoolSchemas::Disabled);
|
||||
let schema = custom_schema_object_for::<BTreeMap<String, serde_json::Value>>(settings);
|
||||
assert_eq!(
|
||||
schema.instance_type,
|
||||
|
|
|
@ -32,22 +32,18 @@ macro_rules! forward_impl {
|
|||
}
|
||||
|
||||
mod array;
|
||||
#[cfg(feature = "arrayvec")]
|
||||
mod arrayvec;
|
||||
#[cfg(std_atomic)]
|
||||
mod atomic;
|
||||
#[cfg(feature = "chrono")]
|
||||
mod chrono;
|
||||
#[cfg(feature = "indexmap")]
|
||||
mod indexmap;
|
||||
mod core;
|
||||
#[cfg(feature = "either")]
|
||||
mod either;
|
||||
#[cfg(feature = "uuid")]
|
||||
mod uuid;
|
||||
#[cfg(feature = "smallvec")]
|
||||
mod smallvec;
|
||||
#[cfg(feature = "arrayvec")]
|
||||
mod arrayvec;
|
||||
mod core;
|
||||
mod ffi;
|
||||
#[cfg(feature = "indexmap")]
|
||||
mod indexmap;
|
||||
mod maps;
|
||||
#[cfg(num_nonzero_signed)]
|
||||
mod nonzero_signed;
|
||||
|
@ -55,6 +51,10 @@ mod nonzero_unsigned;
|
|||
mod primitives;
|
||||
mod sequences;
|
||||
mod serdejson;
|
||||
#[cfg(feature = "smallvec")]
|
||||
mod smallvec;
|
||||
mod time;
|
||||
mod tuple;
|
||||
#[cfg(feature = "uuid")]
|
||||
mod uuid;
|
||||
mod wrapper;
|
||||
|
|
|
@ -18,9 +18,7 @@ pub struct MyStruct {
|
|||
#[derive(JsonSchema)]
|
||||
pub enum MyEnum {
|
||||
StringNewType(String),
|
||||
StructVariant {
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
StructVariant { floats: Vec<f32> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -127,9 +125,7 @@ pub struct MyStruct {
|
|||
#[serde(untagged)]
|
||||
pub enum MyEnum {
|
||||
StringNewType(String),
|
||||
StructVariant {
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
StructVariant { floats: Vec<f32> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -4,10 +4,10 @@ use util::*;
|
|||
|
||||
#[test]
|
||||
fn arrayvec() -> TestResult {
|
||||
test_default_generated_schema::<ArrayVec::<[i32; 16]>>("arrayvec")
|
||||
test_default_generated_schema::<ArrayVec<[i32; 16]>>("arrayvec")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn arrayvec_string() -> TestResult {
|
||||
test_default_generated_schema::<ArrayString::<[u8; 16]>>("arrayvec_string")
|
||||
test_default_generated_schema::<ArrayString<[u8; 16]>>("arrayvec_string")
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
mod util;
|
||||
|
||||
use schemars::JsonSchema;
|
||||
use serde::{Serialize};
|
||||
use util::*;
|
||||
use serde::Serialize;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use util::*;
|
||||
|
||||
enum Or<A, B> {
|
||||
#[allow(dead_code)]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
mod util;
|
||||
use uuid::Uuid;
|
||||
use util::*;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[test]
|
||||
fn uuid() -> TestResult {
|
||||
|
|
|
@ -135,7 +135,7 @@ fn schema_for_enum(variants: &[Variant], cattrs: &serde_attr::Container) -> Toke
|
|||
}
|
||||
|
||||
fn schema_for_external_tagged_enum<'a>(
|
||||
variants: impl Iterator<Item = &'a Variant<'a>>
|
||||
variants: impl Iterator<Item = &'a Variant<'a>>,
|
||||
) -> TokenStream {
|
||||
let (unit_variants, complex_variants): (Vec<_>, Vec<_>) =
|
||||
variants.partition(|v| is_unit_variant(v));
|
||||
|
@ -241,9 +241,7 @@ fn schema_for_internal_tagged_enum<'a>(
|
|||
})
|
||||
}
|
||||
|
||||
fn schema_for_untagged_enum<'a>(
|
||||
variants: impl Iterator<Item = &'a Variant<'a>>
|
||||
) -> TokenStream {
|
||||
fn schema_for_untagged_enum<'a>(variants: impl Iterator<Item = &'a Variant<'a>>) -> TokenStream {
|
||||
let schemas = variants.map(|variant| {
|
||||
let schema_expr = schema_for_untagged_enum_variant(variant);
|
||||
set_metadata_on_schema_from_docs(schema_expr, &variant.original.attrs)
|
||||
|
@ -257,9 +255,7 @@ fn schema_for_untagged_enum<'a>(
|
|||
})
|
||||
}
|
||||
|
||||
fn schema_for_untagged_enum_variant(
|
||||
variant: &Variant
|
||||
) -> TokenStream {
|
||||
fn schema_for_untagged_enum_variant(variant: &Variant) -> TokenStream {
|
||||
match variant.style {
|
||||
Style::Unit => schema_for_unit_struct(),
|
||||
Style::Newtype => schema_for_newtype_struct(&variant.fields[0]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue