Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tcgc] add .sdkPackage now that the design is finalized #562

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .chronus/changes/add_sdk_package-2024-3-1-11-37-51.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: deprecation
packages:
- "@azure-tools/typespec-client-generator-core"
---

deprecate `SdkContext.experimetal_sdkPackage` and add `SdkContext.sdkPackage` now that the design for `sdkPackage` is set
7 changes: 5 additions & 2 deletions packages/typespec-client-generator-core/src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
} from "./interfaces.js";
import { TCGCContext, parseEmitterName } from "./internal-utils.js";
import { createStateSymbol, reportDiagnostic } from "./lib.js";
import { experimental_getSdkPackage } from "./package.js";
import { getSdkPackage } from "./package.js";
import { getLibraryName } from "./public-utils.js";
import { getSdkEnum, getSdkModel, getSdkUnion } from "./types.js";

Expand Down Expand Up @@ -512,14 +512,17 @@ export function createSdkContext<
program: context.program,
emitContext: context,
experimental_sdkPackage: undefined!,
sdkPackage: undefined!,
emitterName: parseEmitterName(emitterName ?? context.program.emitters[0]?.metadata?.name), // eslint-disable-line deprecation/deprecation
generateProtocolMethods: generateProtocolMethods,
generateConvenienceMethods: generateConvenienceMethods,
filterOutCoreModels: context.options["filter-out-core-models"] ?? true,
packageName: context.options["package-name"],
flattenUnionAsEnum: context.options["flatten-union-as-enum"] ?? true,
};
sdkContext.experimental_sdkPackage = experimental_getSdkPackage(sdkContext);
sdkContext.sdkPackage = getSdkPackage(sdkContext);
// eslint-disable-next-line deprecation/deprecation
sdkContext.experimental_sdkPackage = sdkContext.sdkPackage;
return sdkContext;
}

Expand Down
4 changes: 4 additions & 0 deletions packages/typespec-client-generator-core/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ export interface SdkContext<
TServiceOperation extends SdkServiceOperation = SdkHttpOperation,
> extends TCGCContext {
emitContext: EmitContext<TOptions>;
/**
* @deprecated This property is deprecated. Use `.sdkPackage` instead.
*/
experimental_sdkPackage: SdkPackage<TServiceOperation>;
sdkPackage: SdkPackage<TServiceOperation>;
__clients?: SdkClientType<TServiceOperation>[];
}

Expand Down
2 changes: 1 addition & 1 deletion packages/typespec-client-generator-core/src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ function createSdkClientType<
return diagnostics.wrap(sdkClientType);
}

export function experimental_getSdkPackage<
export function getSdkPackage<
TOptions extends object,
TServiceOperation extends SdkServiceOperation,
>(context: SdkContext<TOptions, TServiceOperation>): SdkPackage<TServiceOperation> {
Expand Down
Loading
Loading