Skip to content

Commit

Permalink
http-client-java, upgrade tcgc 0.48.3 (#5230)
Browse files Browse the repository at this point in the history
For now, ignore pageable in unbranded.
  • Loading branch information
weidongxu-microsoft authored Nov 29, 2024
1 parent b6dcb04 commit b9e5648
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
11 changes: 8 additions & 3 deletions packages/http-client-java/emitter/src/code-model-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ export class CodeModelBuilder {
private program: Program;
private typeNameOptions: TypeNameOptions;
private namespace: string;
private baseJavaNamespace: string = ""; // it will be set at the start of "build" function
private legacyJavaNamespace: boolean = false; // backward-compatible mode, that emitter ignores clientNamespace from TCGC
private baseJavaNamespace!: string;
private legacyJavaNamespace!: boolean; // backward-compatible mode, that emitter ignores clientNamespace from TCGC
private sdkContext!: SdkContext;
private options: EmitterOptions;
private codeModel: CodeModel;
Expand Down Expand Up @@ -386,7 +386,7 @@ export class CodeModelBuilder {
}

private isBranded(): boolean {
return !this.options["flavor"] || this.options["flavor"].toLocaleLowerCase() === "azure";
return this.options["flavor"]?.toLocaleLowerCase() === "azure";
}

private processModels() {
Expand Down Expand Up @@ -957,6 +957,11 @@ export class CodeModelBuilder {
responses: SdkHttpResponse[],
sdkMethod: SdkMethod<SdkHttpOperation>,
) {
if (!this.isBranded()) {
// TODO: currently unbranded does not support paged operation
return;
}

if (sdkMethod.kind === "paging" || sdkMethod.kind === "lropaging") {
for (const response of responses) {
const bodyType = response.type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@azure-tools/cadl-ranch-specs": "0.39.4",
"@typespec/http-client-java": "file:/../../typespec-http-client-java-0.1.1.tgz",
"@typespec/http-client-java": "file:/../../typespec-http-client-java-0.1.2.tgz",
"@typespec/http-client-java-tests": "file:"
},
"overrides": {
Expand All @@ -24,7 +24,7 @@
"@typespec/openapi": "~0.62.0",
"@typespec/xml": "~0.62.0",
"@azure-tools/typespec-azure-core": "~0.48.0",
"@azure-tools/typespec-client-generator-core": "~0.48.0",
"@azure-tools/typespec-client-generator-core": "~0.48.3",
"@azure-tools/typespec-azure-resource-manager": "~0.48.0",
"@azure-tools/typespec-autorest": "~0.48.0"
},
Expand Down
15 changes: 8 additions & 7 deletions packages/http-client-java/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/http-client-java/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typespec/http-client-java",
"version": "0.1.1",
"version": "0.1.2",
"description": "TypeSpec library for emitting Java client from the TypeSpec REST protocol binding",
"keywords": [
"TypeSpec"
Expand Down Expand Up @@ -44,7 +44,7 @@
"peerDependencies": {
"@azure-tools/typespec-autorest": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-azure-core": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.48.2 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.48.3 <1.0.0",
"@typespec/compiler": ">=0.62.0 <1.0.0",
"@typespec/http": ">=0.62.0 <1.0.0",
"@typespec/openapi": ">=0.62.0 <1.0.0",
Expand All @@ -63,7 +63,7 @@
"@azure-tools/typespec-azure-core": "0.48.0",
"@azure-tools/typespec-azure-resource-manager": "0.48.0",
"@azure-tools/typespec-azure-rulesets": "0.48.0",
"@azure-tools/typespec-client-generator-core": "0.48.2",
"@azure-tools/typespec-client-generator-core": "0.48.3",
"@microsoft/api-extractor": "^7.47.11",
"@microsoft/api-extractor-model": "^7.29.8",
"@types/js-yaml": "~4.0.9",
Expand Down

0 comments on commit b9e5648

Please sign in to comment.