MCPcopy Index your code
hub / github.com/github/copilot-sdk / generateStandaloneRecord

Function generateStandaloneRecord

java/scripts/codegen/java.ts:1183–1227  ·  view source on GitHub ↗
(
    name: string,
    schema: JSONSchema7,
    packageName: string,
    packageDir: string,
    headerComment: string
)

Source from the content-addressed store, hash-verified

1181}
1182
1183async function generateStandaloneRecord(
1184 name: string,
1185 schema: JSONSchema7,
1186 packageName: string,
1187 packageDir: string,
1188 headerComment: string
1189): Promise<void> {
1190 const nestedTypes = new Map<string, { code: string }>();
1191 const { code, imports } = generateRpcClass(name, schema, nestedTypes, packageName);
1192
1193 const lines: string[] = [];
1194 lines.push(COPYRIGHT);
1195 lines.push("");
1196 lines.push(AUTO_GENERATED_HEADER);
1197 lines.push(headerComment);
1198 lines.push("");
1199 lines.push(`package ${packageName};`);
1200 lines.push("");
1201
1202 const allImports = new Set<string>([
1203 "com.fasterxml.jackson.annotation.JsonIgnoreProperties",
1204 "com.fasterxml.jackson.annotation.JsonProperty",
1205 "com.fasterxml.jackson.annotation.JsonInclude",
1206 "javax.annotation.processing.Generated",
1207 ...imports,
1208 ]);
1209 const sortedImports = [...allImports].sort();
1210 for (const imp of sortedImports) {
1211 lines.push(`import ${imp};`);
1212 }
1213 lines.push("");
1214
1215 if (schema.description) {
1216 lines.push(`/**`);
1217 lines.push(` * ${schema.description}`);
1218 lines.push(` *`);
1219 lines.push(` * @since 1.0.0`);
1220 lines.push(` */`);
1221 }
1222 lines.push(GENERATED_ANNOTATION);
1223 lines.push(code);
1224 lines.push("");
1225
1226 await writeGeneratedFile(`${packageDir}/${name}.java`, lines.join("\n"));
1227}
1228
1229// ── RPC types codegen ─────────────────────────────────────────────────────────
1230

Callers 1

Calls 4

generateRpcClassFunction · 0.85
joinMethod · 0.80
writeGeneratedFileFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…