Fix network validation

This commit is contained in:
Sacha Weatherstone
2022-10-27 21:24:07 +10:00
parent ef93a2ec25
commit 8538ba4f6a
2 changed files with 14 additions and 9 deletions
+9 -3
View File
@@ -1,4 +1,4 @@
import { IsBoolean, IsEnum, IsIP, Length } from "class-validator";
import { IsBoolean, IsEnum, IsIP, IsOptional, Length } from "class-validator";
import { Protobuf } from "@meshtastic/meshtasticjs";
@@ -9,10 +9,12 @@ export class NetworkValidation implements Protobuf.Config_NetworkConfig {
@IsEnum(Protobuf.Config_NetworkConfig_WiFiMode)
wifiMode: Protobuf.Config_NetworkConfig_WiFiMode;
@Length(1, 33)
@Length(0, 33) //min 1
@IsOptional({})
wifiSsid: string;
@Length(8, 64)
@Length(0, 64) //min 8
@IsOptional()
wifiPsk: string;
@Length(2, 30)
@@ -31,14 +33,18 @@ export class NetworkValidation_IpV4Config
implements Protobuf.Config_NetworkConfig_IpV4Config
{
@IsIP()
@IsOptional()
ip: number;
@IsIP()
@IsOptional()
gateway: number;
@IsIP()
@IsOptional()
subnet: number;
@IsIP()
@IsOptional()
dns: number;
}