Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Fix: Skip Option<()> schema generation to avoid invalid Windows filenames (#7479) (#7969)

Robby He017a4a06b292
diff --git a/codex-rs/app-server-protocol/src/export.rs b/codex-rs/app-server-protocol/src/export.rs
index 4de66dfb37..a60c1be624 100644
--- a/codex-rs/app-server-protocol/src/export.rs
+++ b/codex-rs/app-server-protocol/src/export.rs
@@ -31,6 +31,7 @@ use std::process::Command;
use ts_rs::TS;
const HEADER: &str = "// GENERATED CODE! DO NOT MODIFY BY HAND!\n\n";
+const IGNORED_DEFINITIONS: &[&str] = &["Option<()>"];
#[derive(Clone)]
pub struct GeneratedSchema {
@@ -184,7 +185,6 @@ fn build_schema_bundle(schemas: Vec<GeneratedSchema>) -> Result<Value> {
"ServerNotification",
"ServerRequest",
];
- const IGNORED_DEFINITIONS: &[&str] = &["Option<()>"];
let namespaced_types = collect_namespaced_types(&schemas);
let mut definitions = Map::new();
@@ -304,8 +304,11 @@ where
out_dir.join(format!("{file_stem}.json"))
};
- write_pretty_json(out_path, &schema_value)
- .with_context(|| format!("Failed to write JSON schema for {file_stem}"))?;
+ if !IGNORED_DEFINITIONS.contains(&logical_name) {
+ write_pretty_json(out_path, &schema_value)
+ .with_context(|| format!("Failed to write JSON schema for {file_stem}"))?;
+ }
+
let namespace = match raw_namespace {
Some("v1") | None => None,
Some(ns) => Some(ns.to_string()),