Files
meshtastic-web/src/validation/moduleConfig/cannedMessage.ts
T
1cbd98ec53 Zod config validation (#635)
* Zod WIP

* Zod form validation

* DynamicForm testing

* Fix linting

* Delete rasterSource.ts

---------

Co-authored-by: philon- <philon-@users.noreply.github.com>
2025-06-04 08:10:59 -04:00

25 lines
774 B
TypeScript

import { z } from "zod/v4";
import { Protobuf } from "@meshtastic/core";
const InputEventCharEnum = z.enum(
Protobuf.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar,
);
export const CannedMessageValidationSchema = z.object({
rotary1Enabled: z.boolean(),
inputbrokerPinA: z.coerce.number().int().min(0),
inputbrokerPinB: z.coerce.number().int().min(0),
inputbrokerPinPress: z.coerce.number().int().min(0),
inputbrokerEventCw: InputEventCharEnum,
inputbrokerEventCcw: InputEventCharEnum,
inputbrokerEventPress: InputEventCharEnum,
updown1Enabled: z.boolean(),
enabled: z.boolean(),
allowInputSource: z.string().max(30),
sendBell: z.boolean(),
});
export type CannedMessageValidation = z.infer<
typeof CannedMessageValidationSchema
>;