The emitter is the TypeSpec library for emitting Java client from the TypeSpec REST protocol binding.
See Emitter for the basics on the TypeSpec emitter library.
See Developer Guide for TypeSpec Emitter for basics on this repository.
Guideline:
- Most of the development work should happen in "core/packages/http-client-java" folder.
- Before starting the development in "core" folder, always checkout latest code from main branch, and create a dev branch upon it.
- When checking in code in "core" folder, do not check-in the files in "core.patch".
- When preparing the PR, create 2 PRs, one for the code changes in submodule ("typespec" repository, if there is change), one for the code changes in this repository (which would include the update on "core" submodule).
TypeScript code for the Emitter is in "core/packages/http-client-java/emitter" folder. Follow the package.json for the build and unit test.
The code there, in runtime, produces a "code-model.yaml" file, and passes it to Java Part to generate Java client.
Java code for the Emitter is in "core/packages/http-client-java/generator/http-client-generator" (which depends on "http-client-generator-core" and "http-client-generator-mgmt" module). Follow the pom.xml for the build and unit test.
The code there, in runtime, consumes the "code-model.yaml" file produced by the TypeSpec Part, and generate the Java client.
Instructions:
- Always use absolute path when change directory.
Steps:
- In "core" folder, run
git pull upstream mainto fetch latest commit from upstream or origin. - Go back to project root. Commit the change in "core" folder.
- Run
ncu -uon "package.json" in both "package.json" from "typespec-extension" and "typespec-tests" folder. - Update package versions in
peerDependencies(keep the semver range) in "package.json" from "typespec-extension" folder, according to the corresponding package versions indevDependencies. - Update version of "@azure-tools/openai-typespec" in "package.json" from "typespec-extension" folder, set it to the same semantic version used in https://raw.githubusercontent.com/Azure/azure-rest-api-specs/refs/heads/main/package.json
- Update package versions in
override(keep the semver range) in "package.json" from "typespec-tests" folder, according to the corresponding package versions in "package.json" from "typespec-extension" folder. - Save the files, and run
npm installin "typespec-extension" folder, so that "package-lock.json" would be updated. - Run
npm audit fixin "typespec-extension" folder. - Commit the changes in "typespec-extension" and "typespec-tests" folders.
- Run
pwsh SyncTests.ps1in "typespec-tests" folder. - Commit the changes in "typespec-tests" folder, include new files.
Steps:
- Bump minor/patch version of
@typespec/typespec-javain both "package.json" from "typespec-extension" and "typespec-tests" folder. - Save the file, and run
npm installin "typespec-extension" folder, so that "package-lock.json" would be updated. - Add a new item in release history in "typespec-extension/changelog.md". The version would be the minor/patch version. The date would be today.
The publish to NPM pipeline needs to be triggered, after the PR is merged.
After release, the sync SDK pipeline needs to be triggered, to sync the released typespec-java into the SDK repository. This pipeline also regenerates all SDK based on TypeSpec.