diff --git a/src/models/bioEntitySchema.ts b/src/models/bioEntitySchema.ts index fc1e935aeec1d7408bf78e03aba7bb6a16905f64..fd0ee6a10bbcd3ce279cd9c3bf14eee90bae30f3 100644 --- a/src/models/bioEntitySchema.ts +++ b/src/models/bioEntitySchema.ts @@ -18,7 +18,7 @@ export const bioEntitySchema = z.object({ references: z.array(referenceSchema), z: z.number(), notes: z.string(), - symbol: z.union([z.string(), z.null()]), + symbol: z.string().nullable(), homodimer: z.number(), nameX: z.number(), nameY: z.number(), @@ -33,23 +33,23 @@ export const bioEntitySchema = z.object({ synonyms: z.array(z.string()), formerSymbols: z.array(z.string()), fullName: z.string(), - abbreviation: z.union([z.string(), z.null()]), - formula: z.union([z.string(), z.null()]), - glyph: z.union([glyphSchema, z.null()]), + abbreviation: z.string().nullable(), + formula: z.string().nullable(), + glyph: glyphSchema.nullable(), activity: z.boolean(), - structuralState: z.union([structuralStateSchema, z.null()]), - hypothetical: z.union([z.boolean(), z.null()]), + structuralState: structuralStateSchema.nullable(), + hypothetical: z.boolean().nullable(), boundaryCondition: z.boolean(), constant: z.boolean(), - initialAmount: z.union([z.number(), z.null()]), - initialConcentration: z.union([z.number(), z.null()]), - charge: z.union([z.number(), z.null()]), - substanceUnits: z.union([z.string(), z.null()]), + initialAmount: z.number().nullable(), + initialConcentration: z.number().nullable(), + charge: z.number().nullable(), + substanceUnits: z.string().nullable(), onlySubstanceUnits: z.boolean(), modificationResidues: z.optional(z.array(modificationResiduesSchema)), - complex: z.union([z.number(), z.null()]), - compartment: z.union([z.number(), z.null()]), - submodel: z.union([submodelSchema, z.null()]), + complex: z.number().nullable(), + compartment: z.number().nullable(), + submodel: submodelSchema.nullable(), x: z.number(), y: z.number(), lineWidth: z.number(), @@ -70,11 +70,11 @@ export const bioEntitySchema = z.object({ upperBound: z.optional(z.boolean()), subsystem: z.optional(z.string()), geneProteinReaction: z.optional(z.string()), - kinetics: z.union([z.null(), z.undefined()]), - products: z.union([z.array(productsSchema), z.undefined()]), - reactants: z.union([z.array(productsSchema), z.undefined()]), - modifiers: z.union([z.array(productsSchema), z.undefined()]), - processCoordinates: z.union([z.null(), z.undefined()]), - line: z.union([lineSchema, z.undefined()]), - operators: z.union([z.array(operatorSchema), z.undefined()]), + kinetics: z.optional(z.null()), + products: z.optional(z.array(productsSchema)), + reactants: z.optional(z.array(productsSchema)), + modifiers: z.optional(z.array(productsSchema)), + processCoordinates: z.optional(z.null()), + line: z.optional(lineSchema), + operators: z.optional(z.array(operatorSchema)), }); diff --git a/src/models/modelSchema.ts b/src/models/modelSchema.ts index 64752c8c1bd4043d1ff24cc0de26022f5f22daa2..0c8a488d7f340dc182ec0b62a1fbe785089d9340 100644 --- a/src/models/modelSchema.ts +++ b/src/models/modelSchema.ts @@ -15,17 +15,17 @@ export const modelSchema = z.object({ /** size of the png tile used to visualize in frontend */ tileSize: z.number(), /** default x center used in frontend visualization */ - defaultCenterX: z.union([z.number(), z.null()]), + defaultCenterX: z.number().nullable(), /** default y center used in frontend visualization */ - defaultCenterY: z.union([z.number(), z.null()]), + defaultCenterY: z.number().nullable(), /** default zoom level used in frontend visualization */ - defaultZoomLevel: z.union([z.number(), z.null()]), + defaultZoomLevel: z.number().nullable(), /** minimum zoom level availbale for the map */ minZoom: z.number(), /** maximum zoom level available for the map */ maxZoom: z.number(), authors: z.array(authorSchema), references: z.array(referenceSchema), - creationDate: z.union([z.string(), z.null()]), + creationDate: z.string().nullable(), modificationDates: z.array(z.string()), }); diff --git a/src/models/modificationResiduesSchema.ts b/src/models/modificationResiduesSchema.ts index 4b71bf72f4df2272b829b7bcb920a864982f8191..884ebe4b5c2f5c5fe59eec89a2c115123b8adb73 100644 --- a/src/models/modificationResiduesSchema.ts +++ b/src/models/modificationResiduesSchema.ts @@ -9,7 +9,7 @@ export const modificationResiduesSchema = z.object({ position: positionSchema, z: z.number(), borderColor: colorSchema, - state: z.union([z.string(), z.number(), z.null()]), + state: z.union([z.string(), z.number()]).nullable(), size: z.number(), elementId: z.string(), }); diff --git a/src/models/products.ts b/src/models/products.ts index cfc9b6b5c8cb96665afbfdbb3f66f8ab97a42e9f..4807c4862dbe9be1abe5be98890bcbc5066b3509 100644 --- a/src/models/products.ts +++ b/src/models/products.ts @@ -2,6 +2,6 @@ import { z } from 'zod'; export const productsSchema = z.object({ aliasId: z.number(), - stoichiometry: z.union([z.number(), z.null()]), - type: z.union([z.string(), z.undefined()]), + stoichiometry: z.number().nullable(), + type: z.optional(z.string()), }); diff --git a/src/models/referenceSchema.ts b/src/models/referenceSchema.ts index 432f0eeceb6f7b1f3778e283ebbc7db050fd74be..30a31e287cfdc79348e9655b635a417a0729a34b 100644 --- a/src/models/referenceSchema.ts +++ b/src/models/referenceSchema.ts @@ -2,7 +2,7 @@ import { z } from 'zod'; import { articleSchema } from './articleSchema'; export const referenceSchema = z.object({ - link: z.union([z.string(), z.null()]), + link: z.string().nullable(), article: articleSchema.optional(), type: z.string(), resource: z.string(),