STET

agent_patch

runs/2026-02-27__21-30-28__gpt-5-3-codex/flux-pr-5156/flux-pr-5156.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/agent-logs/agent.patch

2913 bytes

Back to adjudication
diff --git a/tmp/agent-patch-flux-pr-5156.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/core/to-json-schema.ts b/app/packages/zod/src/v4/core/to-json-schema.ts
index 0f5e400..040580e 100644
--- a/tmp/agent-patch-flux-pr-5156.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/core/to-json-schema.ts
+++ b/app/packages/zod/src/v4/core/to-json-schema.ts
@@ -236,7 +236,11 @@ export class JSONSchemaGenerator {
             break;
           }
           case "null": {
-            _json.type = "null";
+            if (this.target === "openapi-3.0") {
+              _json.type = "string";
+              _json.nullable = true;
+              _json.enum = [null];
+            } else _json.type = "null";
             break;
           }
           case "any": {
@@ -332,18 +336,7 @@ export class JSONSchemaGenerator {
                 path: [...params.path, "anyOf", i],
               })
             );
-            if (this.target === "openapi-3.0") {
-              const nonNull = options.filter((x) => (x as any).type !== "null");
-              const hasNull = nonNull.length !== options.length;
-              if (nonNull.length === 1) {
-                Object.assign(json, nonNull[0]!);
-              } else {
-                json.anyOf = nonNull;
-              }
-              if (hasNull) (json as any).nullable = true;
-            } else {
-              json.anyOf = options;
-            }
+            json.anyOf = options;
             break;
           }
           case "intersection": {
@@ -478,7 +471,13 @@ export class JSONSchemaGenerator {
               // do nothing (an undefined literal was stripped)
             } else if (vals.length === 1) {
               const val = vals[0]!;
-              json.type = val === null ? ("null" as const) : (typeof val as any);
+              if (this.target === "openapi-3.0" && val === null) {
+                json.type = "string";
+                json.nullable = true;
+                json.enum = [null];
+              } else {
+                json.type = val === null ? ("null" as const) : (typeof val as any);
+              }
               if (this.target === "draft-4" || this.target === "openapi-3.0") {
                 json.enum = [val];
               } else {
@@ -532,12 +531,12 @@ export class JSONSchemaGenerator {
           }
 
           case "nullable": {
-            const inner = this.process(def.innerType, params);
             if (this.target === "openapi-3.0") {
-              Object.assign(_json, inner);
-              (_json as any).nullable = true;
+              this.process(def.innerType, params);
               result.ref = def.innerType;
+              (_json as any).nullable = true;
             } else {
+              const inner = this.process(def.innerType, params);
               _json.anyOf = [inner, { type: "null" }];
             }
             break;