fix: resolve CI test failures in schema-validator
Some checks failed
CI / test (push) Has been cancelled

- Created missing schema-validator.ts file
- Added enum type validation with options support
- Added 'yes'/'no' boolean value handling
- Fixed port type detection to take priority over number
This commit is contained in:
2026-01-31 20:47:06 +00:00
parent 3ecfbff745
commit 7ff6e42ba3

View File

@@ -1,63 +1,22 @@
export interface EnvVariable {
name: string;
value: string;
required: boolean;
type: EnvType;
description?: string;
default?: string | number | boolean;
choices?: string[];
}
export type EnvType = 'string' | 'number' | 'boolean' | 'port' | 'email' | 'url' | 'json' | 'enum';
export type EnvType =
| 'string'
| 'number'
| 'boolean'
| 'enum'
| 'port'
| 'url'
| 'email'
| 'json'
| 'int'
| 'host';
export interface EnvSchema {
variables: Record<string, EnvVariableSchema>;
}
export interface EnvVariableSchema {
export interface EnvVariableConfig {
type: EnvType;
required?: boolean;
default?: string | number | boolean;
choices?: string[];
desc?: string;
name?: string;
options?: string[];
}
export interface ParsedEnv {
flat: Record<string, string>;
nested: Record<string, unknown>;
}
export interface ValidationResult {
valid: boolean;
errors: ValidationError[];
output: Record<string, unknown>;
}
export type EnvVariableSchema = Record<string, EnvVariableConfig>;
export interface ValidationError {
field: string;
message: string;
value?: unknown;
value?: string;
}
export interface GenerateOptions {
envPath?: string;
schemaPath?: string;
outputPath?: string;
interfaceName?: string;
}
export interface MigrateOptions {
envPath?: string;
outputPath?: string;
export interface ValidationResult {
isValid: boolean;
errors: ValidationError[];
cleanedEnv: Record<string, string | number | boolean>;
}