diff --git a/README.md b/README.md index 4d6b4d9..1274c2c 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ pub enum MyEnum { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct DontExportMe { field: String, } diff --git a/specta-macros/Cargo.toml b/specta-macros/Cargo.toml index 9b87085..eee7d55 100644 --- a/specta-macros/Cargo.toml +++ b/specta-macros/Cargo.toml @@ -16,7 +16,7 @@ proc-macro = true [features] default = [] # These will be enabled by `specta` or `specta-util` automatically as required. They depend on certain exports of it so enabling them manually is not useful. -DO_NOT_USE_export = [] +DO_NOT_USE_collect = [] DO_NOT_USE_function = [] [lints] diff --git a/specta-macros/src/lib.rs b/specta-macros/src/lib.rs index ecfff14..61c6f9a 100644 --- a/specta-macros/src/lib.rs +++ b/specta-macros/src/lib.rs @@ -21,7 +21,7 @@ mod utils; /// Specta also introduces some of it's own attributes: /// - `#[specta(optional)]` - When paired with an `Option` field, this will result in `{ a?: T | null }` instead of `{ a: T | null }`. /// - `#[specta(type = ::std::string::String)]` - Will override the type of a item, variant or field to a given type. -/// - `#[specta(export = false)]` - When using the `export` feature, this will prevent the specific type from being exported. +/// - `#[specta(collect = false)]` - When using the `collect` feature, this will prevent the specific type from being automatically collected. /// /// ## Example /// diff --git a/specta-macros/src/type/attr/container.rs b/specta-macros/src/type/attr/container.rs index 8913c05..e461c20 100644 --- a/specta-macros/src/type/attr/container.rs +++ b/specta-macros/src/type/attr/container.rs @@ -43,7 +43,7 @@ impl_parse! { }, "inline" => out.inline = attr.parse_bool().unwrap_or(true), "remote" => out.remote = out.remote.take().or(Some(attr.parse_path()?.to_token_stream())), - "export" => out.export = out.export.take().or(Some(attr.parse_bool().unwrap_or(true))), + "collect" => out.export = out.export.take().or(Some(attr.parse_bool().unwrap_or(true))), "transparent" => out.transparent = attr.parse_bool().unwrap_or(true), } } diff --git a/specta-macros/src/type/mod.rs b/specta-macros/src/type/mod.rs index a672054..302ed37 100644 --- a/specta-macros/src/type/mod.rs +++ b/specta-macros/src/type/mod.rs @@ -125,7 +125,7 @@ pub fn derive(input: proc_macro::TokenStream) -> syn::Result { // arg: T, // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // struct FlattenEnumStruct { // outer: String, // #[serde(flatten)] @@ -446,7 +446,7 @@ // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // #[serde(tag = "tag", content = "test")] // enum FlattenEnum { // One, @@ -455,20 +455,20 @@ // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // struct OverridenStruct { // #[specta(type = String)] // overriden_field: i32, // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // struct HasGenericAlias(GenericAlias); // type GenericAlias = std::collections::HashMap; // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // enum SkipVariant { // A(String), // #[serde(skip)] @@ -478,7 +478,7 @@ // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // #[serde(tag = "tag", content = "data")] // enum SkipVariant2 { // A(String), @@ -489,7 +489,7 @@ // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // enum SkipVariant3 { // A { // a: String, @@ -505,7 +505,7 @@ // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // pub enum EnumMacroAttributes { // A(#[specta(type = String)] i32), // #[specta(rename = "bbb")] @@ -521,20 +521,20 @@ // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // pub struct PlaceholderInnerField { // a: String, // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // pub struct Recursive { // a: i32, // children: Vec, // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // pub enum InlineEnumField { // #[specta(inline)] @@ -542,7 +542,7 @@ // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // pub struct InlineOptionalType { // #[specta(inline)] // pub optional_field: Option, @@ -554,7 +554,7 @@ // // This is very much an advanced API. It is not recommended to use this unless you know what your doing. // // For personal reference: Is used in PCR to apply an inflection to the dynamic name of the include/select macro. // #[derive(Type)] -// #[specta(export = false, rename_from_path = CONTAINER_NAME)] +// #[specta(collect = false, rename_from_path = CONTAINER_NAME)] // pub struct RenameToValue { // #[specta(rename_from_path = FIELD_NAME)] // pub demo: i32, @@ -562,7 +562,7 @@ // // Regression test for https://github.com/oscartbeaumont/specta/issues/56 // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // enum Rename { // OneWord, // #[serde(rename = "Two words")] @@ -570,18 +570,18 @@ // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // pub struct TransparentTypeInner { // inner: String, // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // #[serde(transparent)] // pub struct TransparentType(pub(crate) TransparentTypeInner); // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // #[serde(transparent)] // pub struct TransparentType2(pub(crate) ()); @@ -589,12 +589,12 @@ // pub struct NonTypeType; // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // #[serde(transparent)] // pub struct TransparentTypeWithOverride(#[specta(type = String)] NonTypeType); // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // pub enum BasicEnum { // A, // B, @@ -602,7 +602,7 @@ // #[derive(Type)] // #[serde( -// export = false, +// collect = false, // tag = "type", // content = "value", // rename_all = "camelCase" @@ -613,7 +613,7 @@ // } // #[derive(Type)] -// #[serde(export = false, rename_all = "camelCase")] +// #[serde(collect = false, rename_all = "camelCase")] // pub struct FlattenOnNestedEnum { // id: String, // #[serde(flatten)] @@ -621,31 +621,31 @@ // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // pub struct EnumReferenceRecordKey { // a: HashMap, // } // // https://github.com/oscartbeaumont/specta/issues/88 // #[derive(Type)] -// #[serde(export = false, rename_all = "camelCase")] +// #[serde(collect = false, rename_all = "camelCase")] // #[serde(default)] // pub struct MyEmptyInput {} // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // #[allow(unused_parens)] // pub enum ExtraBracketsInTupleVariant { // A((String)), // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // #[allow(unused_parens)] // pub struct ExtraBracketsInUnnamedStruct((String)); // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // #[allow(unused_parens)] // pub struct RenameWithWeirdCharsField { // #[specta(rename = "@odata.context")] @@ -653,7 +653,7 @@ // } // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // #[allow(unused_parens)] // pub enum RenameWithWeirdCharsVariant { // #[specta(rename = "@odata.context")] @@ -661,11 +661,11 @@ // } // #[derive(Type)] -// #[specta(export = false, rename = "@odata.context")] +// #[specta(collect = false, rename = "@odata.context")] // pub struct RenameWithWeirdCharsStruct(String); // #[derive(Type)] -// #[specta(export = false, rename = "@odata.context")] +// #[specta(collect = false, rename = "@odata.context")] // pub enum RenameWithWeirdCharsEnum {} // #[derive(Type)] diff --git a/specta/Cargo.toml b/specta/Cargo.toml index 7d57448..2c1d71b 100644 --- a/specta/Cargo.toml +++ b/specta/Cargo.toml @@ -24,7 +24,7 @@ default = [] derive = ["dep:specta-macros"] ## Support for collecting up a global type map -export = ["dep:ctor", "specta-macros/DO_NOT_USE_export"] +collect = ["dep:ctor", "specta-macros/DO_NOT_USE_collect"] ## Enable the experimental `specta::json` macro. unstable_json_macro = [] diff --git a/specta/src/export.rs b/specta/src/collect.rs similarity index 82% rename from specta/src/export.rs rename to specta/src/collect.rs index e6675e2..a5a0f27 100644 --- a/specta/src/export.rs +++ b/specta/src/collect.rs @@ -10,11 +10,11 @@ static TYPES: OnceLock>> = Once /// Get the global type store containing all automatically registered types. /// -/// All types with the [`Type`](macro@specta::Type) macro will automatically be registered here unless they have been explicitly disabled with `#[specta(export = false)]`. +/// All types with the [`Type`](macro@specta::Type) macro will automatically be registered here unless they have been explicitly disabled with `#[specta(collect = false)]`. /// -/// Note that when enabling the `export` feature, you will not be able to enable the `unsafe_code` lint as [`ctor`](https://docs.rs/ctor) (which is used internally) is marked unsafe. +/// Note that when enabling the `collect` feature, you will not be able to enable the `unsafe_code` lint as [`ctor`](https://docs.rs/ctor) (which is used internally) is marked unsafe. /// -pub fn export() -> TypeCollection { +pub fn collect() -> TypeCollection { // TODO: Make `TYPES` should just hold a `TypeCollection` directly??? let types = TYPES .get_or_init(Default::default) @@ -49,6 +49,6 @@ pub mod internal { } // We expose this for the macros - #[cfg(feature = "export")] + #[cfg(feature = "collect")] pub use ::ctor; } diff --git a/specta/src/lib.rs b/specta/src/lib.rs index def47aa..5de324c 100644 --- a/specta/src/lib.rs +++ b/specta/src/lib.rs @@ -6,11 +6,11 @@ )] pub mod builder; -pub mod datatype; -#[cfg(feature = "export")] -#[cfg_attr(docsrs, doc(cfg(feature = "export")))] +#[cfg(feature = "collect")] +#[cfg_attr(docsrs, doc(cfg(feature = "collect")))] #[doc(hidden)] -pub mod export; +pub mod collect; +pub mod datatype; #[cfg(feature = "function")] #[cfg_attr(docsrs, doc(cfg(feature = "function")))] pub mod function; @@ -33,9 +33,9 @@ pub use specta_id::SpectaID; pub use type_collection::TypeCollection; #[doc(inline)] -#[cfg(feature = "export")] -#[cfg_attr(docsrs, doc(cfg(feature = "export")))] -pub use export::export; +#[cfg(feature = "collect")] +#[cfg_attr(docsrs, doc(cfg(feature = "collect")))] +pub use collect::collect; #[doc(inline)] #[cfg(feature = "derive")] diff --git a/specta/src/type/legacy_impls.rs b/specta/src/type/legacy_impls.rs index be8c24b..d69cba9 100644 --- a/specta/src/type/legacy_impls.rs +++ b/specta/src/type/legacy_impls.rs @@ -19,7 +19,7 @@ const _: () = { impl Flatten for Map {} #[derive(Type)] - #[specta(rename = "JsonValue", untagged, remote = Value, crate = crate, export = false)] + #[specta(rename = "JsonValue", untagged, remote = Value, crate = crate, collect = false)] pub enum JsonValue { Null, Bool(bool), @@ -99,7 +99,7 @@ const _: () = { use serde_yaml::{value::TaggedValue, Mapping, Number, Sequence, Value}; #[derive(Type)] - #[specta(rename = "YamlValue", untagged, remote = Value, crate = crate, export = false)] + #[specta(rename = "YamlValue", untagged, remote = Value, crate = crate, collect = false)] pub enum YamlValue { Null, Bool(bool), @@ -196,7 +196,7 @@ const _: () = { impl Flatten for toml::map::Map {} #[derive(Type)] - #[specta(rename = "TomlValue", untagged, remote = Value, crate = crate, export = false)] + #[specta(rename = "TomlValue", untagged, remote = Value, crate = crate, collect = false)] pub enum TomlValue { String(String), Integer(i64), @@ -208,7 +208,7 @@ const _: () = { } #[derive(Type)] - #[specta(rename = "Datetime", remote = Datetime, crate = crate, export = false)] + #[specta(rename = "Datetime", remote = Datetime, crate = crate, collect = false)] #[allow(dead_code)] struct DatetimeDef { #[specta(rename = "$__toml_private_datetime")] @@ -317,7 +317,7 @@ const _: () = { ); #[derive(Type)] - #[specta(remote = Timestamp, crate = crate, export = false)] + #[specta(remote = Timestamp, crate = crate, collect = false)] #[allow(dead_code)] struct Timestamp { time: NTP64, @@ -328,77 +328,77 @@ const _: () = { #[cfg(feature = "glam")] const _: () = { #[derive(Type)] - #[specta(remote = glam::DVec2, crate = crate, export = false)] + #[specta(remote = glam::DVec2, crate = crate, collect = false)] #[allow(dead_code)] struct DVec2([f64; 2]); #[derive(Type)] - #[specta(remote = glam::IVec2, crate = crate, export = false)] + #[specta(remote = glam::IVec2, crate = crate, collect = false)] #[allow(dead_code)] struct IVec2([i32; 2]); #[derive(Type)] - #[specta(remote = glam::DMat2, crate = crate, export = false)] + #[specta(remote = glam::DMat2, crate = crate, collect = false)] #[allow(dead_code)] struct DMat2([f64; 4]); #[derive(Type)] - #[specta(remote = glam::DAffine2, crate = crate, export = false)] + #[specta(remote = glam::DAffine2, crate = crate, collect = false)] #[allow(dead_code)] struct DAffine2([f64; 6]); #[derive(Type)] - #[specta(remote = glam::Vec2, crate = crate, export = false)] + #[specta(remote = glam::Vec2, crate = crate, collect = false)] #[allow(dead_code)] struct Vec2([f32; 2]); #[derive(Type)] - #[specta(remote = glam::Vec3, crate = crate, export = false)] + #[specta(remote = glam::Vec3, crate = crate, collect = false)] #[allow(dead_code)] struct Vec3([f32; 3]); #[derive(Type)] - #[specta(remote = glam::Vec3A, crate = crate, export = false)] + #[specta(remote = glam::Vec3A, crate = crate, collect = false)] #[allow(dead_code)] struct Vec3A([f32; 3]); #[derive(Type)] - #[specta(remote = glam::Vec4, crate = crate, export = false)] + #[specta(remote = glam::Vec4, crate = crate, collect = false)] #[allow(dead_code)] struct Vec4([f32; 4]); #[derive(Type)] - #[specta(remote = glam::Mat2, crate = crate, export = false)] + #[specta(remote = glam::Mat2, crate = crate, collect = false)] #[allow(dead_code)] struct Mat2([f32; 4]); #[derive(Type)] - #[specta(remote = glam::Mat3, crate = crate, export = false)] + #[specta(remote = glam::Mat3, crate = crate, collect = false)] #[allow(dead_code)] struct Mat3([f32; 9]); #[derive(Type)] - #[specta(remote = glam::Mat3A, crate = crate, export = false)] + #[specta(remote = glam::Mat3A, crate = crate, collect = false)] #[allow(dead_code)] struct Mat3A([f32; 9]); #[derive(Type)] - #[specta(remote = glam::Mat4, crate = crate, export = false)] + #[specta(remote = glam::Mat4, crate = crate, collect = false)] #[allow(dead_code)] struct Mat4([f32; 16]); #[derive(Type)] - #[specta(remote = glam::Quat, crate = crate, export = false)] + #[specta(remote = glam::Quat, crate = crate, collect = false)] #[allow(dead_code)] struct Quat([f32; 4]); #[derive(Type)] - #[specta(remote = glam::Affine2, crate = crate, export = false)] + #[specta(remote = glam::Affine2, crate = crate, collect = false)] #[allow(dead_code)] struct Affine2([f32; 6]); #[derive(Type)] - #[specta(remote = glam::Affine3A, crate = crate, export = false)] + #[specta(remote = glam::Affine3A, crate = crate, collect = false)] #[allow(dead_code)] struct Affine3A([f32; 12]); }; @@ -456,7 +456,7 @@ impl Type for either::Either { #[cfg(feature = "bevy_ecs")] const _: () = { #[derive(Type)] - #[specta(rename = "Entity", remote = bevy_ecs::entity::Entity, crate = crate, export = false)] + #[specta(rename = "Entity", remote = bevy_ecs::entity::Entity, crate = crate, collect = false)] #[allow(dead_code)] struct EntityDef(u64); }; @@ -464,7 +464,7 @@ const _: () = { #[cfg(feature = "bevy_input")] const _: () = { #[derive(Type)] - #[specta(remote = bevy_input::ButtonState, crate = crate, export = false)] + #[specta(remote = bevy_input::ButtonState, crate = crate, collect = false)] #[allow(dead_code)] enum ButtonState { Pressed, @@ -472,7 +472,7 @@ const _: () = { } #[derive(Type)] - #[specta(remote = bevy_input::keyboard::KeyboardInput, crate = crate, export = false)] + #[specta(remote = bevy_input::keyboard::KeyboardInput, crate = crate, collect = false)] #[allow(dead_code)] struct KeyboardInput { pub key_code: bevy_input::keyboard::KeyCode, @@ -488,7 +488,7 @@ const _: () = { ); #[derive(Type)] - #[specta(remote = bevy_input::mouse::MouseButtonInput, crate = crate, export = false)] + #[specta(remote = bevy_input::mouse::MouseButtonInput, crate = crate, collect = false)] #[allow(dead_code)] pub struct MouseButtonInput { pub button: bevy_input::mouse::MouseButton, @@ -497,7 +497,7 @@ const _: () = { } #[derive(Type)] - #[specta(remote = bevy_input::mouse::MouseButton, crate = crate, export = false)] + #[specta(remote = bevy_input::mouse::MouseButton, crate = crate, collect = false)] #[allow(dead_code)] pub enum MouseButton { Left, @@ -509,7 +509,7 @@ const _: () = { } #[derive(Type)] - #[specta(remote = bevy_input::mouse::MouseWheel, crate = crate, export = false)] + #[specta(remote = bevy_input::mouse::MouseWheel, crate = crate, collect = false)] #[allow(dead_code)] pub struct MouseWheel { pub unit: bevy_input::mouse::MouseScrollUnit, @@ -519,7 +519,7 @@ const _: () = { } #[derive(Type)] - #[specta(remote = bevy_input::mouse::MouseScrollUnit, crate = crate, export = false)] + #[specta(remote = bevy_input::mouse::MouseScrollUnit, crate = crate, collect = false)] #[allow(dead_code)] pub enum MouseScrollUnit { Line, @@ -527,7 +527,7 @@ const _: () = { } #[derive(Type)] - #[specta(remote = bevy_input::mouse::MouseMotion, crate = crate, export = false)] + #[specta(remote = bevy_input::mouse::MouseMotion, crate = crate, collect = false)] #[allow(dead_code)] pub struct MouseMotion { pub delta: glam::Vec2, diff --git a/tests/tests/advanced_types.rs b/tests/tests/advanced_types.rs index 1db1056..3751101 100644 --- a/tests/tests/advanced_types.rs +++ b/tests/tests/advanced_types.rs @@ -7,7 +7,7 @@ use specta::Type; use crate::ts::{assert_ts, assert_ts_export2}; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Demo { a: A, b: B, @@ -25,7 +25,7 @@ type MapB = HashMap; type MapC = HashMap>; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Struct { field: HalfGenericA, } @@ -49,19 +49,19 @@ fn test_type_aliases() { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct D { flattened: u32, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct GenericFlattened { generic_flattened: T, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct C { a: u32, #[specta(flatten)] @@ -69,13 +69,13 @@ struct C { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct B { b: u32, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct A { a: B, #[specta(inline)] @@ -89,13 +89,13 @@ struct A { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct ToBeFlattened { a: String, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct DoubleFlattened { #[specta(flatten)] a: ToBeFlattened, @@ -104,7 +104,7 @@ struct DoubleFlattened { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Inner { a: i32, #[specta(flatten)] @@ -112,27 +112,27 @@ struct Inner { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct FlattenedInner { #[specta(flatten)] c: Inner, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct BoxedInner { a: i32, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct BoxFlattened { #[specta(flatten)] b: Box, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct BoxInline { #[specta(inline)] c: Box, diff --git a/tests/tests/bigints.rs b/tests/tests/bigints.rs index f6632a4..b4c9780 100644 --- a/tests/tests/bigints.rs +++ b/tests/tests/bigints.rs @@ -14,13 +14,13 @@ macro_rules! for_bigint_types { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct StructWithBigInt { pub a: i128, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct StructWithStructWithBigInt { #[specta(inline)] // Inline required so reference is not used and error is part of parent @@ -28,7 +28,7 @@ pub struct StructWithStructWithBigInt { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct StructWithStructWithStructWithBigInt { #[specta(inline)] // Inline required so reference is not used and error is part of parent @@ -36,14 +36,14 @@ pub struct StructWithStructWithStructWithBigInt { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct StructWithOptionWithStructWithBigInt { #[specta(inline)] // Inline required so reference is not used and error is part of parent pub optional_field: Option, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum EnumWithStructWithStructWithBigInt { #[specta(inline)] @@ -51,7 +51,7 @@ pub enum EnumWithStructWithStructWithBigInt { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum EnumWithInlineStructWithBigInt { #[specta(inline)] diff --git a/tests/tests/comments.rs b/tests/tests/comments.rs index 18c6629..47b5b8e 100644 --- a/tests/tests/comments.rs +++ b/tests/tests/comments.rs @@ -6,7 +6,7 @@ use crate::ts::assert_ts_export; /// Some triple-slash comment /// Some more triple-slash comment #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct CommentedStruct { // Some double-slash comment which is ignored /// Some triple-slash comment @@ -18,7 +18,7 @@ pub struct CommentedStruct { /// Some triple-slash comment /// Some more triple-slash comment #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum CommentedEnum { // Some double-slash comment which is ignored /// Some triple-slash comment @@ -37,7 +37,7 @@ pub enum CommentedEnum { /// Some single-line comment #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum SingleLineComment { /// Some single-line comment A(i32), diff --git a/tests/tests/datatype.rs b/tests/tests/datatype.rs index 0fe3810..78e8ee2 100644 --- a/tests/tests/datatype.rs +++ b/tests/tests/datatype.rs @@ -14,7 +14,7 @@ // // Testing using `DataTypeFrom` and `Type` together. // #[derive(DataTypeFrom, specta::Type)] // This derive bit gets passed into the macro -// #[specta(export = false)] +// #[specta(collect = false)] // #[specta(rename = "ProceduresDef")] // struct Procedures3 { // #[specta(type = String)] // This is a lie but just for the test diff --git a/tests/tests/deprecated.rs b/tests/tests/deprecated.rs index 9a53855..c421e98 100644 --- a/tests/tests/deprecated.rs +++ b/tests/tests/deprecated.rs @@ -5,28 +5,28 @@ use specta::Type; use crate::ts::assert_ts_export; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[deprecated] struct DeprecatedType { a: i32, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[deprecated = "Look at you big man using a deprecation message"] struct DeprecatedTypeWithMsg { a: i32, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[deprecated(note = "Look at you big man using a deprecation message")] struct DeprecatedTypeWithMsg2 { a: i32, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct DeprecatedFields { a: i32, #[deprecated] @@ -38,7 +38,7 @@ struct DeprecatedFields { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct DeprecatedTupleVariant( #[deprecated] String, #[deprecated = "Nope"] String, @@ -46,7 +46,7 @@ pub struct DeprecatedTupleVariant( ); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum DeprecatedEnumVariants { #[deprecated] A, diff --git a/tests/tests/duplicate_ty_name.rs b/tests/tests/duplicate_ty_name.rs index 2e87cb7..0d02664 100644 --- a/tests/tests/duplicate_ty_name.rs +++ b/tests/tests/duplicate_ty_name.rs @@ -5,7 +5,7 @@ mod one { use super::*; #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] pub struct One { pub a: String, } @@ -15,7 +15,7 @@ mod two { use super::*; #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] pub struct One { pub b: String, pub c: i32, @@ -23,7 +23,7 @@ mod two { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct Demo { pub one: one::One, pub two: two::One, diff --git a/tests/tests/export.rs b/tests/tests/export.rs index 59fedc9..8641b30 100644 --- a/tests/tests/export.rs +++ b/tests/tests/export.rs @@ -14,7 +14,7 @@ pub struct TypeTwo { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct NotExported { pub b: i32, } @@ -27,7 +27,7 @@ pub struct ReferingToUnexportedType { } // TODO: Enable this test on Windows again. It's ordering of types is different for seemingly no reason. -#[cfg(all(not(target_os = "windows"), all(feature = "export", feature = "ts")))] +#[cfg(all(not(target_os = "windows"), all(feature = "collect", feature = "ts")))] #[test] fn test_export_feature() { use specta::{ diff --git a/tests/tests/flatten_and_inline.rs b/tests/tests/flatten_and_inline.rs index 2f932c6..1225c2e 100644 --- a/tests/tests/flatten_and_inline.rs +++ b/tests/tests/flatten_and_inline.rs @@ -5,19 +5,19 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct A { pub a: String, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct AA { pub a: i32, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct B { #[specta(flatten)] pub a: A, @@ -28,7 +28,7 @@ pub struct B { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct C { #[specta(flatten)] pub a: A, @@ -37,7 +37,7 @@ pub struct C { } #[derive(Type)] -#[specta(export = false, tag = "type")] +#[specta(collect = false, tag = "type")] pub struct D { #[specta(flatten)] pub a: A, @@ -46,7 +46,7 @@ pub struct D { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[serde(untagged)] pub struct E { #[specta(flatten)] @@ -57,7 +57,7 @@ pub struct E { // Flattening a struct multiple times #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct F { #[specta(flatten)] pub a: A, @@ -67,7 +67,7 @@ pub struct F { // Two fields with the same name (`a`) but different types #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct G { #[specta(flatten)] pub a: A, @@ -77,7 +77,7 @@ pub struct G { // Serde can't serialize this #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum H { A(String), B, @@ -85,7 +85,7 @@ pub enum H { // TODO: Invalid Serde type but unit test this at the datamodel level cause it might be valid in other langs. // #[derive(Type)] -// #[specta(export = false, tag = "type")] +// #[specta(collect = false, tag = "type")] // pub enum I { // A(String), // B, @@ -95,7 +95,7 @@ pub enum H { // } #[derive(Type)] -#[specta(export = false, tag = "t", content = "c")] +#[specta(collect = false, tag = "t", content = "c")] pub enum J { A(String), B, @@ -105,7 +105,7 @@ pub enum J { } #[derive(Type)] -#[specta(export = false, untagged)] +#[specta(collect = false, untagged)] pub enum K { A(String), B, diff --git a/tests/tests/functions.rs b/tests/tests/functions.rs index 7d520cb..6105517 100644 --- a/tests/tests/functions.rs +++ b/tests/tests/functions.rs @@ -55,7 +55,7 @@ mod test { } #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] pub struct Demo { pub demo: String, } diff --git a/tests/tests/macro_decls.rs b/tests/tests/macro_decls.rs index d33dfcf..a39fdba 100644 --- a/tests/tests/macro_decls.rs +++ b/tests/tests/macro_decls.rs @@ -9,17 +9,17 @@ macro_rules! field_ty_macro { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct MacroStruct(field_ty_macro!()); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct MacroStruct2 { demo: field_ty_macro!(), } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum MacroEnum { Demo(field_ty_macro!()), Demo2 { demo2: field_ty_macro!() }, diff --git a/tests/tests/map_keys.rs b/tests/tests/map_keys.rs index 74e678c..5593de2 100644 --- a/tests/tests/map_keys.rs +++ b/tests/tests/map_keys.rs @@ -8,21 +8,21 @@ use crate::ts::{assert_ts, assert_ts_export}; // Export needs a `NamedDataType` but uses `Type::reference` instead of `Type::inline` so we test it. #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Regular(HashMap); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct RegularStruct { a: String, } #[derive(Type)] -#[specta(export = false, transparent)] +#[specta(collect = false, transparent)] struct TransparentStruct(String); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] enum UnitVariants { A, B, @@ -30,7 +30,7 @@ enum UnitVariants { } #[derive(Type)] -#[specta(export = false, untagged)] +#[specta(collect = false, untagged)] enum UntaggedVariants { A(String), B(i32), @@ -38,7 +38,7 @@ enum UntaggedVariants { } #[derive(Type)] -#[specta(export = false, untagged)] +#[specta(collect = false, untagged)] enum InvalidUntaggedVariants { A(String), B(i32, String), @@ -46,7 +46,7 @@ enum InvalidUntaggedVariants { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] enum Variants { A(String), B(i32), @@ -54,23 +54,23 @@ enum Variants { } #[derive(Type)] -#[specta(export = false, transparent)] +#[specta(collect = false, transparent)] pub struct MaybeValidKey(T); #[derive(Type)] -#[specta(export = false, transparent)] +#[specta(collect = false, transparent)] pub struct ValidMaybeValidKey(HashMap, ()>); #[derive(Type)] -#[specta(export = false, transparent)] +#[specta(collect = false, transparent)] pub struct ValidMaybeValidKeyNested(HashMap>, ()>); #[derive(Type)] -#[specta(export = false, transparent)] +#[specta(collect = false, transparent)] pub struct InvalidMaybeValidKey(HashMap, ()>); #[derive(Type)] -#[specta(export = false, transparent)] +#[specta(collect = false, transparent)] pub struct InvalidMaybeValidKeyNested(HashMap>, ()>); #[test] diff --git a/tests/tests/optional.rs b/tests/tests/optional.rs index cefa8bf..b0280ea 100644 --- a/tests/tests/optional.rs +++ b/tests/tests/optional.rs @@ -3,26 +3,26 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct NonOptional(Option); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct OptionalOnNamedField(#[specta(optional)] Option); // Should do nothing #[derive(Type)] -#[specta(export = false, transparent, inline)] +#[specta(collect = false, transparent, inline)] struct OptionalOnTransparentNamedFieldInner(#[specta(optional)] Option); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct OptionalOnTransparentNamedField { // Now it should work b: OptionalOnTransparentNamedFieldInner, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] enum OptionalInEnum { // Should do nothing A(#[specta(optional)] Option), diff --git a/tests/tests/recursive.rs b/tests/tests/recursive.rs index e1b7518..0b22716 100644 --- a/tests/tests/recursive.rs +++ b/tests/tests/recursive.rs @@ -7,40 +7,40 @@ use specta_typescript::Error; use crate::ts::{assert_ts, assert_ts_export}; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct Recursive { demo: Box, } #[derive(Type)] -#[specta(transparent, export = false)] +#[specta(transparent, collect = false)] pub struct RecursiveMapKeyTrick(RecursiveMapKey); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct RecursiveMapKey { demo: HashMap, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct RecursiveMapValue { demo: HashMap, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct RecursiveInline { #[specta(flatten)] demo: Box, } #[derive(Type)] -#[specta(transparent, export = false)] +#[specta(transparent, collect = false)] pub struct RecursiveTransparent(Box); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum RecursiveInEnum { A { #[specta(flatten)] diff --git a/tests/tests/rename.rs b/tests/tests/rename.rs index 55e08a4..dc84a1d 100644 --- a/tests/tests/rename.rs +++ b/tests/tests/rename.rs @@ -3,27 +3,27 @@ use specta::Type; use crate::ts::{assert_ts, assert_ts_export}; #[derive(Type)] -#[specta(export = false, rename = "StructNew", tag = "t")] +#[specta(collect = false, rename = "StructNew", tag = "t")] pub struct Struct { a: String, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct Struct2 { #[specta(rename = "b")] a: String, } #[derive(Type)] -#[specta(export = false, rename = "EnumNew", tag = "t")] +#[specta(collect = false, rename = "EnumNew", tag = "t")] pub enum Enum { A, B, } #[derive(Type)] -#[specta(export = false, rename = "EnumNew", tag = "t")] +#[specta(collect = false, rename = "EnumNew", tag = "t")] pub enum Enum2 { #[specta(rename = "C")] A, @@ -31,7 +31,7 @@ pub enum Enum2 { } #[derive(Type)] -#[specta(export = false, rename = "EnumNew", tag = "t")] +#[specta(collect = false, rename = "EnumNew", tag = "t")] pub enum Enum3 { A { #[specta(rename = "b")] diff --git a/tests/tests/reserved_keywords.rs b/tests/tests/reserved_keywords.rs index 5cef17c..43729bd 100644 --- a/tests/tests/reserved_keywords.rs +++ b/tests/tests/reserved_keywords.rs @@ -9,7 +9,7 @@ mod astruct { // Typescript reserved type name #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] #[allow(non_camel_case_types)] pub struct r#enum { a: String, @@ -21,7 +21,7 @@ mod atuplestruct { // Typescript reserved type name #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] #[allow(non_camel_case_types)] pub struct r#enum(String); } @@ -31,7 +31,7 @@ mod aenum { // Typescript reserved type name #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] #[allow(non_camel_case_types)] pub enum r#enum { A(String), diff --git a/tests/tests/serde/adjacently_tagged.rs b/tests/tests/serde/adjacently_tagged.rs index dcf8134..6d68453 100644 --- a/tests/tests/serde/adjacently_tagged.rs +++ b/tests/tests/serde/adjacently_tagged.rs @@ -3,7 +3,7 @@ use specta::Type; use crate::ts::{assert_ts_export2, assert_ts_inline2}; #[derive(Type)] -#[specta(export = false, tag = "t", content = "c")] +#[specta(collect = false, tag = "t", content = "c")] enum A { A, B { id: String, method: String }, diff --git a/tests/tests/serde/empty_enum.rs b/tests/tests/serde/empty_enum.rs index 7cf1bf5..b57b2bb 100644 --- a/tests/tests/serde/empty_enum.rs +++ b/tests/tests/serde/empty_enum.rs @@ -3,56 +3,56 @@ use specta::Type; use crate::ts::assert_ts_inline2; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] enum A {} #[derive(Type)] -#[specta(export = false, tag = "a")] +#[specta(collect = false, tag = "a")] enum B {} #[derive(Type)] -#[specta(export = false, tag = "a", content = "b")] +#[specta(collect = false, tag = "a", content = "b")] enum C {} #[derive(Type)] -#[specta(export = false, untagged)] +#[specta(collect = false, untagged)] enum D {} #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct Inner; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct Inner2 {} #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct Inner3(); #[derive(Type)] -#[specta(export = false, tag = "a")] +#[specta(collect = false, tag = "a")] enum E { A(Inner), B(Inner), } #[derive(Type)] -#[specta(export = false, tag = "a")] +#[specta(collect = false, tag = "a")] enum F { A(Inner2), B(Inner2), } #[derive(Type)] -#[specta(export = false, tag = "a")] +#[specta(collect = false, tag = "a")] enum G { A(Inner3), B(Inner3), } #[derive(Type)] -#[specta(export = false, tag = "a")] +#[specta(collect = false, tag = "a")] enum H { #[specta(skip)] A(Inner3), @@ -60,11 +60,11 @@ enum H { } #[derive(Type)] -#[specta(export = false, transparent)] +#[specta(collect = false, transparent)] pub struct Demo(()); #[derive(Type)] -#[specta(export = false, tag = "a")] +#[specta(collect = false, tag = "a")] enum I { A(Demo), B(Demo), diff --git a/tests/tests/serde/empty_struct.rs b/tests/tests/serde/empty_struct.rs index c89da23..3784108 100644 --- a/tests/tests/serde/empty_struct.rs +++ b/tests/tests/serde/empty_struct.rs @@ -3,11 +3,11 @@ use specta::Type; use crate::ts::{assert_ts_export2, assert_ts_inline2}; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct A {} #[derive(Type)] -#[specta(export = false, tag = "a")] +#[specta(collect = false, tag = "a")] struct B {} // https://github.com/oscartbeaumont/specta/issues/174 diff --git a/tests/tests/serde/externally_tagged.rs b/tests/tests/serde/externally_tagged.rs index 2e5b90d..5b6c070 100644 --- a/tests/tests/serde/externally_tagged.rs +++ b/tests/tests/serde/externally_tagged.rs @@ -3,7 +3,7 @@ use specta::Type; use crate::ts::assert_ts_inline2; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] enum A { A, B { id: String, method: String }, diff --git a/tests/tests/serde/internally_tagged.rs b/tests/tests/serde/internally_tagged.rs index 25ab1c5..0b3af89 100644 --- a/tests/tests/serde/internally_tagged.rs +++ b/tests/tests/serde/internally_tagged.rs @@ -6,90 +6,90 @@ use crate::ts::assert_ts_inline2; // This type won't even compile with Serde macros #[derive(Type)] -#[serde(export = false, tag = "type")] +#[serde(collect = false, tag = "type")] pub enum A { // For internal tagging all variants must be a unit, named or *unnamed with a single variant*. A(String, u32), } #[derive(Type)] -#[serde(export = false, tag = "type")] +#[serde(collect = false, tag = "type")] pub enum B { // Is not a map-type so invalid. A(String), } #[derive(Type)] -#[serde(export = false, tag = "type")] +#[serde(collect = false, tag = "type")] pub enum C { // Is not a map-type so invalid. A(Vec), } #[derive(Type)] -#[serde(export = false, tag = "type")] +#[serde(collect = false, tag = "type")] pub enum D { // Is a map type so valid. A(HashMap), } #[derive(Type)] -#[serde(export = false, tag = "type")] +#[serde(collect = false, tag = "type")] pub enum E { // Null is valid (although it's not a map-type) A(()), } #[derive(Type)] -#[serde(export = false, tag = "type")] +#[serde(collect = false, tag = "type")] pub enum F { // `FInner` is untagged so this is *only* valid if it is (which it is) A(FInner), } #[derive(Type)] -#[serde(export = false, untagged)] +#[serde(collect = false, untagged)] pub enum FInner { A(()), } #[derive(Type)] -#[serde(export = false, tag = "type")] +#[serde(collect = false, tag = "type")] pub enum G { // `GInner` is untagged so this is *only* valid if it is (which it is not) A(GInner), } #[derive(Type)] -#[serde(export = false, untagged)] +#[serde(collect = false, untagged)] pub enum GInner { A(String), } #[derive(Type)] -#[serde(export = false, tag = "type")] +#[serde(collect = false, tag = "type")] pub enum H { // `HInner` is transparent so this is *only* valid if it is (which it is) A(HInner), } #[derive(Type)] -#[serde(export = false, transparent)] +#[serde(collect = false, transparent)] pub struct HInner(()); #[derive(Type)] -#[serde(export = false, tag = "type")] +#[serde(collect = false, tag = "type")] pub enum I { // `IInner` is transparent so this is *only* valid if it is (which it is not) A(IInner), } #[derive(Type)] -#[serde(export = false, transparent)] +#[serde(collect = false, transparent)] pub struct IInner(String); #[derive(Type)] -#[serde(export = false, tag = "type")] +#[serde(collect = false, tag = "type")] pub enum L { // Internally tag enum with inlined field that is itself internally tagged #[specta(inline)] @@ -97,14 +97,14 @@ pub enum L { } #[derive(Type)] -#[serde(export = false, tag = "type")] +#[serde(collect = false, tag = "type")] pub enum LInner { A, B, } #[derive(Type)] -#[serde(export = false, tag = "type")] +#[serde(collect = false, tag = "type")] pub enum M { // Internally tag enum with inlined field that is untagged // `MInner` is `null` - Test `B` in `untagged.rs` @@ -113,7 +113,7 @@ pub enum M { } #[derive(Type)] -#[serde(export = false, untagged)] +#[serde(collect = false, untagged)] pub enum MInner { A, B, diff --git a/tests/tests/serde/skip.rs b/tests/tests/serde/skip.rs index 67cc391..a790f41 100644 --- a/tests/tests/serde/skip.rs +++ b/tests/tests/serde/skip.rs @@ -5,14 +5,14 @@ use specta::Type; use crate::ts::assert_ts_inline2; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct SkipOnlyField { #[specta(skip)] a: String, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct SkipField { #[specta(skip)] a: String, @@ -20,35 +20,35 @@ pub struct SkipField { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum SkipOnlyVariantExternallyTagged { #[specta(skip)] A(String), } #[derive(Type)] -#[specta(export = false, tag = "t")] +#[specta(collect = false, tag = "t")] pub enum SkipOnlyVariantInternallyTagged { #[specta(skip)] A(String), } #[derive(Type)] -#[specta(export = false, tag = "t", content = "c")] +#[specta(collect = false, tag = "t", content = "c")] pub enum SkipOnlyVariantAdjacentlyTagged { #[specta(skip)] A(String), } #[derive(Type)] -#[specta(export = false, untagged)] +#[specta(collect = false, untagged)] pub enum SkipOnlyVariantUntagged { #[specta(skip)] A(String), } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum SkipVariant { #[specta(skip)] A(String), @@ -56,7 +56,7 @@ pub enum SkipVariant { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum SkipUnnamedFieldInVariant { // only field A(#[specta(skip)] String), @@ -67,7 +67,7 @@ pub enum SkipUnnamedFieldInVariant { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum SkipNamedFieldInVariant { // only field A { @@ -84,23 +84,23 @@ pub enum SkipNamedFieldInVariant { // https://github.com/oscartbeaumont/specta/issues/170 #[derive(Type)] -#[specta(transparent, export = false)] +#[specta(transparent, collect = false)] pub struct TransparentWithSkip((), #[specta(skip)] String); // https://github.com/oscartbeaumont/specta/issues/170 #[derive(Type)] -#[specta(transparent, export = false)] +#[specta(transparent, collect = false)] pub struct TransparentWithSkip2(#[specta(skip)] (), String); // https://github.com/oscartbeaumont/specta/issues/170 #[derive(Type)] -#[specta(transparent, export = false)] +#[specta(transparent, collect = false)] pub struct TransparentWithSkip3(#[specta(type = String)] Box); /// This is intentionally just a compile or not compile test /// https://github.com/oscartbeaumont/specta/issues/167 #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum LazilySkip { #[specta(skip)] A(Box), diff --git a/tests/tests/serde/untagged.rs b/tests/tests/serde/untagged.rs index 77195b9..35e0e79 100644 --- a/tests/tests/serde/untagged.rs +++ b/tests/tests/serde/untagged.rs @@ -3,7 +3,7 @@ use specta::Type; use crate::ts::assert_ts_inline2; #[derive(Type)] -#[specta(export = false, untagged)] +#[specta(collect = false, untagged)] enum A { A { id: String }, C(String), @@ -11,7 +11,7 @@ enum A { } #[derive(Type)] -#[serde(export = false, untagged)] +#[serde(collect = false, untagged)] pub enum B { A, B, diff --git a/tests/tests/sid.rs b/tests/tests/sid.rs index 74e5e63..eb11eb0 100644 --- a/tests/tests/sid.rs +++ b/tests/tests/sid.rs @@ -1,23 +1,23 @@ use specta::{Type, TypeCollection}; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct A {} #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct B {} #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct C {} #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct Z {} #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct BagOfTypes { // Fields are outta order intentionally so we don't fluke the test a: A, diff --git a/tests/tests/transparent.rs b/tests/tests/transparent.rs index 8179f95..5dd143c 100644 --- a/tests/tests/transparent.rs +++ b/tests/tests/transparent.rs @@ -6,20 +6,20 @@ use specta::{ use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false, transparent)] +#[specta(collect = false, transparent)] struct TupleStruct(String); #[repr(transparent)] #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct TupleStructWithRep(String); #[derive(Type)] -#[specta(export = false, transparent)] +#[specta(collect = false, transparent)] struct GenericTupleStruct(T); #[derive(Type)] -#[specta(export = false, transparent)] +#[specta(collect = false, transparent)] pub struct BracedStruct { a: String, } diff --git a/tests/tests/ts.rs b/tests/tests/ts.rs index 5036329..3f45758 100644 --- a/tests/tests/ts.rs +++ b/tests/tests/ts.rs @@ -413,41 +413,41 @@ fn typescript_types() { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Unit1; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Unit2 {} #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Unit3(); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Unit4(()); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] enum Unit5 { A, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] enum Unit6 { A(), } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] enum Unit7 { A {}, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct SimpleStruct { a: i32, b: String, @@ -457,20 +457,20 @@ struct SimpleStruct { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct TupleStruct1(i32); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct TupleStruct3(i32, bool, String); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[specta(rename = "HasBeenRenamed")] struct RenamedStruct; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] enum TestEnum { Unit, Single(i32), @@ -479,18 +479,18 @@ enum TestEnum { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct RefStruct(TestEnum); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct InlineStruct { ref_struct: SimpleStruct, val: i32, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct InlinerStruct { #[specta(inline)] inline_this: InlineStruct, @@ -498,13 +498,13 @@ struct InlinerStruct { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct GenericStruct { arg: T, } #[derive(Serialize, Type)] -#[specta(export = false)] +#[specta(collect = false)] struct FlattenEnumStruct { outer: String, #[serde(flatten)] @@ -512,7 +512,7 @@ struct FlattenEnumStruct { } #[derive(Serialize, Type)] -#[specta(export = false)] +#[specta(collect = false)] #[serde(tag = "tag", content = "test")] enum FlattenEnum { One, @@ -521,20 +521,20 @@ enum FlattenEnum { } #[derive(Serialize, Type)] -#[specta(export = false)] +#[specta(collect = false)] struct OverridenStruct { #[specta(type = String)] overriden_field: i32, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct HasGenericAlias(GenericAlias); type GenericAlias = std::collections::HashMap; #[derive(Serialize, Type)] -#[specta(export = false)] +#[specta(collect = false)] enum SkipVariant { A(String), #[serde(skip)] @@ -544,7 +544,7 @@ enum SkipVariant { } #[derive(Serialize, Type)] -#[specta(export = false)] +#[specta(collect = false)] #[serde(tag = "tag", content = "data")] enum SkipVariant2 { A(String), @@ -555,7 +555,7 @@ enum SkipVariant2 { } #[derive(Serialize, Type)] -#[specta(export = false)] +#[specta(collect = false)] enum SkipVariant3 { A { a: String, @@ -571,7 +571,7 @@ enum SkipVariant3 { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum EnumMacroAttributes { A(#[specta(type = String)] i32), #[specta(rename = "bbb")] @@ -587,20 +587,20 @@ pub enum EnumMacroAttributes { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct PlaceholderInnerField { a: String, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct Recursive { a: i32, children: Vec, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub enum InlineEnumField { #[specta(inline)] @@ -608,7 +608,7 @@ pub enum InlineEnumField { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct InlineOptionalType { #[specta(inline)] pub optional_field: Option, @@ -620,7 +620,7 @@ const FIELD_NAME: &str = "demo_new_name"; // This is very much an advanced API. It is not recommended to use this unless you know what your doing. // For personal reference: Is used in PCR to apply an inflection to the dynamic name of the include/select macro. #[derive(Type)] -#[specta(export = false, rename_from_path = CONTAINER_NAME)] +#[specta(collect = false, rename_from_path = CONTAINER_NAME)] pub struct RenameToValue { #[specta(rename_from_path = FIELD_NAME)] pub demo: i32, @@ -628,7 +628,7 @@ pub struct RenameToValue { // Regression test for https://github.com/oscartbeaumont/specta/issues/56 #[derive(Type, serde::Serialize)] -#[specta(export = false)] +#[specta(collect = false)] enum Rename { OneWord, #[serde(rename = "Two words")] @@ -636,18 +636,18 @@ enum Rename { } #[derive(Type, serde::Serialize)] -#[specta(export = false)] +#[specta(collect = false)] pub struct TransparentTypeInner { inner: String, } #[derive(Type, serde::Serialize)] -#[specta(export = false)] +#[specta(collect = false)] #[serde(transparent)] pub struct TransparentType(pub(crate) TransparentTypeInner); #[derive(Type, serde::Serialize)] -#[specta(export = false)] +#[specta(collect = false)] #[serde(transparent)] pub struct TransparentType2(pub(crate) ()); @@ -655,12 +655,12 @@ pub struct TransparentType2(pub(crate) ()); pub struct NonTypeType; #[derive(Type, serde::Serialize)] -#[specta(export = false)] +#[specta(collect = false)] #[serde(transparent)] pub struct TransparentTypeWithOverride(#[specta(type = String)] NonTypeType); #[derive(Type, serde::Serialize)] -#[specta(export = false)] +#[specta(collect = false)] pub enum BasicEnum { A, B, @@ -668,7 +668,7 @@ pub enum BasicEnum { #[derive(Type)] #[serde( - export = false, + collect = false, tag = "type", content = "value", rename_all = "camelCase" @@ -679,7 +679,7 @@ pub enum NestedEnum { } #[derive(Type)] -#[serde(export = false, rename_all = "camelCase")] +#[serde(collect = false, rename_all = "camelCase")] pub struct FlattenOnNestedEnum { id: String, #[serde(flatten)] @@ -687,31 +687,31 @@ pub struct FlattenOnNestedEnum { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct EnumReferenceRecordKey { a: HashMap, } // https://github.com/oscartbeaumont/specta/issues/88 #[derive(Type)] -#[serde(export = false, rename_all = "camelCase")] +#[serde(collect = false, rename_all = "camelCase")] #[serde(default)] pub(super) struct MyEmptyInput {} #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[allow(unused_parens)] pub enum ExtraBracketsInTupleVariant { A((String)), } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[allow(unused_parens)] pub struct ExtraBracketsInUnnamedStruct((String)); #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[allow(unused_parens)] pub struct RenameWithWeirdCharsField { #[specta(rename = "@odata.context")] @@ -719,7 +719,7 @@ pub struct RenameWithWeirdCharsField { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[allow(unused_parens)] pub enum RenameWithWeirdCharsVariant { #[specta(rename = "@odata.context")] @@ -727,11 +727,11 @@ pub enum RenameWithWeirdCharsVariant { } #[derive(Type)] -#[specta(export = false, rename = "@odata.context")] +#[specta(collect = false, rename = "@odata.context")] pub struct RenameWithWeirdCharsStruct(String); #[derive(Type)] -#[specta(export = false, rename = "@odata.context")] +#[specta(collect = false, rename = "@odata.context")] pub enum RenameWithWeirdCharsEnum {} #[derive(Type)] diff --git a/tests/tests/ts_rs/arrays.rs b/tests/tests/ts_rs/arrays.rs index 025f06c..39a6c41 100644 --- a/tests/tests/ts_rs/arrays.rs +++ b/tests/tests/ts_rs/arrays.rs @@ -9,7 +9,7 @@ fn free() { #[test] fn interface() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct Interface { #[allow(dead_code)] a: [i32; 3], @@ -21,7 +21,7 @@ fn interface() { #[test] fn newtype() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct Newtype(#[allow(dead_code)] [i32; 3]); assert_ts!(Newtype, "[number, number, number]") diff --git a/tests/tests/ts_rs/chrono.rs b/tests/tests/ts_rs/chrono.rs index a055a43..e4a8dcd 100644 --- a/tests/tests/ts_rs/chrono.rs +++ b/tests/tests/ts_rs/chrono.rs @@ -10,7 +10,7 @@ use crate::ts::assert_ts; #[test] fn chrono() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] #[allow(dead_code)] struct Chrono { date: (NaiveDate, Date, Date, Date), diff --git a/tests/tests/ts_rs/field_rename.rs b/tests/tests/ts_rs/field_rename.rs index ab49f8b..a500785 100644 --- a/tests/tests/ts_rs/field_rename.rs +++ b/tests/tests/ts_rs/field_rename.rs @@ -4,7 +4,7 @@ use crate::ts::assert_ts; use specta::Type; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Rename1 { a: i32, #[specta(rename = "bb")] diff --git a/tests/tests/ts_rs/flatten.rs b/tests/tests/ts_rs/flatten.rs index 8aa4c2b..de3aad3 100644 --- a/tests/tests/ts_rs/flatten.rs +++ b/tests/tests/ts_rs/flatten.rs @@ -5,14 +5,14 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct FlattenA { a: i32, b: i32, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct FlattenB { #[specta(flatten)] a: FlattenA, @@ -20,7 +20,7 @@ struct FlattenB { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct FlattenC { #[specta(flatten = true)] a: FlattenA, @@ -28,7 +28,7 @@ struct FlattenC { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct FlattenD { #[specta(flatten = false)] a: FlattenA, @@ -36,7 +36,7 @@ struct FlattenD { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct FlattenE { #[specta(inline)] b: FlattenB, @@ -44,7 +44,7 @@ struct FlattenE { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct FlattenF { #[specta(inline = true)] b: FlattenB, @@ -52,7 +52,7 @@ struct FlattenF { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct FlattenG { #[specta(inline = false)] b: FlattenB, diff --git a/tests/tests/ts_rs/generic_fields.rs b/tests/tests/ts_rs/generic_fields.rs index 4566794..e2c7f3f 100644 --- a/tests/tests/ts_rs/generic_fields.rs +++ b/tests/tests/ts_rs/generic_fields.rs @@ -8,7 +8,7 @@ use specta::Type; #[test] fn newtype() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct Newtype1(Vec>); assert_ts!(Newtype1, "number[]"); } @@ -16,7 +16,7 @@ fn newtype() { #[test] fn newtype_nested() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct Newtype2(Vec>); assert_ts!(Newtype2, "number[][]"); } @@ -36,7 +36,7 @@ fn alias_nested() { #[test] fn named() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct Struct1 { a: Box>, b: (Vec, Vec), @@ -51,7 +51,7 @@ fn named() { #[test] fn named_nested() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct Struct2 { a: Vec>, b: (Vec>, Vec>), @@ -66,7 +66,7 @@ fn named_nested() { #[test] fn tuple() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct Tuple1(Vec, (Vec, Vec), [Vec; 3]); assert_ts!( Tuple1, @@ -77,7 +77,7 @@ fn tuple() { #[test] fn tuple_nested() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct Tuple2( Vec>, (Vec>, Vec>), diff --git a/tests/tests/ts_rs/generics.rs b/tests/tests/ts_rs/generics.rs index e33682b..680b63c 100644 --- a/tests/tests/ts_rs/generics.rs +++ b/tests/tests/ts_rs/generics.rs @@ -9,28 +9,28 @@ use crate::ts::assert_ts_export; use specta::Type; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Generic1 { value: T, values: Vec, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct GenericAutoBound { value: T, values: Vec, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct GenericAutoBound2 { value: T, values: Vec, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Container1 { foo: Generic1, bar: Box>>, @@ -63,7 +63,7 @@ fn test() { #[test] fn generic_enum() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] enum Generic2 { A(A), B(B, B, B), @@ -84,7 +84,7 @@ fn generic_enum() { #[test] fn generic_newtype() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct NewType1(Vec>); assert_ts_export!(NewType1::<()>, r#"export type NewType1 = T[][];"#); @@ -93,7 +93,7 @@ fn generic_newtype() { #[test] fn generic_tuple() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct Tuple(T, Vec, Vec>); assert_ts_export!(Tuple::<()>, r#"export type Tuple = [T, T[], T[][]];"#); @@ -102,7 +102,7 @@ fn generic_tuple() { #[test] fn generic_struct() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct GenericStruct2 { a: T, b: (T, T), @@ -124,13 +124,13 @@ fn generic_struct() { #[test] fn inline() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct Generic { t: T, } #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct Container { g: Generic, #[specta(inline)] @@ -149,7 +149,7 @@ fn inline() { // #[test] // fn default() { // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // struct A { // t: T, // } @@ -159,7 +159,7 @@ fn inline() { // ); // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // struct B>> { // u: U, // } @@ -169,7 +169,7 @@ fn inline() { // ); // #[derive(Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // struct Y { // a1: A, // a2: A, diff --git a/tests/tests/ts_rs/indexmap.rs b/tests/tests/ts_rs/indexmap.rs index 4cd3a14..633a81d 100644 --- a/tests/tests/ts_rs/indexmap.rs +++ b/tests/tests/ts_rs/indexmap.rs @@ -8,7 +8,7 @@ use crate::ts::assert_ts; #[test] fn indexmap() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] #[allow(dead_code)] struct Indexes { map: IndexMap, diff --git a/tests/tests/ts_rs/list.rs b/tests/tests/ts_rs/list.rs index 61ed115..d473c43 100644 --- a/tests/tests/ts_rs/list.rs +++ b/tests/tests/ts_rs/list.rs @@ -5,7 +5,7 @@ use crate::ts::assert_ts; #[test] fn list() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct List { #[allow(dead_code)] data: Option>, diff --git a/tests/tests/ts_rs/nested.rs b/tests/tests/ts_rs/nested.rs index 755b10d..2a76356 100644 --- a/tests/tests/ts_rs/nested.rs +++ b/tests/tests/ts_rs/nested.rs @@ -5,14 +5,14 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct D { x1: Arc, y1: Cell, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct E { a1: Box, #[specta(inline)] @@ -20,7 +20,7 @@ struct E { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct F { b1: Rc, #[specta(inline)] diff --git a/tests/tests/ts_rs/optional_field.rs b/tests/tests/ts_rs/optional_field.rs index 847e515..2f1be5c 100644 --- a/tests/tests/ts_rs/optional_field.rs +++ b/tests/tests/ts_rs/optional_field.rs @@ -3,7 +3,7 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Optional { a: Option, #[specta(optional)] diff --git a/tests/tests/ts_rs/raw_idents.rs b/tests/tests/ts_rs/raw_idents.rs index de5c7e7..8eea945 100644 --- a/tests/tests/ts_rs/raw_idents.rs +++ b/tests/tests/ts_rs/raw_idents.rs @@ -4,7 +4,7 @@ use crate::ts::assert_ts; #[allow(non_camel_case_types)] #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct r#struct { // r#type: i32, // TS reserved keyword r#use: i32, diff --git a/tests/tests/ts_rs/simple.rs b/tests/tests/ts_rs/simple.rs index 6455681..21d50c7 100644 --- a/tests/tests/ts_rs/simple.rs +++ b/tests/tests/ts_rs/simple.rs @@ -5,7 +5,7 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Simple { a: i32, b: String, diff --git a/tests/tests/ts_rs/skip.rs b/tests/tests/ts_rs/skip.rs index 7f5a0cc..eb3abd6 100644 --- a/tests/tests/ts_rs/skip.rs +++ b/tests/tests/ts_rs/skip.rs @@ -3,7 +3,7 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct Skip { a: i32, b: i32, diff --git a/tests/tests/ts_rs/struct_rename.rs b/tests/tests/ts_rs/struct_rename.rs index a08067f..4be40f2 100644 --- a/tests/tests/ts_rs/struct_rename.rs +++ b/tests/tests/ts_rs/struct_rename.rs @@ -5,7 +5,7 @@ use specta::Type; #[test] fn rename_all() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] #[specta(rename_all = "UPPERCASE")] struct Rename { a: i32, @@ -18,7 +18,7 @@ fn rename_all() { // #[test] // fn serde_rename_special_char() { // #[derive(serde::Serialize, Type)] -// #[specta(export = false)] +// #[specta(collect = false)] // struct RenameSerdeSpecialChar { // #[serde(rename = "a/b")] // b: i32, diff --git a/tests/tests/ts_rs/struct_tag.rs b/tests/tests/ts_rs/struct_tag.rs index 454aa1a..b359f7e 100644 --- a/tests/tests/ts_rs/struct_tag.rs +++ b/tests/tests/ts_rs/struct_tag.rs @@ -3,7 +3,7 @@ use specta::Type; use crate::ts::{assert_ts_export2, assert_ts_inline2}; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[serde(tag = "type")] struct TaggedType { a: i32, diff --git a/tests/tests/ts_rs/tuple.rs b/tests/tests/ts_rs/tuple.rs index 7307e63..ce8f5b4 100644 --- a/tests/tests/ts_rs/tuple.rs +++ b/tests/tests/ts_rs/tuple.rs @@ -11,7 +11,7 @@ fn test_tuple() { #[test] fn test_newtype() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct NewType(String); assert_ts!(NewType, "string"); @@ -20,7 +20,7 @@ fn test_newtype() { #[test] fn test_tuple_newtype() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct TupleNewType(String, i32, (i32, i32)); assert_ts!(TupleNewType, "[string, number, [number, number]]") } diff --git a/tests/tests/ts_rs/type_override.rs b/tests/tests/ts_rs/type_override.rs index bec7544..58cd555 100644 --- a/tests/tests/ts_rs/type_override.rs +++ b/tests/tests/ts_rs/type_override.rs @@ -12,7 +12,7 @@ struct Unsupported2; #[test] fn simple() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct Override { a: i32, #[specta(type = String)] @@ -32,10 +32,10 @@ fn simple() { #[test] fn newtype() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct New1(#[specta(type = String)] Unsupported2); #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] struct New2(#[specta(type = Option)] Unsupported); assert_ts!(New1, r#"string"#); diff --git a/tests/tests/ts_rs/union.rs b/tests/tests/ts_rs/union.rs index 0d35db7..b965add 100644 --- a/tests/tests/ts_rs/union.rs +++ b/tests/tests/ts_rs/union.rs @@ -3,7 +3,7 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] enum SimpleEnum1 { #[specta(rename = "asdf")] A, @@ -17,7 +17,7 @@ enum SimpleEnum1 { #[test] fn test_empty() { #[derive(Type)] - #[specta(export = false)] + #[specta(collect = false)] enum Empty {} assert_ts!(Empty, "never"); diff --git a/tests/tests/ts_rs/union_rename.rs b/tests/tests/ts_rs/union_rename.rs index 00266df..100d996 100644 --- a/tests/tests/ts_rs/union_rename.rs +++ b/tests/tests/ts_rs/union_rename.rs @@ -3,7 +3,7 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[specta(rename_all = "lowercase")] #[specta(rename = "SimpleEnum")] enum RenamedEnum { diff --git a/tests/tests/ts_rs/union_serde.rs b/tests/tests/ts_rs/union_serde.rs index 20fa0cb..600a570 100644 --- a/tests/tests/ts_rs/union_serde.rs +++ b/tests/tests/ts_rs/union_serde.rs @@ -3,7 +3,7 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[serde(tag = "kind", content = "d")] enum SimpleEnumA { A, @@ -11,7 +11,7 @@ enum SimpleEnumA { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[serde(tag = "kind", content = "data")] enum ComplexEnum { A, @@ -22,7 +22,7 @@ enum ComplexEnum { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[serde(untagged)] enum Untagged { Foo(String), diff --git a/tests/tests/ts_rs/union_with_data.rs b/tests/tests/ts_rs/union_with_data.rs index 9a3552f..1bcd8b9 100644 --- a/tests/tests/ts_rs/union_with_data.rs +++ b/tests/tests/ts_rs/union_with_data.rs @@ -4,19 +4,19 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type, Serialize)] -#[specta(export = false)] +#[specta(collect = false)] struct Bar { field: i32, } #[derive(Type, Serialize)] -#[specta(export = false)] +#[specta(collect = false)] struct Foo { bar: Bar, } #[derive(Type, Serialize)] -#[specta(export = false)] +#[specta(collect = false)] enum SimpleEnum2 { A(String), B(i32), diff --git a/tests/tests/ts_rs/union_with_internal_tag.rs b/tests/tests/ts_rs/union_with_internal_tag.rs index dfec900..80912f1 100644 --- a/tests/tests/ts_rs/union_with_internal_tag.rs +++ b/tests/tests/ts_rs/union_with_internal_tag.rs @@ -3,7 +3,7 @@ use crate::ts::assert_ts; use specta::Type; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[serde(tag = "type")] enum EnumWithInternalTag { A { foo: String }, @@ -11,19 +11,19 @@ enum EnumWithInternalTag { } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct InnerA { foo: String, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct InnerB { bar: i32, } #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] #[serde(tag = "type")] enum EnumWithInternalTag2 { A(InnerA), diff --git a/tests/tests/ts_rs/unit.rs b/tests/tests/ts_rs/unit.rs index c691f5d..4c0b8fe 100644 --- a/tests/tests/ts_rs/unit.rs +++ b/tests/tests/ts_rs/unit.rs @@ -3,15 +3,15 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct UnitA; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct UnitB {} #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct UnitC(); #[test] diff --git a/tests/tests/ty_override.rs b/tests/tests/ty_override.rs index b3329cd..9e04160 100644 --- a/tests/tests/ty_override.rs +++ b/tests/tests/ty_override.rs @@ -5,7 +5,7 @@ use crate::ts::assert_ts; // This test is to do with how the Macro passes the tokens #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct SpectaTypeOverride { #[specta(type = String)] // Ident string_ident: (), @@ -17,7 +17,7 @@ pub struct SpectaTypeOverride { // Checking that you can override the type of a field that is invalid. This is to ensure user code can override Specta in the case we have a bug/unsupported type. #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] pub struct InvalidToValidType { #[specta(type = Option)] pub(crate) cause: Option>, diff --git a/tests/tests/ulid.rs b/tests/tests/ulid.rs index f1a6f4c..ce5dd5b 100644 --- a/tests/tests/ulid.rs +++ b/tests/tests/ulid.rs @@ -3,7 +3,7 @@ use specta::Type; use crate::ts::assert_ts; #[derive(Type)] -#[specta(export = false)] +#[specta(collect = false)] struct ExampleId(pub ulid::Ulid); #[test]