Skip to content

Commit cf2ebef

Browse files
committed
Limit closed union codegen scope
1 parent 2085367 commit cf2ebef

25 files changed

Lines changed: 487 additions & 1843 deletions

dotnet/src/Generated/Rpc.cs

Lines changed: 22 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/rpc/zrpc_encoding.go

Lines changed: 48 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/scripts/codegen/java.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ import fs from "fs/promises";
1111
import type { JSONSchema7 } from "json-schema";
1212
import path from "path";
1313
import { fileURLToPath } from "url";
14-
import { analyseDiscriminatedUnionVariants } from "../../../scripts/codegen/schema-unions.js";
14+
import {
15+
analyseDiscriminatedUnionVariants,
16+
analyseNestedClosedUnionResult,
17+
} from "../../../scripts/codegen/schema-unions.js";
1518

1619
const __filename = fileURLToPath(import.meta.url);
1720
const __dirname = path.dirname(__filename);
@@ -1465,13 +1468,7 @@ async function generateRpcTypes(schemaPath: string): Promise<void> {
14651468
for (const section of [schema.server, schema.session, schema.clientSession, schema.clientGlobal]) {
14661469
if (!section) continue;
14671470
for (const [, method] of collectRpcMethods(section)) {
1468-
const result = resolveRef(method.result ?? undefined);
1469-
const union = result?.anyOf ?? result?.oneOf;
1470-
if (
1471-
union
1472-
&& Array.isArray(union)
1473-
&& findDiscriminator(resolveUnionVariants(union as JSONSchema7[]))
1474-
) {
1471+
if (analyseNestedClosedUnionResult(method.result, currentDefinitions)) {
14751472
collectPromotedNestedUnionTypes(method.result);
14761473
}
14771474
}

java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpInstallPlan.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public record McpInstallPlan(
3131
/** Origin and semantic digest of the exact validated JSON MCP card content bound to this plan. */
3232
@JsonProperty("provenance") McpPlanProvenance provenance,
3333
/** Every eligible transport, so a host can present an explicit choice. A completed plan always has at least one; when none is eligible, planning returns `CatalogUnavailableTransportError` instead. */
34-
@JsonProperty("transportChoices") List<McpPlanTransportChoice> transportChoices,
34+
@JsonProperty("transportChoices") List<Object> transportChoices,
3535
/** Identifier of the choice the runtime would pick by default. Omitted when there is no eligible transport, or when the runtime expresses no preference. */
3636
@JsonProperty("recommendedTransportChoiceId") String recommendedTransportChoiceId,
3737
/** Configuration scope and key the plan would write to. */

java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanEnumValueType.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanPackageTransport.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)