fix: resolve CI test failures in schema-validator
Some checks failed
CI / test (push) Has been cancelled
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:
@@ -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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user