mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
fix(app-server): fix optional bool annotations (#24099)
`#[serde(default)]` wasn't sufficient for our generated TS types to reflect that clients didn't have to set them. We also need `skip_serializing_if = "std::ops::Not::not"`. This is already a rule in our agents.md file.
This commit is contained in:
committed by
GitHub
Unverified
parent
014f19af5f
commit
cff960896c
+1
-5
@@ -423,7 +423,6 @@
|
||||
]
|
||||
},
|
||||
"includeLayers": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
@@ -721,8 +720,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"classification",
|
||||
"includeLogs"
|
||||
"classification"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
@@ -1034,7 +1032,6 @@
|
||||
"GetAccountParams": {
|
||||
"properties": {
|
||||
"refreshToken": {
|
||||
"default": false,
|
||||
"description": "When `true`, requests a proactive token refresh before returning.\n\nIn managed auth mode this triggers the normal refresh-token flow. In external auth mode this flag is ignored. Clients should refresh tokens themselves and call `account/login/start` with `chatgptAuthTokens`.",
|
||||
"type": "boolean"
|
||||
}
|
||||
@@ -3424,7 +3421,6 @@
|
||||
"ThreadReadParams": {
|
||||
"properties": {
|
||||
"includeTurns": {
|
||||
"default": false,
|
||||
"description": "When true, include turns and their items from rollout history.",
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
+1
-5
@@ -7691,7 +7691,6 @@
|
||||
]
|
||||
},
|
||||
"includeLayers": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
@@ -8593,8 +8592,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"classification",
|
||||
"includeLogs"
|
||||
"classification"
|
||||
],
|
||||
"title": "FeedbackUploadParams",
|
||||
"type": "object"
|
||||
@@ -9370,7 +9368,6 @@
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"refreshToken": {
|
||||
"default": false,
|
||||
"description": "When `true`, requests a proactive token refresh before returning.\n\nIn managed auth mode this triggers the normal refresh-token flow. In external auth mode this flag is ignored. Clients should refresh tokens themselves and call `account/login/start` with `chatgptAuthTokens`.",
|
||||
"type": "boolean"
|
||||
}
|
||||
@@ -16965,7 +16962,6 @@
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"includeTurns": {
|
||||
"default": false,
|
||||
"description": "When true, include turns and their items from rollout history.",
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
+1
-5
@@ -4060,7 +4060,6 @@
|
||||
]
|
||||
},
|
||||
"includeLayers": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
@@ -4962,8 +4961,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"classification",
|
||||
"includeLogs"
|
||||
"classification"
|
||||
],
|
||||
"title": "FeedbackUploadParams",
|
||||
"type": "object"
|
||||
@@ -5850,7 +5848,6 @@
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"refreshToken": {
|
||||
"default": false,
|
||||
"description": "When `true`, requests a proactive token refresh before returning.\n\nIn managed auth mode this triggers the normal refresh-token flow. In external auth mode this flag is ignored. Clients should refresh tokens themselves and call `account/login/start` with `chatgptAuthTokens`.",
|
||||
"type": "boolean"
|
||||
}
|
||||
@@ -14789,7 +14786,6 @@
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"includeTurns": {
|
||||
"default": false,
|
||||
"description": "When true, include turns and their items from rollout history.",
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
]
|
||||
},
|
||||
"includeLayers": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -39,8 +39,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"classification",
|
||||
"includeLogs"
|
||||
"classification"
|
||||
],
|
||||
"title": "FeedbackUploadParams",
|
||||
"type": "object"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"refreshToken": {
|
||||
"default": false,
|
||||
"description": "When `true`, requests a proactive token refresh before returning.\n\nIn managed auth mode this triggers the normal refresh-token flow. In external auth mode this flag is ignored. Clients should refresh tokens themselves and call `account/login/start` with `chatgptAuthTokens`.",
|
||||
"type": "boolean"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"includeTurns": {
|
||||
"default": false,
|
||||
"description": "When true, include turns and their items from rollout history.",
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ConfigReadParams = { includeLayers: boolean,
|
||||
export type ConfigReadParams = { includeLayers?: boolean,
|
||||
/**
|
||||
* Optional working directory to resolve project config layers. If specified,
|
||||
* return the effective config as seen from that directory (i.e., including any
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type FeedbackUploadParams = { classification: string, reason?: string | null, threadId?: string | null, includeLogs: boolean, extraLogFiles?: Array<string> | null, tags?: { [key in string]?: string } | null, };
|
||||
export type FeedbackUploadParams = { classification: string, reason?: string | null, threadId?: string | null, includeLogs?: boolean, extraLogFiles?: Array<string> | null, tags?: { [key in string]?: string } | null, };
|
||||
|
||||
@@ -10,4 +10,4 @@ export type GetAccountParams = {
|
||||
* external auth mode this flag is ignored. Clients should refresh tokens
|
||||
* themselves and call `account/login/start` with `chatgptAuthTokens`.
|
||||
*/
|
||||
refreshToken: boolean, };
|
||||
refreshToken?: boolean, };
|
||||
|
||||
@@ -6,4 +6,4 @@ export type ThreadReadParams = { threadId: string,
|
||||
/**
|
||||
* When true, include turns and their items from rollout history.
|
||||
*/
|
||||
includeTurns: boolean, };
|
||||
includeTurns?: boolean, };
|
||||
|
||||
@@ -2547,8 +2547,22 @@ mod tests {
|
||||
json!({
|
||||
"method": "account/read",
|
||||
"id": 6,
|
||||
"params": {}
|
||||
}),
|
||||
serde_json::to_value(&request)?,
|
||||
);
|
||||
let request = ClientRequest::GetAccount {
|
||||
request_id: RequestId::Integer(7),
|
||||
params: v2::GetAccountParams {
|
||||
refresh_token: true,
|
||||
},
|
||||
};
|
||||
assert_eq!(
|
||||
json!({
|
||||
"method": "account/read",
|
||||
"id": 7,
|
||||
"params": {
|
||||
"refreshToken": false
|
||||
"refreshToken": true
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&request)?,
|
||||
|
||||
@@ -224,7 +224,7 @@ pub struct GetAccountParams {
|
||||
/// In managed auth mode this triggers the normal refresh-token flow. In
|
||||
/// external auth mode this flag is ignored. Clients should refresh tokens
|
||||
/// themselves and call `account/login/start` with `chatgptAuthTokens`.
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub refresh_token: bool,
|
||||
}
|
||||
|
||||
|
||||
@@ -357,7 +357,7 @@ pub enum ConfigWriteErrorCode {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ConfigReadParams {
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub include_layers: bool,
|
||||
/// Optional working directory to resolve project config layers. If specified,
|
||||
/// return the effective config as seen from that directory (i.e., including any
|
||||
|
||||
@@ -14,6 +14,7 @@ pub struct FeedbackUploadParams {
|
||||
pub reason: Option<String>,
|
||||
#[ts(optional = nullable)]
|
||||
pub thread_id: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub include_logs: bool,
|
||||
#[ts(optional = nullable)]
|
||||
pub extra_log_files: Option<Vec<PathBuf>>,
|
||||
|
||||
@@ -162,13 +162,13 @@ pub struct ThreadStartParams {
|
||||
/// If true, opt into emitting raw Responses API items on the event stream.
|
||||
/// This is for internal use only (e.g. Codex Cloud).
|
||||
#[experimental("thread/start.experimentalRawEvents")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub experimental_raw_events: bool,
|
||||
/// Deprecated and ignored by app-server. Kept only so older clients can
|
||||
/// continue sending the field while rollout persistence always uses the
|
||||
/// limited history policy.
|
||||
#[experimental("thread/start.persistFullHistory")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub persist_extended_history: bool,
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@ pub struct ThreadResumeParams {
|
||||
/// continue sending the field while rollout persistence always uses the
|
||||
/// limited history policy.
|
||||
#[experimental("thread/resume.persistFullHistory")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub persist_extended_history: bool,
|
||||
}
|
||||
|
||||
@@ -518,7 +518,7 @@ pub struct ThreadForkParams {
|
||||
/// continue sending the field while rollout persistence always uses the
|
||||
/// limited history policy.
|
||||
#[experimental("thread/fork.persistFullHistory")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub persist_extended_history: bool,
|
||||
}
|
||||
|
||||
@@ -1132,7 +1132,7 @@ pub enum ThreadActiveFlag {
|
||||
pub struct ThreadReadParams {
|
||||
pub thread_id: String,
|
||||
/// When true, include turns and their items from rollout history.
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub include_turns: bool,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user