mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
Remove schema whitespace workaround
This commit is contained in:
@@ -66,7 +66,7 @@ name: string | null,
|
||||
/**
|
||||
* Arbitrary client-defined metadata.
|
||||
*/
|
||||
metadata: { [key in string]?: string },
|
||||
metadata: { [key in string]?: string },
|
||||
/**
|
||||
* Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read`
|
||||
* (when `includeTurns` is true) responses.
|
||||
|
||||
@@ -7,7 +7,7 @@ export type ThreadMetadataUpdateParams = { threadId: string,
|
||||
/**
|
||||
* Replace the stored client-defined metadata for this thread.
|
||||
*/
|
||||
metadata?: { [key in string]?: string } | null,
|
||||
metadata?: { [key in string]?: string } | null,
|
||||
/**
|
||||
* Patch the stored Git metadata for this thread.
|
||||
* Omit a field to leave it unchanged, set it to `null` to clear it, or
|
||||
|
||||
@@ -179,12 +179,6 @@ pub fn generate_ts_with_options(
|
||||
}
|
||||
}
|
||||
|
||||
if !ts_files.is_empty() {
|
||||
for file in &ts_files {
|
||||
normalize_typescript_whitespace_in_file(file)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1913,32 +1907,6 @@ fn prepend_header_if_missing(path: &Path) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn normalize_typescript_whitespace_in_file(path: &Path) -> Result<()> {
|
||||
let content =
|
||||
fs::read_to_string(path).with_context(|| format!("Failed to read {}", path.display()))?;
|
||||
let normalized = normalize_typescript_whitespace(&content);
|
||||
if normalized == content {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
fs::write(path, normalized).with_context(|| format!("Failed to write {}", path.display()))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn normalize_typescript_whitespace(content: &str) -> String {
|
||||
let mut normalized = String::with_capacity(content.len());
|
||||
for line in content.lines() {
|
||||
normalized.push_str(line.trim_end());
|
||||
normalized.push('\n');
|
||||
}
|
||||
|
||||
if !content.ends_with('\n') {
|
||||
normalized.pop();
|
||||
}
|
||||
|
||||
normalized
|
||||
}
|
||||
|
||||
fn ts_files_in(dir: &Path) -> Result<Vec<PathBuf>> {
|
||||
let mut files = Vec::new();
|
||||
for entry in
|
||||
|
||||
@@ -5,7 +5,6 @@ use crate::ServerRequest;
|
||||
use crate::export::GENERATED_TS_HEADER;
|
||||
use crate::export::filter_experimental_ts_tree;
|
||||
use crate::export::generate_index_ts_tree;
|
||||
use crate::export::normalize_typescript_whitespace;
|
||||
use crate::protocol::common::visit_client_response_types;
|
||||
use crate::protocol::common::visit_server_response_types;
|
||||
use anyhow::Context;
|
||||
@@ -141,7 +140,7 @@ fn read_file_bytes(path: &Path) -> Result<Vec<u8>> {
|
||||
.strip_prefix(GENERATED_TS_HEADER)
|
||||
.unwrap_or(&text)
|
||||
.to_string();
|
||||
return Ok(normalize_typescript_whitespace(&text).into_bytes());
|
||||
return Ok(text.into_bytes());
|
||||
}
|
||||
Ok(bytes)
|
||||
}
|
||||
@@ -279,7 +278,7 @@ fn collect_typescript_fixture_file<T: TS + 'static + ?Sized>(
|
||||
let output_path = normalize_relative_fixture_path(&output_path);
|
||||
files.insert(
|
||||
output_path,
|
||||
normalize_typescript_whitespace(&contents.replace("\r\n", "\n").replace('\r', "\n")),
|
||||
contents.replace("\r\n", "\n").replace('\r', "\n"),
|
||||
);
|
||||
|
||||
let mut visitor = TypeScriptFixtureCollector {
|
||||
|
||||
Reference in New Issue
Block a user