Skip to content

Add classical code generation workflow for Java SDK#70

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-classical-code-gen-workflow
Draft

Add classical code generation workflow for Java SDK#70
Copilot wants to merge 2 commits intomainfrom
copilot/add-classical-code-gen-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 12, 2026

Implements the classical code-gen pipeline for the Java SDK, analogous to the dotnet/nodejs/python generators in copilot-sdk/scripts/codegen/. Consumes session-events.schema.json and api.schema.json from the @github/copilot npm package to generate typed Java source files.

Before the change?

  • All Java event and RPC types were hand-authored and manually kept in sync with upstream schema changes — no automated generation or drift detection.

After the change?

Codegen script (scripts/codegen/java.ts)

  • Reads session-events.schema.json → generates com.github.copilot.sdk.generated (76 files): SessionEvent base with full @JsonTypeInfo/@JsonSubTypes polymorphism, one typed event class per variant, UnknownSessionEvent fallback
  • Reads api.schema.json → generates com.github.copilot.sdk.generated.rpc (111 files): params/result DTOs for all 61 RPC methods
  • All generated files carry // AUTO-GENERATED FILE - DO NOT EDIT, schema-source comment, and @javax.annotation.processing.Generated("copilot-sdk-codegen")
  • Nested objects, enums, arrays, UUID, and date-time types are handled; inner classes are emitted inline

Maven (pom.xml)

  • build-helper-maven-plugin adds src/generated/java as a source root
  • Spotless excludes src/generated/java/**

Infrastructure

  • config/checkstyle/checkstyle.xml — excludes generated and rpc packages from Javadoc enforcement
  • .gitattributessrc/generated/java/** eol=lf linguist-generated=true
  • .github/workflows/codegen-check.yml — installs deps, re-runs npm run generate, fails on any diff (runs on push/pull_request paths that touch codegen or generated files)
  • .github/workflows/update-copilot-dependency.ymlworkflow_dispatch with version input; updates @github/copilot in scripts/codegen, regenerates, opens a PR automatically

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • mvn spotless:apply has been run to format the code
  • mvn clean verify passes locally

Does this introduce a breaking change?

  • Yes
  • No

Copilot AI linked an issue Apr 12, 2026 that may be closed by this pull request
1 task
- Add scripts/codegen/java.ts - Java code generator from session-events and api schemas
- Add scripts/codegen/package.json with @github/copilot dependency
- Add scripts/codegen/package-lock.json
- Generate src/generated/java/com/github/copilot/sdk/generated/ - 76 session event files
- Generate src/generated/java/com/github/copilot/sdk/generated/rpc/ - 111 RPC type files
- Update pom.xml: add build-helper-maven-plugin, exclude generated from Spotless
- Update config/checkstyle/checkstyle.xml: exclude generated packages
- Update .gitattributes: mark src/generated/java/** as generated
- Add .github/workflows/codegen-check.yml - CI check workflow
- Add .github/workflows/update-copilot-dependency.yml - update workflow
- Update docs/WORKFLOWS.md with new workflow documentation
- Update .gitignore to exclude scripts/codegen/node_modules/"

Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/aee4deda-40d4-4ecd-a831-2af9cb9461e7

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Copilot AI changed the title [WIP] Add classical code generation to workflow Add classical code generation workflow for Java SDK Apr 12, 2026
Copilot AI requested a review from edburns April 12, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Add classical code-gen to workflow

2 participants