Remove unneeded derive Deserialize (#6579)

This revealed that one of our variants is never constructed.
This commit is contained in:
Jonathan Tran
2025-04-29 15:17:41 -04:00
committed by GitHub
parent 5e200aebcc
commit a9998be176
4 changed files with 33 additions and 32 deletions

View File

@ -9,7 +9,7 @@ use kittycad_modeling_cmds::{
EnableSketchMode, ModelingCmd, EnableSketchMode, ModelingCmd,
}; };
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{ser::SerializeSeq, Deserialize, Serialize}; use serde::{ser::SerializeSeq, Serialize};
use uuid::Uuid; use uuid::Uuid;
use crate::{ use crate::{
@ -24,7 +24,7 @@ mod mermaid_tests;
/// A command that may create or update artifacts on the TS side. Because /// A command that may create or update artifacts on the TS side. Because
/// engine commands are batched, we don't have the response yet when these are /// engine commands are batched, we don't have the response yet when these are
/// created. /// created.
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, ts_rs::TS)] #[derive(Debug, Clone, PartialEq, Serialize, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ArtifactCommand { pub struct ArtifactCommand {
@ -58,7 +58,7 @@ impl PartialOrd for ArtifactCommand {
} }
} }
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, Ord, PartialOrd, Hash, ts_rs::TS, JsonSchema)] #[derive(Debug, Clone, Copy, Serialize, PartialEq, Eq, Ord, PartialOrd, Hash, ts_rs::TS, JsonSchema)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
pub struct ArtifactId(Uuid); pub struct ArtifactId(Uuid);
@ -115,7 +115,7 @@ where
seq.end() seq.end()
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, Hash, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, Eq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CodeRef { pub struct CodeRef {
@ -135,7 +135,7 @@ impl CodeRef {
} }
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CompositeSolid { pub struct CompositeSolid {
@ -150,7 +150,7 @@ pub struct CompositeSolid {
pub code_ref: CodeRef, pub code_ref: CodeRef,
} }
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, ts_rs::TS)] #[derive(Debug, Clone, Copy, Serialize, PartialEq, Eq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum CompositeSolidSubType { pub enum CompositeSolidSubType {
@ -159,7 +159,7 @@ pub enum CompositeSolidSubType {
Union, Union,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Plane { pub struct Plane {
@ -168,7 +168,7 @@ pub struct Plane {
pub code_ref: CodeRef, pub code_ref: CodeRef,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Path { pub struct Path {
@ -182,7 +182,7 @@ pub struct Path {
pub code_ref: CodeRef, pub code_ref: CodeRef,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Segment { pub struct Segment {
@ -200,7 +200,7 @@ pub struct Segment {
} }
/// A sweep is a more generic term for extrude, revolve, loft, and sweep. /// A sweep is a more generic term for extrude, revolve, loft, and sweep.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Sweep { pub struct Sweep {
@ -214,7 +214,7 @@ pub struct Sweep {
pub code_ref: CodeRef, pub code_ref: CodeRef,
} }
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, ts_rs::TS)] #[derive(Debug, Clone, Copy, Serialize, PartialEq, Eq, PartialOrd, Ord, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum SweepSubType { pub enum SweepSubType {
@ -225,7 +225,7 @@ pub enum SweepSubType {
Sweep, Sweep,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Solid2d { pub struct Solid2d {
@ -233,7 +233,7 @@ pub struct Solid2d {
pub path_id: ArtifactId, pub path_id: ArtifactId,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct StartSketchOnFace { pub struct StartSketchOnFace {
@ -242,7 +242,7 @@ pub struct StartSketchOnFace {
pub code_ref: CodeRef, pub code_ref: CodeRef,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct StartSketchOnPlane { pub struct StartSketchOnPlane {
@ -251,7 +251,7 @@ pub struct StartSketchOnPlane {
pub code_ref: CodeRef, pub code_ref: CodeRef,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Wall { pub struct Wall {
@ -269,7 +269,7 @@ pub struct Wall {
pub cmd_id: uuid::Uuid, pub cmd_id: uuid::Uuid,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Cap { pub struct Cap {
@ -285,7 +285,7 @@ pub struct Cap {
pub face_code_ref: CodeRef, pub face_code_ref: CodeRef,
} }
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Ord, PartialOrd, Eq, ts_rs::TS)] #[derive(Debug, Clone, Copy, Serialize, PartialEq, Ord, PartialOrd, Eq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum CapSubType { pub enum CapSubType {
@ -293,7 +293,7 @@ pub enum CapSubType {
End, End,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SweepEdge { pub struct SweepEdge {
@ -306,7 +306,7 @@ pub struct SweepEdge {
pub common_surface_ids: Vec<ArtifactId>, pub common_surface_ids: Vec<ArtifactId>,
} }
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Ord, PartialOrd, Eq, ts_rs::TS)] #[derive(Debug, Clone, Copy, Serialize, PartialEq, Ord, PartialOrd, Eq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum SweepEdgeSubType { pub enum SweepEdgeSubType {
@ -314,7 +314,7 @@ pub enum SweepEdgeSubType {
Adjacent, Adjacent,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct EdgeCut { pub struct EdgeCut {
@ -328,7 +328,7 @@ pub struct EdgeCut {
pub code_ref: CodeRef, pub code_ref: CodeRef,
} }
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq, ts_rs::TS)] #[derive(Debug, Clone, Copy, Serialize, PartialEq, PartialOrd, Ord, Eq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum EdgeCutSubType { pub enum EdgeCutSubType {
@ -345,7 +345,7 @@ impl From<kcmc::shared::CutType> for EdgeCutSubType {
} }
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct EdgeCutEdge { pub struct EdgeCutEdge {
@ -354,7 +354,7 @@ pub struct EdgeCutEdge {
pub surface_id: ArtifactId, pub surface_id: ArtifactId,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Helix { pub struct Helix {
@ -365,7 +365,7 @@ pub struct Helix {
pub code_ref: CodeRef, pub code_ref: CodeRef,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(tag = "type", rename_all = "camelCase")] #[serde(tag = "type", rename_all = "camelCase")]
pub enum Artifact { pub enum Artifact {
@ -381,6 +381,7 @@ pub enum Artifact {
Cap(Cap), Cap(Cap),
SweepEdge(SweepEdge), SweepEdge(SweepEdge),
EdgeCut(EdgeCut), EdgeCut(EdgeCut),
#[expect(unused)]
EdgeCutEdge(EdgeCutEdge), EdgeCutEdge(EdgeCutEdge),
Helix(Helix), Helix(Helix),
} }
@ -668,7 +669,7 @@ impl EdgeCut {
} }
} }
#[derive(Debug, Clone, Default, PartialEq, Deserialize, Serialize, ts_rs::TS)] #[derive(Debug, Clone, Default, PartialEq, Serialize, ts_rs::TS)]
#[ts(export_to = "Artifact.ts")] #[ts(export_to = "Artifact.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ArtifactGraph { pub struct ArtifactGraph {

View File

@ -1,6 +1,6 @@
use indexmap::IndexMap; use indexmap::IndexMap;
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Serialize}; use serde::Serialize;
use super::{types::NumericType, ArtifactId, KclValue}; use super::{types::NumericType, ArtifactId, KclValue};
use crate::{docs::StdLibFn, ModuleId, SourceRange}; use crate::{docs::StdLibFn, ModuleId, SourceRange};
@ -247,21 +247,21 @@ pub enum OpKclValue {
pub type OpKclObjectFields = IndexMap<String, OpKclValue>; pub type OpKclObjectFields = IndexMap<String, OpKclValue>;
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export_to = "Operation.ts")] #[ts(export_to = "Operation.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct OpSketch { pub struct OpSketch {
artifact_id: ArtifactId, artifact_id: ArtifactId,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export_to = "Operation.ts")] #[ts(export_to = "Operation.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct OpSolid { pub struct OpSolid {
artifact_id: ArtifactId, artifact_id: ArtifactId,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export_to = "Operation.ts")] #[ts(export_to = "Operation.ts")]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct OpHelix { pub struct OpHelix {

View File

@ -248,7 +248,7 @@ impl SolidOrImportedGeometry {
} }
/// A helix. /// A helix.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)] #[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export)] #[ts(export)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Helix { pub struct Helix {

View File

@ -608,7 +608,7 @@ flowchart LR
83 --- 251 83 --- 251
83 --- 298 83 --- 298
90 --- 159 90 --- 159
90 x--> 193 90 x--> 192
90 --- 226 90 --- 226
90 --- 271 90 --- 271
104 --- 155 104 --- 155
@ -906,7 +906,7 @@ flowchart LR
219 <--x 190 219 <--x 190
220 <--x 190 220 <--x 190
221 <--x 190 221 <--x 190
226 <--x 192 226 <--x 193
235 <--x 195 235 <--x 195
236 <--x 195 236 <--x 195
237 <--x 195 237 <--x 195