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

Function generateUnknownEventClass

java/scripts/codegen/java.ts:848–882  ·  view source on GitHub ↗
(packageName: string, packageDir: string)

Source from the content-addressed store, hash-verified

846}
847
848async function generateUnknownEventClass(packageName: string, packageDir: string): Promise<void> {
849 const lines: string[] = [];
850 lines.push(COPYRIGHT);
851 lines.push("");
852 lines.push(AUTO_GENERATED_HEADER);
853 lines.push(GENERATED_FROM_SESSION_EVENTS);
854 lines.push("");
855 lines.push(`package ${packageName};`);
856 lines.push("");
857 lines.push(`import com.fasterxml.jackson.annotation.JsonIgnoreProperties;`);
858 lines.push(`import com.fasterxml.jackson.annotation.JsonProperty;`);
859 lines.push(`import javax.annotation.processing.Generated;`);
860 lines.push("");
861 lines.push(`/**`);
862 lines.push(` * Fallback for event types not yet known to this SDK version.`);
863 lines.push(` * <p>`);
864 lines.push(` * {@link #getType()} returns the original type string from the JSON payload,`);
865 lines.push(` * preserving forward compatibility with event types introduced by newer CLI versions.`);
866 lines.push(` *`);
867 lines.push(` * @since 1.0.0`);
868 lines.push(` */`);
869 lines.push(`@JsonIgnoreProperties(ignoreUnknown = true)`);
870 lines.push(GENERATED_ANNOTATION);
871 lines.push(`public final class UnknownSessionEvent extends SessionEvent {`);
872 lines.push("");
873 lines.push(` @JsonProperty("type")`);
874 lines.push(` private String type = "unknown";`);
875 lines.push("");
876 lines.push(` @Override`);
877 lines.push(` public String getType() { return type; }`);
878 lines.push(`}`);
879 lines.push("");
880
881 await writeGeneratedFile(`${packageDir}/UnknownSessionEvent.java`, lines.join("\n"));
882}
883
884/** Render a nested type (enum or record) indented at the given level. */
885function renderNestedType(nested: JavaClassDef, indentLevel: number, nestedTypes: Map<string, JavaClassDef>, allImports: Set<string>): string[] {

Callers 1

Calls 3

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…