fix: fixed #11 schema normalization, #10 version parsing, and variable declarations

- Fixed schema normalization in Google provider to handle array-valued type fields by converting them to single type with nullable flag.
- Refactored version parsing in install script to use bash parameter expansion instead of IFS field splitting.
- Changed variable declarations from let to var in theme module global scope.
This commit is contained in:
can1357
2026-02-07 02:43:46 +01:00
parent 2a7a2796a8
commit 5b6f88dd95
4 changed files with 30 additions and 14 deletions
+3
View File
@@ -1,6 +1,9 @@
# Changelog
## [Unreleased]
### Fixed
- Fixed schema normalization to handle array-valued `type` fields by converting them to a single type with nullable flag for Google provider compatibility
## [11.3.0] - 2026-02-06
### Added
@@ -332,6 +332,17 @@ function sanitizeSchemaImpl(value: unknown, isInsideProperties: boolean): unknow
result[key] = sanitizeSchemaImpl(entry, key === "properties");
}
// Normalize array-valued "type" (e.g. ["string", "null"]) to a single type + nullable.
// Google's Schema proto expects type to be a single enum string, not an array.
if (Array.isArray(result.type)) {
const types = result.type as string[];
const nonNull = types.filter(t => t !== "null");
if (types.includes("null")) {
result.nullable = true;
}
result.type = nonNull[0] ?? types[0];
}
if (constValue !== undefined) {
// Convert const to enum, merging with existing enum if present
const existingEnum = Array.isArray(result.enum) ? result.enum : [];
@@ -1724,12 +1724,12 @@ function getDefaultTheme(): string {
// Global Theme Instance
// ============================================================================
export let theme: Theme;
let currentThemeName: string | undefined;
let currentSymbolPresetOverride: SymbolPreset | undefined;
let currentColorBlindMode: boolean = false;
let themeWatcher: fs.FSWatcher | undefined;
let onThemeChangeCallback: (() => void) | undefined;
export var theme: Theme;
var currentThemeName: string | undefined;
var currentSymbolPresetOverride: SymbolPreset | undefined;
var currentColorBlindMode: boolean = false;
var themeWatcher: fs.FSWatcher | undefined;
var onThemeChangeCallback: (() => void) | undefined;
function getCurrentThemeOptions(): CreateThemeOptions {
return {
+10 -8
View File
@@ -75,15 +75,17 @@ version_ge() {
current="$1"
minimum="$2"
IFS=. set -- $current
current_major=${1:-0}
current_minor=${2:-0}
current_patch=${3:-0}
current_major="${current%%.*}"
current_rest="${current#*.}"
current_minor="${current_rest%%.*}"
current_patch="${current_rest#*.}"
current_patch="${current_patch%%.*}"
IFS=. set -- $minimum
minimum_major=${1:-0}
minimum_minor=${2:-0}
minimum_patch=${3:-0}
minimum_major="${minimum%%.*}"
minimum_rest="${minimum#*.}"
minimum_minor="${minimum_rest%%.*}"
minimum_patch="${minimum_rest#*.}"
minimum_patch="${minimum_patch%%.*}"
if [ "$current_major" -ne "$minimum_major" ]; then
[ "$current_major" -gt "$minimum_major" ]