diff --git a/.chronus/changes/witemple-msft-visibility-enum-2024-10-7-17-47-11.md b/.chronus/changes/witemple-msft-visibility-enum-2024-10-7-17-47-11.md new file mode 100644 index 0000000000..07260605b0 --- /dev/null +++ b/.chronus/changes/witemple-msft-visibility-enum-2024-10-7-17-47-11.md @@ -0,0 +1,10 @@ +--- +changeKind: internal +packages: + - "@azure-tools/typespec-autorest" + - "@azure-tools/typespec-azure-core" + - "@azure-tools/typespec-azure-resource-manager" + - "@azure-tools/typespec-client-generator-core" +--- + +Mask deprecation lint warnings for uptake of enum-driven visibility. \ No newline at end of file diff --git a/core b/core index 34af566eca..910ca35fd6 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 34af566eca9855ad21a12d8af9918ef292da99ab +Subproject commit 910ca35fd6943c5a38140f4a2698b974bbcd022c diff --git a/packages/typespec-autorest/src/openapi.ts b/packages/typespec-autorest/src/openapi.ts index 13070eea7f..3ef3f624bf 100644 --- a/packages/typespec-autorest/src/openapi.ts +++ b/packages/typespec-autorest/src/openapi.ts @@ -1986,6 +1986,7 @@ export async function getOpenAPIForService( if (isReadonlyProperty(program, prop)) { property.readOnly = true; } else { + // eslint-disable-next-line @typescript-eslint/no-deprecated const vis = getVisibility(program, prop); if (vis) { const mutability = []; @@ -2038,6 +2039,7 @@ export async function getOpenAPIForService( function canSharePropertyUsingReadonlyOrXMSMutability(prop: ModelProperty) { const sharedVisibilities = ["read", "create", "update", "write"]; + // eslint-disable-next-line @typescript-eslint/no-deprecated const visibilities = getVisibility(program, prop); if (visibilities) { for (const visibility of visibilities) { diff --git a/packages/typespec-autorest/src/utils.ts b/packages/typespec-autorest/src/utils.ts index 9c8f7242c6..c051fe4db8 100644 --- a/packages/typespec-autorest/src/utils.ts +++ b/packages/typespec-autorest/src/utils.ts @@ -103,6 +103,7 @@ export function resolveOperationId(context: AutorestEmitterContext, operation: O * designate a read-only property. */ export function isReadonlyProperty(program: Program, property: ModelProperty) { + // eslint-disable-next-line @typescript-eslint/no-deprecated const visibility = getVisibility(program, property); // note: multiple visibilities that include read are not handled using // readonly: true, but using separate schemas. diff --git a/packages/typespec-azure-core/src/rules/require-key-visibility.ts b/packages/typespec-azure-core/src/rules/require-key-visibility.ts index d5b36557c1..9ffca7bcc0 100644 --- a/packages/typespec-azure-core/src/rules/require-key-visibility.ts +++ b/packages/typespec-azure-core/src/rules/require-key-visibility.ts @@ -18,6 +18,7 @@ export const requireKeyVisibility = createRule({ model.name !== "object" ) { for (const [name, prop] of model.properties) { + // eslint-disable-next-line @typescript-eslint/no-deprecated if (isKey(context.program, prop) && !getVisibility(context.program, prop)) { context.reportDiagnostic({ target: prop, diff --git a/packages/typespec-azure-resource-manager/src/rules/arm-resource-provisioning-state-rule.ts b/packages/typespec-azure-resource-manager/src/rules/arm-resource-provisioning-state-rule.ts index 8947f80afa..54ea8615e1 100644 --- a/packages/typespec-azure-resource-manager/src/rules/arm-resource-provisioning-state-rule.ts +++ b/packages/typespec-azure-resource-manager/src/rules/arm-resource-provisioning-state-rule.ts @@ -108,6 +108,7 @@ export const armResourceProvisioningStateRule = createRule({ } // validate it must has a read only visibility + // eslint-disable-next-line @typescript-eslint/no-deprecated const visibilities = getVisibility(context.program, provisioning); if ( !(visibilities !== undefined && visibilities.length === 1 && visibilities[0] === "read") diff --git a/packages/typespec-azure-resource-manager/src/rules/resource-name.ts b/packages/typespec-azure-resource-manager/src/rules/resource-name.ts index 521e6261af..7500e0c994 100644 --- a/packages/typespec-azure-resource-manager/src/rules/resource-name.ts +++ b/packages/typespec-azure-resource-manager/src/rules/resource-name.ts @@ -44,6 +44,7 @@ export const resourceNameRule = createRule({ } function checkResourceName(nameProp: ModelProperty) { + // eslint-disable-next-line @typescript-eslint/no-deprecated const visibilities = getVisibility(context.program, nameProp); return ( !http.isPathParam(context.program, nameProp) || diff --git a/packages/typespec-client-generator-core/src/types.ts b/packages/typespec-client-generator-core/src/types.ts index fa022b2b43..6f5b5e9677 100644 --- a/packages/typespec-client-generator-core/src/types.ts +++ b/packages/typespec-client-generator-core/src/types.ts @@ -1036,6 +1036,7 @@ export function isReadOnly(property: SdkBodyModelPropertyType) { } function getSdkVisibility(context: TCGCContext, type: ModelProperty): Visibility[] | undefined { + // eslint-disable-next-line @typescript-eslint/no-deprecated const visibility = getVisibility(context.program, type); if (visibility) { const result: Visibility[] = [];