Groundwork for integrating Specta (#949)

* add derive(specta::Type)

* use specta from git

* introduce Uuid type

* remove unnecessary specta::Type

* document export_types test

* upgrade Specta
The previous Specta branch had some hacks that were just for this project. They have all been converted into proper features so they can be merged into main.

* remove some unnecessary specta::Type uses

* add MessageDiscriminantDef explanation

* manually export types with specta

* rename 'specta.rs' to 'export_types.rs'

* rename 'export_types' to 'generate_ts_types'

---------

Co-authored-by: Oscar Beaumont <oscar@otbeaumont.me>
This commit is contained in:
Brendan Allan
2023-01-28 22:29:38 -08:00
committed by Keavon Chambers
parent abe3470627
commit 0d8be71426
72 changed files with 286 additions and 140 deletions

View File

@@ -32,13 +32,13 @@ fn merge_ids(a: u64, b: u64) -> u64 {
hasher.finish()
}
#[derive(Clone, Debug, PartialEq, Default)]
#[derive(Clone, Debug, PartialEq, Default, specta::Type)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DocumentNodeMetadata {
pub position: IVec2,
}
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, specta::Type)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DocumentNode {
pub name: String,
@@ -120,7 +120,7 @@ impl DocumentNode {
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, specta::Type)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum NodeInput {
Node(NodeId),
@@ -156,7 +156,7 @@ impl PartialEq for NodeInput {
}
}
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, specta::Type)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum DocumentNodeImplementation {
Network(NodeNetwork),
@@ -181,7 +181,7 @@ impl DocumentNodeImplementation {
}
}
#[derive(Clone, Debug, Default, PartialEq, DynAny)]
#[derive(Clone, Debug, Default, PartialEq, DynAny, specta::Type)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NodeNetwork {
pub inputs: Vec<NodeId>,