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>
This commit is contained in:
Jeremy Gallant
2025-06-04 08:10:59 -04:00
committed by GitHub
co-authored by philon-
parent df036d3904
commit 1cbd98ec53
61 changed files with 1751 additions and 1263 deletions
+11 -22
View File
@@ -1,24 +1,13 @@
import type { Message } from "@bufbuild/protobuf";
import type { Protobuf } from "@meshtastic/core";
import { IsBoolean, IsInt } from "class-validator";
import { z } from "zod/v4";
export class AmbientLightingValidation implements
Omit<
Protobuf.ModuleConfig.ModuleConfig_AmbientLightingConfig,
keyof Message
> {
@IsBoolean()
ledState: boolean;
export const AmbientLightingValidationSchema = z.object({
ledState: z.boolean(),
current: z.coerce.number().int().min(0),
red: z.coerce.number().int().min(0).max(255),
green: z.coerce.number().int().min(0).max(255),
blue: z.coerce.number().int().min(0).max(255),
});
@IsInt()
current: number;
@IsInt()
red: number;
@IsInt()
green: number;
@IsInt()
blue: number;
}
export type AmbientLightingValidation = z.infer<
typeof AmbientLightingValidationSchema
>;