Skip to content

Commit 8d0f23f

Browse files
drop name, sid and skip_bigint_checks from Enum/Struct + wip: cleanup tests
1 parent 6f03039 commit 8d0f23f

32 files changed

Lines changed: 463 additions & 680 deletions

File tree

examples/demo.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/demo2.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

specta-jsonschema/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ pub fn to_ast(schema: &Schema) -> Result<DataType, ()> {
146146
// pub property_names: Option<Box<Schema>>,
147147

148148
let mut s = StructBuilder::named(
149-
obj.metadata
150-
.as_ref()
151-
.and_then(|v| v.title.as_ref().map(|v| v.to_class_case()))
152-
.unwrap_or_else(|| "Unnamed".to_string()),
153-
); // TODO: Remove fallback
149+
// obj.metadata
150+
// .as_ref()
151+
// .and_then(|v| v.title.as_ref().map(|v| v.to_class_case()))
152+
// .unwrap_or_else(|| "Unnamed".to_string()),
153+
);
154154
for (k, v) in o.properties.iter() {
155155
s.field_mut(k.clone(), FieldBuilder::new(to_ast(v)?));
156156
}
@@ -182,7 +182,7 @@ pub fn to_ast(schema: &Schema) -> Result<DataType, ()> {
182182
return Ok(match o.len() {
183183
0 => DataType::List(List::new(from_instance_type(&o[0]), None, false)),
184184
_ => {
185-
let mut e = EnumBuilder::new("todo");
185+
let mut e = EnumBuilder::new();
186186

187187
for list in o {
188188
println!("{:?}", list);

specta-macros/src/type/attr/enum.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,13 @@ pub struct EnumAttr {
1818
pub tag: Option<String>,
1919
pub content: Option<String>,
2020
pub untagged: bool,
21-
// This property is not covered by sem-ver and *should* not be used.
22-
pub unstable_skip_bigint_checks: bool,
2321
}
2422

2523
impl_parse! {
2624
EnumAttr(attr, out) {
2725
// "tag" was already passed in the container so we don't need to do anything here
2826
"content" => out.content = out.content.take().or(Some(attr.parse_string()?)),
2927
"untagged" => out.untagged = attr.parse_bool().unwrap_or(true),
30-
"unstable_skip_bigint_checks" => out.unstable_skip_bigint_checks = attr.parse_bool().unwrap_or(true),
3128
}
3229
}
3330

specta-macros/src/type/enum.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use quote::{quote, ToTokens};
55
use syn::{spanned::Spanned, DataEnum, Fields};
66

77
pub fn parse_enum(
8-
name: &TokenStream,
98
enum_attrs: &EnumAttr,
109
container_attrs: &ContainerAttr,
1110
crate_ref: &TokenStream,
@@ -155,10 +154,8 @@ pub fn parse_enum(
155154
),
156155
};
157156

158-
let skip_bigint_checs = enum_attrs.unstable_skip_bigint_checks;
159-
160157
Ok((
161-
quote!(#crate_ref::datatype::DataType::Enum(#crate_ref::internal::construct::r#enum(#name.into(), SID, #repr, #skip_bigint_checs, vec![#(#variant_types),*]))),
158+
quote!(#crate_ref::datatype::DataType::Enum(#crate_ref::internal::construct::r#enum(#repr, vec![#(#variant_types),*]))),
162159
can_flatten,
163160
))
164161
}

specta-macros/src/type/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ pub fn derive(input: proc_macro::TokenStream) -> syn::Result<proc_macro::TokenSt
4646
let (inlines, can_flatten) = match data {
4747
Data::Struct(data) => parse_struct(&name, &container_attrs, &crate_ref, data),
4848
Data::Enum(data) => parse_enum(
49-
&name,
5049
&EnumAttr::from_attrs(&container_attrs, &mut attrs)?,
5150
&container_attrs,
5251
&crate_ref,

specta-macros/src/type/struct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ pub fn parse_struct(
145145
Fields::Unit => quote!(#crate_ref::internal::construct::fields_unit()),
146146
};
147147

148-
quote!(#crate_ref::datatype::DataType::Struct(#crate_ref::internal::construct::r#struct(#name.into(), Some(SID), #fields)))
148+
quote!(#crate_ref::datatype::DataType::Struct(#crate_ref::internal::construct::r#struct(#fields)))
149149
};
150150

151151
Ok((definition, true))

specta-openapi/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ pub fn to_openapi(typ: &DataType) -> ReferenceOr<Schema> {
120120
},
121121
DataType::Struct(s) => {
122122
let fields = s.fields();
123-
let name = s.name();
124123

125124
// match &fields[..] {
126125
// [] => todo!(), // "null".to_string(),

0 commit comments

Comments
 (0)