From 0483fd2f340fa48a9b4f7a2416c1b39f4cf6097d Mon Sep 17 00:00:00 2001 From: pshao25 <97225342+pshao25@users.noreply.github.com> Date: Fri, 17 May 2024 18:34:38 +0800 Subject: [PATCH] fix error and warning --- .../src/generate/generate-arm-resource.ts | 22 +- .../src/generate/generate-object.ts | 8 +- .../openapi-to-typespec/src/interfaces.ts | 11 +- .../src/transforms/transform-arm-resources.ts | 80 ++- .../src/transforms/transform-object.ts | 56 +- .../openapi-to-typespec/src/utils/docs.ts | 9 + .../src/utils/model-generation.ts | 11 +- .../src/utils/suppressions.ts | 41 ++ .../src/utils/type-mapping.ts | 8 + .../test/analyzeText/tsp-output/models.tsp | 4 +- .../swagger-output/swagger.json | 29 -- .../arm-agrifood/swagger-output/swagger.json | 23 +- .../arm-agrifood/tsp-output/DataConnector.tsp | 25 +- .../tsp-output/DataManagerForAgriculture.tsp | 30 +- .../DataManagerForAgricultureExtension.tsp | 22 +- .../DataManagerForAgricultureSolution.tsp | 22 +- .../arm-agrifood/tsp-output/Extension.tsp | 21 +- .../tsp-output/PrivateEndpointConnection.tsp | 21 +- .../tsp-output/PrivateLinkResource.tsp | 19 +- .../test/arm-agrifood/tsp-output/Solution.tsp | 22 +- .../test/arm-agrifood/tsp-output/models.tsp | 10 +- .../arm-alertsmanagement/tsp-output/Alert.tsp | 18 +- .../tsp-output/AlertProcessingRule.tsp | 23 +- .../tsp-output/SmartGroup.tsp | 19 +- .../tsp-output/models.tsp | 2 + .../tsp-output/AnalysisServicesServer.tsp | 28 +- .../tsp-output/models.tsp | 2 + .../tsp-output/AccessInformationContract.tsp | 4 +- .../tsp-output/ApiContract.tsp | 28 +- .../ApiManagementServiceResource.tsp | 34 +- .../tsp-output/ApiReleaseContract.tsp | 28 +- .../tsp-output/ApiVersionSetContract.tsp | 28 +- .../AuthorizationServerContract.tsp | 28 +- .../tsp-output/BackendContract.tsp | 27 +- .../tsp-output/CacheContract.tsp | 28 +- .../tsp-output/CertificateContract.tsp | 26 +- .../tsp-output/DeletedServiceContract.tsp | 27 +- .../tsp-output/DiagnosticContract.tsp | 28 +- .../tsp-output/EmailTemplateContract.tsp | 5 +- .../GatewayCertificateAuthorityContract.tsp | 26 +- .../tsp-output/GatewayContract.tsp | 27 +- .../GatewayHostnameConfigurationContract.tsp | 25 +- .../tsp-output/GlobalSchemaContract.tsp | 25 +- .../tsp-output/GroupContract.tsp | 27 +- .../tsp-output/IdentityProviderContract.tsp | 5 +- .../tsp-output/IssueAttachmentContract.tsp | 26 +- .../tsp-output/IssueCommentContract.tsp | 26 +- .../tsp-output/IssueContract.tsp | 28 +- .../tsp-output/LoggerContract.tsp | 26 +- .../tsp-output/NamedValueContract.tsp | 24 +- .../tsp-output/NotificationContract.tsp | 2 +- .../OpenidConnectProviderContract.tsp | 26 +- .../tsp-output/OperationContract.tsp | 27 +- .../tsp-output/PolicyContract.tsp | 3 +- .../tsp-output/PortalDelegationSettings.tsp | 15 +- .../tsp-output/PortalRevisionContract.tsp | 26 +- .../tsp-output/PortalSigninSettings.tsp | 15 +- .../tsp-output/PortalSignupSettings.tsp | 15 +- .../tsp-output/PrivateEndpointConnection.tsp | 23 +- .../tsp-output/PrivateLinkResource.tsp | 19 +- .../tsp-output/ProductContract.tsp | 27 +- .../tsp-output/SchemaContract.tsp | 25 +- .../tsp-output/SubscriptionContract.tsp | 23 +- .../tsp-output/TagContract.tsp | 27 +- .../tsp-output/TagDescriptionContract.tsp | 26 +- .../tsp-output/TenantSettingsContract.tsp | 2 +- .../tsp-output/UserContract.tsp | 27 +- .../arm-apimanagement/tsp-output/models.tsp | 11 + .../tsp-output/DenyAssignment.tsp | 19 +- .../tsp-output/ProviderOperationsMetadata.tsp | 21 +- .../tsp-output/RoleAssignment.tsp | 21 +- .../tsp-output/RoleAssignmentSchedule.tsp | 21 +- .../RoleAssignmentScheduleInstance.tsp | 21 +- .../RoleAssignmentScheduleRequest.tsp | 20 +- .../tsp-output/RoleDefinition.tsp | 19 +- .../tsp-output/RoleEligibilitySchedule.tsp | 21 +- .../RoleEligibilityScheduleInstance.tsp | 21 +- .../RoleEligibilityScheduleRequest.tsp | 20 +- .../tsp-output/RoleManagementPolicy.tsp | 22 +- .../RoleManagementPolicyAssignment.tsp | 20 +- .../tsp-output/Application.tsp | 24 +- .../tsp-output/BusinessProcess.tsp | 24 +- .../tsp-output/BusinessProcessVersion.tsp | 20 +- .../tsp-output/InfrastructureResource.tsp | 25 +- .../tsp-output/Space.tsp | 23 +- .../tsp-output/models.tsp | 15 + .../tsp-output/AvailabilitySet.tsp | 19 +- .../tsp-output/CapacityReservation.tsp | 21 +- .../tsp-output/CapacityReservationGroup.tsp | 21 +- .../arm-compute/tsp-output/CloudService.tsp | 22 +- .../tsp-output/CloudServiceRole.tsp | 17 +- .../tsp-output/CommunityGallery.tsp | 17 +- .../tsp-output/CommunityGalleryImage.tsp | 19 +- .../CommunityGalleryImageVersion.tsp | 19 +- .../arm-compute/tsp-output/DedicatedHost.tsp | 21 +- .../tsp-output/DedicatedHostGroup.tsp | 19 +- .../test/arm-compute/tsp-output/Disk.tsp | 23 +- .../arm-compute/tsp-output/DiskAccess.tsp | 23 +- .../tsp-output/DiskEncryptionSet.tsp | 23 +- .../tsp-output/DiskRestorePoint.tsp | 16 +- .../test/arm-compute/tsp-output/Gallery.tsp | 21 +- .../tsp-output/GalleryApplication.tsp | 23 +- .../tsp-output/GalleryApplicationVersion.tsp | 23 +- .../arm-compute/tsp-output/GalleryImage.tsp | 23 +- .../tsp-output/GalleryImageVersion.tsp | 23 +- .../test/arm-compute/tsp-output/Image.tsp | 21 +- .../test/arm-compute/tsp-output/OSFamily.tsp | 17 +- .../test/arm-compute/tsp-output/OSVersion.tsp | 17 +- .../tsp-output/PrivateEndpointConnection.tsp | 21 +- .../tsp-output/ProximityPlacementGroup.tsp | 21 +- .../arm-compute/tsp-output/RestorePoint.tsp | 19 +- .../tsp-output/RestorePointCollection.tsp | 21 +- .../arm-compute/tsp-output/RoleInstance.tsp | 21 +- .../tsp-output/RollingUpgradeStatusInfo.tsp | 12 +- .../arm-compute/tsp-output/SharedGallery.tsp | 17 +- .../tsp-output/SharedGalleryImage.tsp | 19 +- .../tsp-output/SharedGalleryImageVersion.tsp | 19 +- .../test/arm-compute/tsp-output/Snapshot.tsp | 23 +- .../tsp-output/SshPublicKeyResource.tsp | 19 +- .../arm-compute/tsp-output/VirtualMachine.tsp | 21 +- .../tsp-output/VirtualMachineExtension.tsp | 23 +- .../VirtualMachineExtensionImage.tsp | 14 +- .../tsp-output/VirtualMachineRunCommand.tsp | 23 +- .../tsp-output/VirtualMachineScaleSet.tsp | 21 +- .../VirtualMachineScaleSetExtension.tsp | 23 +- .../tsp-output/VirtualMachineScaleSetVM.tsp | 19 +- .../VirtualMachineScaleSetVMExtension.tsp | 23 +- .../test/arm-compute/tsp-output/models.tsp | 14 + .../test/arm-dns/tsp-output/DnsRecord.tsp | 21 +- .../test/arm-dns/tsp-output/DnsZone.tsp | 21 +- .../test/arm-dns/tsp-output/models.tsp | 3 + .../BatchDeploymentTrackedResource.tsp | 29 +- .../BatchEndpointTrackedResource.tsp | 27 +- .../tsp-output/CodeContainerResource.tsp | 22 +- .../tsp-output/CodeVersionResource.tsp | 21 +- .../tsp-output/ComponentContainerResource.tsp | 22 +- .../tsp-output/ComponentVersionResource.tsp | 21 +- .../tsp-output/ComputeResource.tsp | 28 +- .../tsp-output/DataContainerResource.tsp | 21 +- .../tsp-output/DataVersionBaseResource.tsp | 21 +- .../tsp-output/DatastoreResource.tsp | 19 +- .../EnvironmentContainerResource.tsp | 24 +- .../tsp-output/EnvironmentVersionResource.tsp | 23 +- .../tsp-output/Feature.tsp | 20 +- .../tsp-output/FeaturesetContainer.tsp | 21 +- .../tsp-output/FeaturesetVersion.tsp | 21 +- .../FeaturestoreEntityContainer.tsp | 23 +- .../tsp-output/FeaturestoreEntityVersion.tsp | 23 +- .../tsp-output/JobBaseResource.tsp | 25 +- .../tsp-output/LabelingJob.tsp | 19 +- .../tsp-output/ModelContainerResource.tsp | 22 +- .../tsp-output/ModelVersionResource.tsp | 21 +- .../OnlineDeploymentTrackedResource.tsp | 29 +- .../OnlineEndpointTrackedResource.tsp | 27 +- .../tsp-output/OutboundRuleBasicResource.tsp | 24 +- .../tsp-output/PrivateEndpointConnection.tsp | 23 +- .../tsp-output/Registry.tsp | 30 +- .../tsp-output/Schedule.tsp | 21 +- .../tsp-output/Workspace.tsp | 29 +- ...aceConnectionPropertiesV2BasicResource.tsp | 25 +- .../tsp-output/models.tsp | 99 +++- .../swagger-output/swagger.json | 83 ++- .../tsp-output/DataProduct.tsp | 30 +- .../tsp-output/DataProductsCatalog.tsp | 15 +- .../tsp-output/DataType.tsp | 26 +- .../tsp-output/models.tsp | 8 +- .../swagger-output/swagger.json | 24 +- .../tsp-output/Association.tsp | 23 +- .../tsp-output/Frontend.tsp | 22 +- .../tsp-output/TrafficController.tsp | 23 +- .../arm-sphere/swagger-output/swagger.json | 88 ++-- .../test/arm-sphere/tsp-output/Catalog.tsp | 21 +- .../arm-sphere/tsp-output/Certificate.tsp | 21 +- .../test/arm-sphere/tsp-output/Deployment.tsp | 21 +- .../test/arm-sphere/tsp-output/Device.tsp | 21 +- .../arm-sphere/tsp-output/DeviceGroup.tsp | 22 +- .../test/arm-sphere/tsp-output/Image.tsp | 19 +- .../test/arm-sphere/tsp-output/Product.tsp | 22 +- .../arm-storage/swagger-output/swagger.json | 484 +++++++----------- .../arm-storage/tsp-output/BlobContainer.tsp | 27 +- .../tsp-output/BlobInventoryPolicy.tsp | 14 +- .../tsp-output/BlobServiceProperties.tsp | 15 +- .../arm-storage/tsp-output/DeletedAccount.tsp | 23 +- .../tsp-output/EncryptionScope.tsp | 26 +- .../tsp-output/FileServiceProperties.tsp | 15 +- .../test/arm-storage/tsp-output/FileShare.tsp | 27 +- .../tsp-output/ImmutabilityPolicy.tsp | 14 +- .../test/arm-storage/tsp-output/LocalUser.tsp | 25 +- .../tsp-output/ManagementPolicy.tsp | 14 +- .../tsp-output/ObjectReplicationPolicy.tsp | 23 +- .../tsp-output/PrivateEndpointConnection.tsp | 21 +- .../tsp-output/QueueServiceProperties.tsp | 13 +- .../arm-storage/tsp-output/StorageAccount.tsp | 31 +- .../arm-storage/tsp-output/StorageQueue.tsp | 28 +- .../test/arm-storage/tsp-output/Table.tsp | 28 +- .../tsp-output/TableServiceProperties.tsp | 13 +- .../test/arm-storage/tsp-output/models.tsp | 7 + .../test/arm-test/swagger-output/swagger.json | 14 +- .../test/arm-test/tsp-output/ArrayDefault.tsp | 21 +- .../test/arm-test/tsp-output/DictProperty.tsp | 20 +- .../test/arm-test/tsp-output/Employee.tsp | 22 +- .../test/arm-test/tsp-output/Enroll.tsp | 14 +- .../test/arm-test/tsp-output/models.tsp | 4 +- .../test/openAI/tsp-output/models.tsp | 5 +- .../test/qna/tsp-output/models.tsp | 4 +- .../test/qnaAuthoring/tsp-output/models.tsp | 4 +- .../test/utils/generate-typespec.ts | 2 + 207 files changed, 2779 insertions(+), 2192 deletions(-) create mode 100644 packages/extensions/openapi-to-typespec/src/utils/suppressions.ts create mode 100644 packages/extensions/openapi-to-typespec/src/utils/type-mapping.ts diff --git a/packages/extensions/openapi-to-typespec/src/generate/generate-arm-resource.ts b/packages/extensions/openapi-to-typespec/src/generate/generate-arm-resource.ts index 0c7bb54d81..f10527b24f 100644 --- a/packages/extensions/openapi-to-typespec/src/generate/generate-arm-resource.ts +++ b/packages/extensions/openapi-to-typespec/src/generate/generate-arm-resource.ts @@ -5,10 +5,11 @@ import pluralize from "pluralize"; import { getArmCommonTypeVersion } from "../autorest-session"; import { getOptions } from "../options"; import { replaceGeneratedResourceObject } from "../transforms/transform-arm-resources"; -import { generateDecorators } from "../utils/decorators"; +import { generateAugmentedDecorators, generateDecorators } from "../utils/decorators"; import { generateDocs } from "../utils/docs"; import { getModelPropertiesDeclarations } from "../utils/model-generation"; import { generateOperation } from "./generate-operations"; +import { generateSuppressions } from "../utils/suppressions"; export function generateArmResource(resource: TspArmResource): string { const definitions: string[] = []; @@ -21,6 +22,10 @@ export function generateArmResource(resource: TspArmResource): string { definitions.push("\n"); + for (const a of resource.augmentDecorators ?? []) { + definitions.push(generateAugmentedDecorators(a.target!, [a])); + } + for (const o of resource.resourceOperations) { for (const d of o.customizations ?? []) { definitions.push(`${d}`); @@ -61,8 +66,13 @@ function generateArmResourceModel(resource: TspArmResource): string { resource.propertiesPropertyVisibility.includes("read") && resource.propertiesPropertyVisibility.includes("create")) ) { - definitions.push(`model ${resource.name} is ${resource.resourceKind}<${resource.propertiesModelName}> {`); + definitions.push( + `model ${resource.name} is Azure.ResourceManager.${resource.resourceKind}<${resource.propertiesModelName}> {`, + ); + if (resource.keyExpression) { + definitions.push(`${resource.keyExpression}`); + } definitions = [...definitions, ...getModelPropertiesDeclarations(resource.properties)]; } else { definitions.push( @@ -81,9 +91,12 @@ function generateArmResourceModel(resource: TspArmResource): string { } } else { definitions.push(`@Azure.ResourceManager.Private.armResourceInternal(${resource.propertiesModelName})`); - definitions.push(`model ${resource.name} extends ${resource.resourceKind}Base {`); + definitions.push(`model ${resource.name} extends Foundations.${resource.resourceKind} {`); } + if (resource.keyExpression) { + definitions.push(`${resource.keyExpression}`); + } definitions = [...definitions, ...getModelPropertiesDeclarations(resource.properties)]; const propertyDoc = generateDocs({ doc: resource.propertiesPropertyDescription }); @@ -134,6 +147,9 @@ function generateArmResourceOperation(resource: TspArmResource): string { definitions.push(`@operationId("${operation.operationId}")`); definitions.push(`#suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility"`); } + if (isFullCompatible && operation.suppressions) { + definitions.push(...generateSuppressions(operation.suppressions)); + } if (operation.kind === "ArmResourceExists") { definitions.push(`op ${operation.name}(${operation.parameters.join(",")}): ${operation.responses.join("|")}`); } else if (operation.templateParameters?.length) { diff --git a/packages/extensions/openapi-to-typespec/src/generate/generate-object.ts b/packages/extensions/openapi-to-typespec/src/generate/generate-object.ts index 7bc6c5add3..ed315df97b 100644 --- a/packages/extensions/openapi-to-typespec/src/generate/generate-object.ts +++ b/packages/extensions/openapi-to-typespec/src/generate/generate-object.ts @@ -18,8 +18,6 @@ export function generateObject(typespecObject: TypespecObject) { if (typespecObject.extendedParents?.length) { const firstParent = typespecObject.extendedParents[0]; definitions.push(`model ${typespecObject.name} extends ${firstParent} {`); - } else if (typespecObject.spreadParents && typespecObject.spreadParents.length === 1) { - definitions.push(`model ${typespecObject.name} extends ${typespecObject.spreadParents[0]} {`); } else if (typespecObject.alias) { const { alias, params } = typespecObject.alias; @@ -29,10 +27,8 @@ export function generateObject(typespecObject: TypespecObject) { } if (typespecObject.spreadParents?.length) { - if (typespecObject.extendedParents?.length || typespecObject.spreadParents.length > 1) { - for (const parent of typespecObject.spreadParents) { - definitions.push(`...${parent};`); - } + for (const parent of typespecObject.spreadParents) { + definitions.push(`...${parent};`); } } diff --git a/packages/extensions/openapi-to-typespec/src/interfaces.ts b/packages/extensions/openapi-to-typespec/src/interfaces.ts index c4d5e91b34..c0ef36a57b 100644 --- a/packages/extensions/openapi-to-typespec/src/interfaces.ts +++ b/packages/extensions/openapi-to-typespec/src/interfaces.ts @@ -129,6 +129,10 @@ export interface WithFixMe { fixMe?: string[]; } +export interface WithSuppressDirectives { + suppressions?: WithSuppressDirective[]; +} + export interface WithSuppressDirective { suppressionCode?: string; suppressionMessage?: string; @@ -146,7 +150,7 @@ export interface TypespecParameter extends TypespecDataType { defaultValue?: any; } -export interface TypespecObjectProperty extends TypespecDataType { +export interface TypespecObjectProperty extends TypespecDataType, WithSuppressDirectives { kind: "property"; isOptional: boolean; type: string; @@ -160,6 +164,7 @@ export interface TypespecDecorator extends WithFixMe, WithSuppressDirective { arguments?: (string | number)[] | DecoratorArgument[]; module?: string; namespace?: string; + target?: string; } export interface TypespecAlias { @@ -175,6 +180,7 @@ export interface TypespecObject extends TypespecDataType { extendedParents?: string[]; spreadParents?: string[]; decorators?: TypespecDecorator[]; + augmentDecorators?: TypespecDecorator[]; clientDecorators?: TypespecDecorator[]; alias?: TypespecAlias; } @@ -201,7 +207,7 @@ export function isFirstLevelResource(value: string): value is FirstLevelResource return FIRST_LEVEL_RESOURCE.includes(value as FirstLevelResource); } -export interface TspArmResourceOperationBase extends WithDoc, WithFixMe { +export interface TspArmResourceOperationBase extends WithDoc, WithFixMe, WithSuppressDirectives { kind: string; name: string; templateParameters?: string[]; @@ -252,6 +258,7 @@ export interface TspArmResourceExistsOperation extends TspArmResourceOperationBa export interface TspArmResource extends TypespecObject { resourceKind: ArmResourceKind; + keyExpression: string | undefined; propertiesModelName: string; propertiesPropertyRequired: boolean; propertiesPropertyVisibility: string[]; diff --git a/packages/extensions/openapi-to-typespec/src/transforms/transform-arm-resources.ts b/packages/extensions/openapi-to-typespec/src/transforms/transform-arm-resources.ts index 967ce1b94f..d6405040b8 100644 --- a/packages/extensions/openapi-to-typespec/src/transforms/transform-arm-resources.ts +++ b/packages/extensions/openapi-to-typespec/src/transforms/transform-arm-resources.ts @@ -29,6 +29,11 @@ import { import { isResponseSchema } from "../utils/schemas"; import { getTypespecType, transformObjectProperty } from "./transform-object"; import { transformParameter, transformRequest } from "./transform-operations"; +import { + getSuppressionsForArmResourceDeleteAsync, + getSuppressionsForArmResourceDeleteSync, +} from "../utils/suppressions"; +import { generateDocs, generateDocsContent } from "../utils/docs"; const generatedResourceObjects: Map = new Map(); @@ -111,12 +116,22 @@ export function transformTspArmResource(schema: ArmResourceSchema): TspArmResour const otherOperations = operations[1]; const clientDecorators = buildResourceClientDecorators(schema, armResourceOperations, otherOperations); + const keyProperty = buildKeyProperty(schema); + const properties = [...getOtherProperties(schema, !getArmCommonTypeVersion())]; + let keyExpression, augmentDecorators; + if (keyProperty.name === "name" && keyProperty.type === "string") { + keyExpression = buildKeyExpression(schema, keyProperty); + augmentDecorators = buildKeyAugmentDecorators(schema, keyProperty); + } else { + properties.unshift(keyProperty); + } return { fixMe, resourceKind: getResourceKind(schema), kind: "object", - properties: [buildKeyProperty(schema), ...getOtherProperties(schema, !getArmCommonTypeVersion())], + properties, + keyExpression, name: schema.resourceMetadata.SwaggerModelName, parents: [], resourceParent: getParentResource(schema), @@ -127,6 +142,7 @@ export function transformTspArmResource(schema: ArmResourceSchema): TspArmResour doc: schema.language.default.description, decorators, clientDecorators, + augmentDecorators, resourceOperations: armResourceOperations, normalOperations: otherOperations, optionalStandardProperties: getArmCommonTypeVersion() ? getResourceOptionalStandardProperties(schema) : [], @@ -156,29 +172,29 @@ function getResourceOptionalStandardProperties(schema: ArmResourceSchema): strin if (msi) { let msiType; if (msi.schema.language.default.name === "ManagedServiceIdentity") { - msiType = "Azure.ResourceManager.ManagedServiceIdentity"; + msiType = "Azure.ResourceManager.ManagedServiceIdentityProperty"; } else if (msi.schema.language.default.name === "SystemAssignedServiceIdentity") { - msiType = "Azure.ResourceManager.ManagedSystemAssignedIdentity"; + msiType = "Azure.ResourceManager.ManagedSystemAssignedIdentityProperty"; } else { // TODO: handle non-standard property - msiType = "Azure.ResourceManager.ManagedServiceIdentity"; + msiType = "Azure.ResourceManager.ManagedServiceIdentityProperty"; } optionalStandardProperties.push(msiType); } if (schema.properties?.find((p) => p.serializedName === "sku")) { // TODO: handle non-standard property - optionalStandardProperties.push("Azure.ResourceManager.ResourceSku"); + optionalStandardProperties.push("Azure.ResourceManager.ResourceSkuProperty"); } if (schema.properties?.find((p) => p.serializedName === "eTag")) { // TODO: handle non-standard property - optionalStandardProperties.push("Azure.ResourceManager.EntityTag"); + optionalStandardProperties.push("Azure.ResourceManager.EntityTagProperty"); } if (schema.properties?.find((p) => p.serializedName === "plan")) { // TODO: handle non-standard property - optionalStandardProperties.push("Azure.ResourceManager.ResourcePlan"); + optionalStandardProperties.push("Azure.ResourceManager.ResourcePlanProperty"); } return optionalStandardProperties; @@ -360,7 +376,7 @@ function convertResourceUpdateOperation( examples: swaggerOperation.extensions?.["x-ms-examples"], customizations, // To resolve auto-generate update model with proper visibility - decorators: [{ name: "parameterVisibility", arguments: ["read"] }], + decorators: [{ name: "parameterVisibility", arguments: [] }], }, ]; } @@ -379,22 +395,30 @@ function convertResourceDeleteOperation( const okResponse = swaggerOperation?.responses?.filter((o) => o.protocol.http?.statusCodes.includes("200"))?.[0]; const baseParameters = buildOperationBaseParameters(swaggerOperation, resourceMetadata); const templateParameters = [resourceMetadata.SwaggerModelName]; + const kind = isLongRunning + ? okResponse + ? "ArmResourceDeleteAsync" + : "ArmResourceDeleteWithoutOkAsync" + : "ArmResourceDeleteSync"; + const suppressions = + kind === "ArmResourceDeleteAsync" + ? getSuppressionsForArmResourceDeleteAsync() + : kind === "ArmResourceDeleteSync" + ? getSuppressionsForArmResourceDeleteSync() + : undefined; if (baseParameters) { templateParameters.push(baseParameters); } return [ { doc: operation.Description, - kind: isLongRunning - ? okResponse - ? "ArmResourceDeleteAsync" - : "ArmResourceDeleteWithoutOkAsync" - : "ArmResourceDeleteSync", + kind: kind, name: getOperationName(operation.OperationID), clientDecorators: getOperationClientDecorators(swaggerOperation), operationId: operation.OperationID, templateParameters, examples: swaggerOperation.extensions?.["x-ms-examples"], + suppressions: suppressions, }, ]; } @@ -810,6 +834,36 @@ function getSchemaResponseSchemaName(response: Response | undefined): string | u return (response as SchemaResponse).schema.language.default.name; } +function buildKeyExpression(schema: ArmResourceSchema, keyProperty: TypespecObjectProperty): string { + const namePattern = keyProperty.decorators?.find((d) => d.name === "pattern")?.arguments?.[0]; + const keyName = keyProperty.decorators?.find((d) => d.name === "key")?.arguments?.[0]; + const segmentName = keyProperty.decorators?.find((d) => d.name === "segment")?.arguments?.[0]; + return `...ResourceNameParameter< + Resource = ${schema.resourceMetadata.SwaggerModelName} + ${keyName ? `, KeyName = "${keyName}"` : ""} + ${segmentName ? `, SegmentName = "${segmentName}"` : ""}, + NamePattern = ${namePattern ? `"${namePattern}"` : `""`} + >`; +} + +function buildKeyAugmentDecorators( + schema: ArmResourceSchema, + keyProperty: TypespecObjectProperty, +): TypespecDecorator[] | undefined { + return keyProperty.decorators + ?.filter((d) => !["pattern", "key", "segment"].includes(d.name)) + .filter((d) => !(d.name === "visibility" && d.arguments?.[0] === "read")) + .map((d) => { + d.target = `${schema.resourceMetadata.SwaggerModelName}.name`; + return d; + }) + .concat({ + name: "doc", + target: `${schema.resourceMetadata.SwaggerModelName}.name`, + arguments: [generateDocsContent(keyProperty)], + }); +} + function buildKeyProperty(schema: ArmResourceSchema): TypespecObjectProperty { let parameter; if (!schema.resourceMetadata.IsSingletonResource) { diff --git a/packages/extensions/openapi-to-typespec/src/transforms/transform-object.ts b/packages/extensions/openapi-to-typespec/src/transforms/transform-object.ts index a02e59a3c7..7ca9e56209 100644 --- a/packages/extensions/openapi-to-typespec/src/transforms/transform-object.ts +++ b/packages/extensions/openapi-to-typespec/src/transforms/transform-object.ts @@ -34,6 +34,7 @@ import { isStringSchema, } from "../utils/schemas"; import { getDefaultValue, transformValue } from "../utils/values"; +import { getSuppressionsForRecordProperty } from "../utils/suppressions"; const typespecTypes = new Map([ [SchemaType.Date, "plainDate"], @@ -85,14 +86,15 @@ export function transformObject(schema: ObjectSchema, codeModel: CodeModel): Typ discriminatorProperty && properties.push(discriminatorProperty); } + const [extendedParents, spreadParents] = getExtendedAndSpreadParents(schema, codeModel); const updatedVisited: TypespecObject = { name, doc, kind: "object", properties, parents: getParents(schema), - extendedParents: getExtendedParents(schema), - spreadParents: getSpreadParents(schema, codeModel), + extendedParents, + spreadParents, decorators: getModelDecorators(schema), clientDecorators: getModelClientDecorators(schema), }; @@ -153,6 +155,7 @@ export function transformObjectProperty(propertySchema: Property, codeModel: Cod clientDecorators: getPropertyClientDecorators(propertySchema), fixMe: getFixme(propertySchema, codeModel), defaultValue: getDefaultValue(type, propertySchema.schema), + suppressions: isDictionarySchema(propertySchema.schema) ? getSuppressionsForRecordProperty() : undefined, }; } @@ -173,37 +176,48 @@ function getParents(schema: ObjectSchema): string[] { .map((p) => p.language.default.name); } -function getExtendedParents(schema: ObjectSchema): string[] { +function getExtendedAndSpreadParents( + schema: ObjectSchema, + codeModel: CodeModel, +): [extendedParents: string[], spreadParents: string[]] { + // If there is a discriminative parent: extendedParents = [this discriminative parent], spreadParents = [all the other parents] + // Else if only one parent which is not dictionary: extendedParents = [this parent], spreadParents = [] + // Else if only one parent which is dictionary: extendedParents = [], spreadParents = [Record] + // Else: extendedParents = [], spreadParents = [all the parents] const immediateParents = schema.parents?.immediate ?? []; - return immediateParents - .filter((p) => p.language.default.name !== schema.language.default.name) - .filter((p) => getOwnDiscriminator(p as ObjectSchema)) - .map((p) => p.language.default.name); -} -function getSpreadParents(schema: ObjectSchema, codeModel: CodeModel): string[] { - const immediateParents = schema.parents?.immediate ?? []; - const spreadingParents = immediateParents - .filter((p) => p.language.default.name !== schema.language.default.name) - .filter((p) => !isDictionarySchema(p)) - .filter((p) => !getOwnDiscriminator(p as ObjectSchema)) - .map((p) => p.language.default.name); + const discriminativeParent = immediateParents.find((p) => getOwnDiscriminator(p as ObjectSchema)); + if (discriminativeParent) { + return [ + [discriminativeParent.language.default.name], + immediateParents + .filter((p) => p !== discriminativeParent) + .map((p) => + isDictionarySchema(p) ? `Record<${getTypespecType(p.elementType, codeModel)}>` : p.language.default.name, + ), + ]; + } - const dictionaryParent = immediateParents.find((p) => isDictionarySchema(p)) as DictionarySchema | undefined; - if (dictionaryParent) { - spreadingParents.push(`Record<${getTypespecType(dictionaryParent.elementType, codeModel)}>`); + if (immediateParents.length === 1 && !isDictionarySchema(immediateParents[0])) { + return [[immediateParents[0].language.default.name], []]; } - return spreadingParents; + + return [ + [], + immediateParents.map((p) => + isDictionarySchema(p) ? `Record<${getTypespecType(p.elementType, codeModel)}>` : p.language.default.name, + ), + ]; } function getArmIdType(schema: Schema): string { const allowedResources = schema.extensions?.["x-ms-arm-id-details"]?.["allowedResources"]; if (allowedResources) { - return `ResourceIdentifier<[${schema.extensions?.["x-ms-arm-id-details"]?.["allowedResources"] + return `Azure.Core.armResourceIdentifier<[${schema.extensions?.["x-ms-arm-id-details"]?.["allowedResources"] .map((r: { [x: string]: string }) => '{type: "' + r["type"] + '";}') .join(",")}]>`; } else { - return "ResourceIdentifier"; + return "Azure.Core.armResourceIdentifier"; } } diff --git a/packages/extensions/openapi-to-typespec/src/utils/docs.ts b/packages/extensions/openapi-to-typespec/src/utils/docs.ts index 6cca120209..9847b0488a 100644 --- a/packages/extensions/openapi-to-typespec/src/utils/docs.ts +++ b/packages/extensions/openapi-to-typespec/src/utils/docs.ts @@ -24,6 +24,15 @@ export function generateDocs({ doc }: WithDocs): string { return `/**\n* ${wrapped.join("\n* ")}\n*/`; } +export function generateDocsContent({ doc }: WithDocs): string { + if (isEmptyDoc(doc)) { + return ``; + } + + const wrapped = lineWrap(doc); + return wrapped.length === 1 ? `${wrapped[0]}` : `""\n${wrapped.join("\n")}\n""`; +} + export function generateSummary({ summary }: WithSummary): string { if (isEmptyDoc(summary)) { return ""; diff --git a/packages/extensions/openapi-to-typespec/src/utils/model-generation.ts b/packages/extensions/openapi-to-typespec/src/utils/model-generation.ts index 1554182234..b34a88a9c9 100644 --- a/packages/extensions/openapi-to-typespec/src/utils/model-generation.ts +++ b/packages/extensions/openapi-to-typespec/src/utils/model-generation.ts @@ -1,8 +1,12 @@ +import { getOptions } from "../options"; import { TypespecObjectProperty } from "../interfaces"; import { generateDecorators } from "./decorators"; import { generateDocs } from "./docs"; +import { getFullyQualifiedName } from "./type-mapping"; +import { generateSuppressions } from "./suppressions"; export function getModelPropertiesDeclarations(properties: TypespecObjectProperty[]): string[] { + const { isFullCompatible } = getOptions(); const definitions: string[] = []; for (const property of properties) { const propertyDoc = generateDocs(property); @@ -14,7 +18,12 @@ export function getModelPropertiesDeclarations(properties: TypespecObjectPropert if (property.defaultValue) { defaultValue = ` = ${property.defaultValue}`; } - definitions.push(`"${property.name}"${getOptionalOperator(property)}: ${property.type}${defaultValue};`); + if (isFullCompatible && property.suppressions) { + definitions.push(...generateSuppressions(property.suppressions)); + } + definitions.push( + `"${property.name}"${getOptionalOperator(property)}: ${getFullyQualifiedName(property.type)}${defaultValue};`, + ); } return definitions; diff --git a/packages/extensions/openapi-to-typespec/src/utils/suppressions.ts b/packages/extensions/openapi-to-typespec/src/utils/suppressions.ts new file mode 100644 index 0000000000..7be897f2d9 --- /dev/null +++ b/packages/extensions/openapi-to-typespec/src/utils/suppressions.ts @@ -0,0 +1,41 @@ +import { WithSuppressDirective } from "../interfaces"; + +export function generateSuppressions(suppressions: WithSuppressDirective[]): string[] { + const definitions: string[] = []; + for (const suppression of suppressions) { + definitions.push(`#suppress "${suppression.suppressionCode}" "${suppression.suppressionMessage}"`); + } + return definitions; +} + +export function getSuppressionsForArmResourceDeleteAsync(): WithSuppressDirective[] { + return [ + { suppressionCode: "deprecated", suppressionMessage: "For backward compatibility" }, + { + suppressionCode: "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes", + suppressionMessage: "For backward compatibility", + }, + { + suppressionCode: "@azure-tools/typespec-azure-core/no-response-body", + suppressionMessage: "For backward compatibility", + }, + ]; +} + +export function getSuppressionsForArmResourceDeleteSync(): WithSuppressDirective[] { + return [ + { + suppressionCode: "@azure-tools/typespec-azure-core/no-response-body", + suppressionMessage: "For backward compatibility", + }, + ]; +} + +export function getSuppressionsForRecordProperty(): WithSuppressDirective[] { + return [ + { + suppressionCode: "@azure-tools/typespec-azure-resource-manager/arm-no-record", + suppressionMessage: "For backward compatibility", + }, + ]; +} diff --git a/packages/extensions/openapi-to-typespec/src/utils/type-mapping.ts b/packages/extensions/openapi-to-typespec/src/utils/type-mapping.ts new file mode 100644 index 0000000000..5a062415af --- /dev/null +++ b/packages/extensions/openapi-to-typespec/src/utils/type-mapping.ts @@ -0,0 +1,8 @@ +export function getFullyQualifiedName(type: string): string { + switch (type) { + case "ManagedServiceIdentity": + return "Azure.ResourceManager.Foundations.ManagedServiceIdentity"; + default: + return type; + } +} diff --git a/packages/extensions/openapi-to-typespec/test/analyzeText/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/analyzeText/tsp-output/models.tsp index 7f2f358e74..e4558701f6 100644 --- a/packages/extensions/openapi-to-typespec/test/analyzeText/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/analyzeText/tsp-output/models.tsp @@ -202,7 +202,9 @@ model ErrorResponse { /** * The error object. */ -model Error extends Record { +model Error { + ...Record; + /** * One of a server-defined set of error codes. */ diff --git a/packages/extensions/openapi-to-typespec/test/anomalyDetector/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/anomalyDetector/swagger-output/swagger.json index 10903bcfe5..cd545d910c 100644 --- a/packages/extensions/openapi-to-typespec/test/anomalyDetector/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/anomalyDetector/swagger-output/swagger.json @@ -609,17 +609,6 @@ "score" ] }, - "ApiVersion": { - "type": "string", - "description": "Anomaly Detector API version (for example, v1.0).", - "enum": [ - "v1.1-preview.1" - ], - "x-ms-enum": { - "name": "ApiVersion", - "modelAsString": true - } - }, "Azure.Core.Foundations.Error": { "type": "object", "description": "The error object.", @@ -1526,24 +1515,6 @@ "timestamps", "values" ] - }, - "Versions": { - "type": "string", - "description": "The available API versions.", - "enum": [ - "v1.1-preview.1" - ], - "x-ms-enum": { - "name": "Versions", - "modelAsString": true, - "values": [ - { - "name": "v1_1_preview_1", - "value": "v1.1-preview.1", - "description": "The v1.1-preview.1 API version." - } - ] - } } }, "parameters": { diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-agrifood/swagger-output/swagger.json index a416a765d8..92726ea1dc 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/swagger-output/swagger.json @@ -678,14 +678,14 @@ "202": { "description": "Resource update request accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1500,14 +1500,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -3046,12 +3046,7 @@ "offerId", "termId" ], - "allOf": [ - { - "type": "object", - "additionalProperties": {} - } - ] + "additionalProperties": {} }, "UnitSystemsInfo": { "type": "object", diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataConnector.tsp b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataConnector.tsp index a70cdc0a50..b1214748d1 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataConnector.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataConnector.tsp @@ -20,17 +20,13 @@ namespace Azure.ResourceManager.AgFoodPlatform; @parentResource(DataManagerForAgriculture) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(DataConnectorProperties) -model DataConnector extends ProxyResourceBase { - /** - * Connector name. - */ - @maxLength(63) - @minLength(1) - @path - @key("dataConnectorName") - @segment("dataConnectors") - @visibility("read") - name: string; +model DataConnector extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = DataConnector, + KeyName = "dataConnectorName", + SegmentName = "dataConnectors", + NamePattern = "" + >; /** * DataConnector Properties. @@ -38,7 +34,7 @@ model DataConnector extends ProxyResourceBase { @extension("x-ms-client-flatten", true) properties: DataConnectorProperties; - ...Azure.ResourceManager.EntityTag; + ...Azure.ResourceManager.EntityTagProperty; } @armResourceOperations @@ -56,6 +52,7 @@ interface DataConnectors { /** * Delete a Data Connectors with given dataConnector name. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -86,6 +83,10 @@ interface DataConnectors { >; } +@@maxLength(DataConnector.name, 63); +@@minLength(DataConnector.name, 1); +@@path(DataConnector.name); +@@doc(DataConnector.name, "Connector name."); @@encodedName(DataConnectors.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataManagerForAgriculture.tsp b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataManagerForAgriculture.tsp index 11605b34a4..31f1192142 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataManagerForAgriculture.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataManagerForAgriculture.tsp @@ -20,18 +20,13 @@ namespace Azure.ResourceManager.AgFoodPlatform; @Azure.ResourceManager.Private.armResourceInternal( DataManagerForAgricultureProperties ) -model DataManagerForAgriculture extends TrackedResourceBase { - /** - * DataManagerForAgriculture resource name. - */ - @maxLength(63) - @minLength(1) - @pattern("^[A-Za-z0-9]+(-[A-Za-z0-9]+)*$") - @path - @key("dataManagerForAgricultureResourceName") - @segment("farmBeats") - @visibility("read") - name: string; +model DataManagerForAgriculture extends Foundations.TrackedResource { + ...ResourceNameParameter< + Resource = DataManagerForAgriculture, + KeyName = "dataManagerForAgricultureResourceName", + SegmentName = "farmBeats", + NamePattern = "^[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + >; /** * Data Manager For Agriculture ARM Resource properties. @@ -39,7 +34,7 @@ model DataManagerForAgriculture extends TrackedResourceBase { @extension("x-ms-client-flatten", true) properties?: DataManagerForAgricultureProperties; - ...Azure.ResourceManager.ManagedServiceIdentity; + ...Azure.ResourceManager.ManagedServiceIdentityProperty; } @armResourceOperations @@ -62,7 +57,7 @@ interface DataManagerForAgricultures { * Update a Data Manager For Agriculture resource. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("DataManagerForAgricultureResources_Update") update is ArmCustomPatchAsync< DataManagerForAgriculture, @@ -73,6 +68,7 @@ interface DataManagerForAgricultures { * Delete a Data Manager For Agriculture resource. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("DataManagerForAgricultureResources_Delete") delete is ArmResourceDeleteSync; @@ -111,6 +107,12 @@ interface DataManagerForAgricultures { listBySubscription is ArmListBySubscription; } +@@maxLength(DataManagerForAgriculture.name, 63); +@@minLength(DataManagerForAgriculture.name, 1); +@@path(DataManagerForAgriculture.name); +@@doc(DataManagerForAgriculture.name, + "DataManagerForAgriculture resource name." +); @@encodedName(DataManagerForAgricultures.createOrUpdate::parameters.resource, "application/json", "request" diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataManagerForAgricultureExtension.tsp b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataManagerForAgricultureExtension.tsp index 7fb2371d20..e9ee4f733b 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataManagerForAgricultureExtension.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataManagerForAgricultureExtension.tsp @@ -21,16 +21,13 @@ namespace Azure.ResourceManager.AgFoodPlatform; @Azure.ResourceManager.Private.armResourceInternal( DataManagerForAgricultureExtensionProperties ) -model DataManagerForAgricultureExtension extends ProxyResourceBase { - /** - * dataManagerForAgricultureExtensionId to be queried. - */ - @pattern("^[a-zA-Z]{3,50}[.][a-zA-Z]{3,100}$") - @path - @key("dataManagerForAgricultureExtensionId") - @segment("farmBeatsExtensionDefinitions") - @visibility("read") - name: string; +model DataManagerForAgricultureExtension extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = DataManagerForAgricultureExtension, + KeyName = "dataManagerForAgricultureExtensionId", + SegmentName = "farmBeatsExtensionDefinitions", + NamePattern = "^[a-zA-Z]{3,50}[.][a-zA-Z]{3,100}$" + >; /** * DataManagerForAgricultureExtension properties. @@ -103,3 +100,8 @@ interface DataManagerForAgricultureExtensions { } >; } + +@@path(DataManagerForAgricultureExtension.name); +@@doc(DataManagerForAgricultureExtension.name, + "dataManagerForAgricultureExtensionId to be queried." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataManagerForAgricultureSolution.tsp b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataManagerForAgricultureSolution.tsp index f4198451d1..960f9f6626 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataManagerForAgricultureSolution.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/DataManagerForAgricultureSolution.tsp @@ -21,16 +21,13 @@ namespace Azure.ResourceManager.AgFoodPlatform; @Azure.ResourceManager.Private.armResourceInternal( DataManagerForAgricultureSolutionProperties ) -model DataManagerForAgricultureSolution extends ProxyResourceBase { - /** - * dataManagerForAgricultureSolutionId to be queried. - */ - @pattern("^[a-zA-Z]{3,50}[.][a-zA-Z]{3,100}$") - @path - @key("dataManagerForAgricultureSolutionId") - @segment("farmBeatsSolutionDefinitions") - @visibility("read") - name: string; +model DataManagerForAgricultureSolution extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = DataManagerForAgricultureSolution, + KeyName = "dataManagerForAgricultureSolutionId", + SegmentName = "farmBeatsSolutionDefinitions", + NamePattern = "^[a-zA-Z]{3,50}[.][a-zA-Z]{3,100}$" + >; /** * DataManagerForAgricultureSolution properties. @@ -87,3 +84,8 @@ interface DataManagerForAgricultureSolutions { } >; } + +@@path(DataManagerForAgricultureSolution.name); +@@doc(DataManagerForAgricultureSolution.name, + "dataManagerForAgricultureSolutionId to be queried." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/Extension.tsp b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/Extension.tsp index 25b785ac1d..d417d71c41 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/Extension.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/Extension.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.AgFoodPlatform; @parentResource(DataManagerForAgriculture) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(ExtensionProperties) -model Extension extends ProxyResourceBase { - /** - * Id of extension resource. - */ - @path - @key("extensionId") - @segment("extensions") - @visibility("read") - name: string; +model Extension extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = Extension, + KeyName = "extensionId", + SegmentName = "extensions", + NamePattern = "" + >; /** * Extension resource properties. @@ -36,7 +34,7 @@ model Extension extends ProxyResourceBase { @extension("x-ms-client-flatten", true) properties?: ExtensionProperties; - ...Azure.ResourceManager.EntityTag; + ...Azure.ResourceManager.EntityTagProperty; } @armResourceOperations @@ -54,6 +52,7 @@ interface Extensions { /** * Uninstall extension. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -102,6 +101,8 @@ interface Extensions { >; } +@@path(Extension.name); +@@doc(Extension.name, "Id of extension resource."); @@encodedName(Extensions.createOrUpdate::parameters.resource, "application/json", "requestBody" diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/PrivateEndpointConnection.tsp b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/PrivateEndpointConnection.tsp index 4362df2db9..b3855076ff 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/PrivateEndpointConnection.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/PrivateEndpointConnection.tsp @@ -22,15 +22,13 @@ namespace Azure.ResourceManager.AgFoodPlatform; @Azure.ResourceManager.Private.armResourceInternal( PrivateEndpointConnectionProperties ) -model PrivateEndpointConnection extends ProxyResourceBase { - /** - * Private endpoint connection name. - */ - @path - @key("privateEndpointConnectionName") - @segment("privateEndpointConnections") - @visibility("read") - name: string; +model PrivateEndpointConnection extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = PrivateEndpointConnection, + KeyName = "privateEndpointConnectionName", + SegmentName = "privateEndpointConnections", + NamePattern = "" + >; /** * Resource properties. @@ -54,6 +52,9 @@ interface PrivateEndpointConnections { /** * Delete Private endpoint connection request. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -64,6 +65,8 @@ interface PrivateEndpointConnections { listByResource is ArmResourceListByParent; } +@@path(PrivateEndpointConnection.name); +@@doc(PrivateEndpointConnection.name, "Private endpoint connection name."); @@encodedName(PrivateEndpointConnections.createOrUpdate::parameters.resource, "application/json", "request" diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/PrivateLinkResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/PrivateLinkResource.tsp index 0960a3f712..64e0686eec 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/PrivateLinkResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/PrivateLinkResource.tsp @@ -22,15 +22,13 @@ namespace Azure.ResourceManager.AgFoodPlatform; @Azure.ResourceManager.Private.armResourceInternal( PrivateLinkResourceProperties ) -model PrivateLinkResource extends ProxyResourceBase { - /** - * Sub resource name. - */ - @path - @key("subResourceName") - @segment("privateLinkResources") - @visibility("read") - name: string; +model PrivateLinkResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = PrivateLinkResource, + KeyName = "subResourceName", + SegmentName = "privateLinkResources", + NamePattern = "" + >; /** * Resource properties. @@ -53,3 +51,6 @@ interface PrivateLinkResources { @operationId("PrivateLinkResources_ListByResource") listByResource is ArmResourceListByParent; } + +@@path(PrivateLinkResource.name); +@@doc(PrivateLinkResource.name, "Sub resource name."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/Solution.tsp b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/Solution.tsp index 047461bc7f..777f4f2ef4 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/Solution.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/Solution.tsp @@ -20,16 +20,13 @@ namespace Azure.ResourceManager.AgFoodPlatform; @parentResource(DataManagerForAgriculture) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(SolutionProperties) -model Solution extends ProxyResourceBase { - /** - * SolutionId for Data Manager For Agriculture Resource. - */ - @pattern("^[a-zA-Z]{3,50}[.][a-zA-Z]{3,100}$") - @path - @key("solutionId") - @segment("solutions") - @visibility("read") - name: string; +model Solution extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = Solution, + KeyName = "solutionId", + SegmentName = "solutions", + NamePattern = "^[a-zA-Z]{3,50}[.][a-zA-Z]{3,100}$" + >; /** * Solution resource properties. @@ -37,7 +34,7 @@ model Solution extends ProxyResourceBase { @extension("x-ms-client-flatten", true) properties?: SolutionProperties; - ...Azure.ResourceManager.EntityTag; + ...Azure.ResourceManager.EntityTagProperty; } @armResourceOperations @@ -55,6 +52,7 @@ interface Solutions { /** * Uninstall Solution. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -155,6 +153,8 @@ interface Solutions { >; } +@@path(Solution.name); +@@doc(Solution.name, "SolutionId for Data Manager For Agriculture Resource."); @@encodedName(Solutions.createOrUpdate::parameters.resource, "application/json", "requestBody" diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/models.tsp index 43b587ee75..cbe0fd4fd1 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/models.tsp @@ -117,7 +117,7 @@ model Resource { * Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" */ @visibility("read") - id?: ResourceIdentifier; + id?: Azure.Core.armResourceIdentifier; /** * The name of the resource @@ -438,6 +438,7 @@ model DataManagerForAgricultureUpdateRequestModel { /** * Resource tags. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -503,6 +504,7 @@ model ExtensionInstallationRequest { /** * Additional Api Properties. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" additionalApiProperties?: Record; } @@ -556,6 +558,7 @@ model ExtensionProperties { /** * Additional Api Properties. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read") additionalApiProperties?: Record; } @@ -585,7 +588,9 @@ model PrivateLinkResourceProperties { /** * Solution resource properties. */ -model SolutionProperties extends Record { +model SolutionProperties { + ...Record; + /** * Partner Id of the Solution. */ @@ -662,6 +667,7 @@ model DataManagerForAgricultureSolutionProperties { /** * Gets api-version Swagger Document Dictionary to capture all api-versions of swagger exposed by partner to Data Manager For Agriculture. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read") openApiSpecsDictionary?: Record; diff --git a/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/Alert.tsp b/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/Alert.tsp index 2c21ec30b0..cd5868bda8 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/Alert.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/Alert.tsp @@ -19,15 +19,13 @@ namespace Azure.ResourceManager.AlertsManagement; @subscriptionResource @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(AlertProperties) -model Alert extends ProxyResourceBase { - /** - * Unique ID of an alert instance. - */ - @path - @key("alertId") - @segment("alerts") - @visibility("read") - name: string; +model Alert extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = Alert, + KeyName = "alertId", + SegmentName = "alerts", + NamePattern = "" + >; /** * Alert property bag @@ -193,6 +191,8 @@ interface Alerts { ): ArmResponse | ErrorResponse; } +@@path(Alert.name); +@@doc(Alert.name, "Unique ID of an alert instance."); @@encodedName(Alerts.changeState::parameters.body, "application/json", "comment" diff --git a/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/AlertProcessingRule.tsp b/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/AlertProcessingRule.tsp index cc4a930fc3..4fd7b6410b 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/AlertProcessingRule.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/AlertProcessingRule.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.AlertsManagement; @Azure.ResourceManager.Private.armResourceInternal( AlertProcessingRuleProperties ) -model AlertProcessingRule extends TrackedResourceBase { - /** - * The name of the alert processing rule that needs to be fetched. - */ - @path - @key("alertProcessingRuleName") - @segment("actionRules") - @visibility("read") - name: string; +model AlertProcessingRule extends Foundations.TrackedResource { + ...ResourceNameParameter< + Resource = AlertProcessingRule, + KeyName = "alertProcessingRuleName", + SegmentName = "actionRules", + NamePattern = "" + >; /** * Alert processing rule properties. @@ -52,12 +50,13 @@ interface AlertProcessingRules { /** * Enable, disable, or update tags for an alert processing rule. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** * Delete an alert processing rule. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -73,6 +72,10 @@ interface AlertProcessingRules { listBySubscription is ArmListBySubscription; } +@@path(AlertProcessingRule.name); +@@doc(AlertProcessingRule.name, + "The name of the alert processing rule that needs to be fetched." +); @@encodedName(AlertProcessingRules.createOrUpdate::parameters.resource, "application/json", "alertProcessingRule" diff --git a/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/SmartGroup.tsp b/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/SmartGroup.tsp index 399a6fb84a..85bacc544f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/SmartGroup.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/SmartGroup.tsp @@ -19,15 +19,13 @@ namespace Azure.ResourceManager.AlertsManagement; @subscriptionResource @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(SmartGroupProperties) -model SmartGroup extends ProxyResourceBase { - /** - * Smart group unique id. - */ - @path - @key("smartGroupId") - @segment("smartGroups") - @visibility("read") - name: string; +model SmartGroup extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = SmartGroup, + KeyName = "smartGroupId", + SegmentName = "smartGroups", + NamePattern = "" + >; /** * Properties of smart group. @@ -156,3 +154,6 @@ interface SmartGroups { smartGroupId: string, ): ArmResponse | ErrorResponse; } + +@@path(SmartGroup.name); +@@doc(SmartGroup.name, "Smart group unique id. "); diff --git a/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/models.tsp index 7ea8f71dd1..6b061d75a3 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/models.tsp @@ -315,6 +315,7 @@ model ManagedResource extends Resource { /** * Resource tags */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -389,6 +390,7 @@ model PatchObject { /** * Tags to be updated. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } diff --git a/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/AnalysisServicesServer.tsp b/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/AnalysisServicesServer.tsp index 462854f91a..7d65ebe091 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/AnalysisServicesServer.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/AnalysisServicesServer.tsp @@ -18,17 +18,12 @@ namespace Azure.ResourceManager.Analysis; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model AnalysisServicesServer extends Resource { - /** - * The name of the Analysis Services server. It must be a minimum of 3 characters, and a maximum of 63. - */ - @maxLength(63) - @minLength(3) - @pattern("^[a-z][a-z0-9]*$") - @path - @key("serverName") - @segment("servers") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = AnalysisServicesServer, + KeyName = "serverName", + SegmentName = "servers", + NamePattern = "^[a-z][a-z0-9]*$" + >; /** * Properties of the provision operation request. @@ -57,7 +52,7 @@ interface AnalysisServicesServers { * Updates the current state of the specified Analysis Services server. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Servers_Update") update is ArmCustomPatchAsync< AnalysisServicesServer, @@ -68,6 +63,9 @@ interface AnalysisServicesServers { * Deletes the specified Analysis Services server. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Servers_Delete") delete is ArmResourceDeleteAsync; @@ -163,6 +161,12 @@ interface AnalysisServicesServers { ): ArmResponse | ErrorResponse; } +@@maxLength(AnalysisServicesServer.name, 63); +@@minLength(AnalysisServicesServer.name, 3); +@@path(AnalysisServicesServer.name); +@@doc(AnalysisServicesServer.name, + "The name of the Analysis Services server. It must be a minimum of 3 characters, and a maximum of 63." +); @@encodedName(AnalysisServicesServers.create::parameters.resource, "application/json", "serverParameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/models.tsp index f2ffa6e138..8a277222af 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/models.tsp @@ -279,6 +279,7 @@ model Resource { /** * Key-value pairs of additional resource provisioning properties. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -294,6 +295,7 @@ model AnalysisServicesServerUpdateParameters { /** * Key-value pairs of additional provisioning properties. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; /** diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/AccessInformationContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/AccessInformationContract.tsp index 251cc83a38..3dac13b801 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/AccessInformationContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/AccessInformationContract.tsp @@ -22,7 +22,7 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( AccessInformationContractProperties ) -model AccessInformationContract extends ProxyResourceBase { +model AccessInformationContract extends Foundations.ProxyResource { /** * The identifier of the Access configuration. */ @@ -83,7 +83,7 @@ interface AccessInformationContracts { * Update tenant access information details. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("TenantAccess_Update") update is ArmCustomPatchSync< AccessInformationContract, diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiContract.tsp index dd0052e2ea..ccd7ca2b30 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiContract.tsp @@ -20,18 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiManagementServiceResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(ApiContractProperties) -model ApiContract extends ProxyResourceBase { - /** - * API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. - */ - @maxLength(256) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("apiId") - @segment("apis") - @visibility("read") - name: string; +model ApiContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = ApiContract, + KeyName = "apiId", + SegmentName = "apis", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * API entity contract properties. @@ -81,7 +76,7 @@ interface ApiContracts { * Updates the specified API of the API Management service instance. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Api_Update") update is ArmCustomPatchSync< ApiContract, @@ -101,6 +96,7 @@ interface ApiContracts { * Deletes the specified API of the API Management service instance. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Api_Delete") delete is ArmResourceDeleteSync< ApiContract, @@ -325,6 +321,12 @@ interface ApiContracts { ): ArmResponse | ErrorResponse; } +@@maxLength(ApiContract.name, 256); +@@minLength(ApiContract.name, 1); +@@path(ApiContract.name); +@@doc(ApiContract.name, + "API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number." +); @@encodedName(ApiContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiManagementServiceResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiManagementServiceResource.tsp index 7aeea30950..c3352ebf44 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiManagementServiceResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiManagementServiceResource.tsp @@ -20,18 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( ApiManagementServiceProperties ) -model ApiManagementServiceResource extends TrackedResourceBase { - /** - * The name of the API Management service. - */ - @maxLength(50) - @minLength(1) - @pattern("^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$") - @path - @key("serviceName") - @segment("service") - @visibility("read") - name: string; +model ApiManagementServiceResource extends Foundations.TrackedResource { + ...ResourceNameParameter< + Resource = ApiManagementServiceResource, + KeyName = "serviceName", + SegmentName = "service", + NamePattern = "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$" + >; /** * ETag of the resource. @@ -50,8 +45,8 @@ model ApiManagementServiceResource extends TrackedResourceBase { @extension("x-ms-client-flatten", true) properties: ApiManagementServiceProperties; - ...Azure.ResourceManager.ManagedServiceIdentity; - ...Azure.ResourceManager.ResourceSku; + ...Azure.ResourceManager.ManagedServiceIdentityProperty; + ...Azure.ResourceManager.ResourceSkuProperty; } @armResourceOperations @@ -74,7 +69,7 @@ interface ApiManagementServiceResources { * Updates an existing API Management service. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("ApiManagementService_Update") update is ArmCustomPatchAsync< ApiManagementServiceResource, @@ -85,6 +80,9 @@ interface ApiManagementServiceResources { * Deletes an existing API Management service. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("ApiManagementService_Delete") delete is ArmResourceDeleteAsync; @@ -1154,6 +1152,12 @@ interface ApiManagementServiceResources { ): ArmResponse | ErrorResponse; } +@@maxLength(ApiManagementServiceResource.name, 50); +@@minLength(ApiManagementServiceResource.name, 1); +@@path(ApiManagementServiceResource.name); +@@doc(ApiManagementServiceResource.name, + "The name of the API Management service." +); @@encodedName(ApiManagementServiceResources.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiReleaseContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiReleaseContract.tsp index 9e28f034d4..acef785be7 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiReleaseContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiReleaseContract.tsp @@ -20,18 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiContract) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(ApiReleaseContractProperties) -model ApiReleaseContract extends ProxyResourceBase { - /** - * Release identifier within an API. Must be unique in the current API Management service instance. - */ - @maxLength(80) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("releaseId") - @segment("releases") - @visibility("read") - name: string; +model ApiReleaseContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = ApiReleaseContract, + KeyName = "releaseId", + SegmentName = "releases", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * ApiRelease entity contract properties. @@ -84,7 +79,7 @@ interface ApiReleaseContracts { * Updates the details of the release of the API specified by its identifier. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("ApiRelease_Update") update is ArmCustomPatchSync< ApiReleaseContract, @@ -104,6 +99,7 @@ interface ApiReleaseContracts { * Deletes the specified release in the API. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("ApiRelease_Delete") delete is ArmResourceDeleteSync< ApiReleaseContract, @@ -150,6 +146,12 @@ interface ApiReleaseContracts { >; } +@@maxLength(ApiReleaseContract.name, 80); +@@minLength(ApiReleaseContract.name, 1); +@@path(ApiReleaseContract.name); +@@doc(ApiReleaseContract.name, + "Release identifier within an API. Must be unique in the current API Management service instance." +); @@encodedName(ApiReleaseContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiVersionSetContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiVersionSetContract.tsp index 304113e1e3..baba089583 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiVersionSetContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiVersionSetContract.tsp @@ -22,18 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( ApiVersionSetContractProperties ) -model ApiVersionSetContract extends ProxyResourceBase { - /** - * Api Version Set identifier. Must be unique in the current API Management service instance. - */ - @maxLength(80) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("versionSetId") - @segment("apiVersionSets") - @visibility("read") - name: string; +model ApiVersionSetContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = ApiVersionSetContract, + KeyName = "versionSetId", + SegmentName = "apiVersionSets", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * API VersionSet contract properties. @@ -86,7 +81,7 @@ interface ApiVersionSetContracts { * Updates the details of the Api VersionSet specified by its identifier. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("ApiVersionSet_Update") update is ArmCustomPatchSync< ApiVersionSetContract, @@ -106,6 +101,7 @@ interface ApiVersionSetContracts { * Deletes specific Api Version Set. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("ApiVersionSet_Delete") delete is ArmResourceDeleteSync< ApiVersionSetContract, @@ -152,6 +148,12 @@ interface ApiVersionSetContracts { >; } +@@maxLength(ApiVersionSetContract.name, 80); +@@minLength(ApiVersionSetContract.name, 1); +@@path(ApiVersionSetContract.name); +@@doc(ApiVersionSetContract.name, + "Api Version Set identifier. Must be unique in the current API Management service instance." +); @@encodedName(ApiVersionSetContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/AuthorizationServerContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/AuthorizationServerContract.tsp index 06ead68a81..854ca1d8cb 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/AuthorizationServerContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/AuthorizationServerContract.tsp @@ -22,18 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( AuthorizationServerContractProperties ) -model AuthorizationServerContract extends ProxyResourceBase { - /** - * Identifier of the authorization server. - */ - @maxLength(80) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("authsid") - @segment("authorizationServers") - @visibility("read") - name: string; +model AuthorizationServerContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = AuthorizationServerContract, + KeyName = "authsid", + SegmentName = "authorizationServers", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * Properties of the External OAuth authorization server Contract. @@ -86,7 +81,7 @@ interface AuthorizationServerContracts { * Updates the details of the authorization server specified by its identifier. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("AuthorizationServer_Update") update is ArmCustomPatchSync< AuthorizationServerContract, @@ -106,6 +101,7 @@ interface AuthorizationServerContracts { * Deletes specific authorization server instance. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("AuthorizationServer_Delete") delete is ArmResourceDeleteSync< AuthorizationServerContract, @@ -163,6 +159,12 @@ interface AuthorizationServerContracts { >; } +@@maxLength(AuthorizationServerContract.name, 80); +@@minLength(AuthorizationServerContract.name, 1); +@@path(AuthorizationServerContract.name); +@@doc(AuthorizationServerContract.name, + "Identifier of the authorization server." +); @@encodedName(AuthorizationServerContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/BackendContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/BackendContract.tsp index 2278cc7eeb..dc8749e0d8 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/BackendContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/BackendContract.tsp @@ -20,17 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiManagementServiceResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(BackendContractProperties) -model BackendContract extends ProxyResourceBase { - /** - * Identifier of the Backend entity. Must be unique in the current API Management service instance. - */ - @maxLength(80) - @minLength(1) - @path - @key("backendId") - @segment("backends") - @visibility("read") - name: string; +model BackendContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = BackendContract, + KeyName = "backendId", + SegmentName = "backends", + NamePattern = "" + >; /** * Backend entity contract properties. @@ -83,7 +79,7 @@ interface BackendContracts { * Updates an existing backend. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Backend_Update") update is ArmCustomPatchSync< BackendContract, @@ -103,6 +99,7 @@ interface BackendContracts { * Deletes the specified backend. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Backend_Delete") delete is ArmResourceDeleteSync< BackendContract, @@ -159,6 +156,12 @@ interface BackendContracts { >; } +@@maxLength(BackendContract.name, 80); +@@minLength(BackendContract.name, 1); +@@path(BackendContract.name); +@@doc(BackendContract.name, + "Identifier of the Backend entity. Must be unique in the current API Management service instance." +); @@encodedName(BackendContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/CacheContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/CacheContract.tsp index cd2c5b484a..59728bded2 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/CacheContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/CacheContract.tsp @@ -20,18 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiManagementServiceResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(CacheContractProperties) -model CacheContract extends ProxyResourceBase { - /** - * Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). - */ - @maxLength(80) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("cacheId") - @segment("caches") - @visibility("read") - name: string; +model CacheContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = CacheContract, + KeyName = "cacheId", + SegmentName = "caches", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * Cache properties details. @@ -81,7 +76,7 @@ interface CacheContracts { * Updates the details of the cache specified by its identifier. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Cache_Update") update is ArmCustomPatchSync< CacheContract, @@ -101,6 +96,7 @@ interface CacheContracts { * Deletes specific Cache. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Cache_Delete") delete is ArmResourceDeleteSync< CacheContract, @@ -141,6 +137,12 @@ interface CacheContracts { >; } +@@maxLength(CacheContract.name, 80); +@@minLength(CacheContract.name, 1); +@@path(CacheContract.name); +@@doc(CacheContract.name, + "Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier)." +); @@encodedName(CacheContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/CertificateContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/CertificateContract.tsp index c9282fe490..e2ed164280 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/CertificateContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/CertificateContract.tsp @@ -22,18 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( CertificateContractProperties ) -model CertificateContract extends ProxyResourceBase { - /** - * Identifier of the certificate entity. Must be unique in the current API Management service instance. - */ - @maxLength(80) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("certificateId") - @segment("certificates") - @visibility("read") - name: string; +model CertificateContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = CertificateContract, + KeyName = "certificateId", + SegmentName = "certificates", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * Certificate properties details. @@ -86,6 +81,7 @@ interface CertificateContracts { * Deletes specific certificate. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Certificate_Delete") delete is ArmResourceDeleteSync< CertificateContract, @@ -149,6 +145,12 @@ interface CertificateContracts { >; } +@@maxLength(CertificateContract.name, 80); +@@minLength(CertificateContract.name, 1); +@@path(CertificateContract.name); +@@doc(CertificateContract.name, + "Identifier of the certificate entity. Must be unique in the current API Management service instance." +); @@encodedName(CertificateContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/DeletedServiceContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/DeletedServiceContract.tsp index 643c8bf29b..27d7b0988d 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/DeletedServiceContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/DeletedServiceContract.tsp @@ -22,18 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( DeletedServiceContractProperties ) -model DeletedServiceContract extends ProxyResourceBase { - /** - * The name of the API Management service. - */ - @maxLength(50) - @minLength(1) - @pattern("^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$") - @path - @key("serviceName") - @segment("deletedservices") - @visibility("read") - name: string; +model DeletedServiceContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = DeletedServiceContract, + KeyName = "serviceName", + SegmentName = "deletedservices", + NamePattern = "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$" + >; /** * Deleted API Management Service details. @@ -55,6 +50,9 @@ interface DeletedServiceContracts { * Purges Api Management Service (deletes it with no option to undelete). */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("DeletedServices_Purge") purge is ArmResourceDeleteAsync; @@ -65,3 +63,8 @@ interface DeletedServiceContracts { @operationId("DeletedServices_ListBySubscription") listBySubscription is ArmListBySubscription; } + +@@maxLength(DeletedServiceContract.name, 50); +@@minLength(DeletedServiceContract.name, 1); +@@path(DeletedServiceContract.name); +@@doc(DeletedServiceContract.name, "The name of the API Management service."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/DiagnosticContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/DiagnosticContract.tsp index 8027967888..0f4f980188 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/DiagnosticContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/DiagnosticContract.tsp @@ -20,18 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiContract) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(DiagnosticContractProperties) -model DiagnosticContract extends ProxyResourceBase { - /** - * Diagnostic identifier. Must be unique in the current API Management service instance. - */ - @maxLength(80) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("diagnosticId") - @segment("diagnostics") - @visibility("read") - name: string; +model DiagnosticContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = DiagnosticContract, + KeyName = "diagnosticId", + SegmentName = "diagnostics", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * Diagnostic entity contract properties. @@ -84,7 +79,7 @@ interface DiagnosticContracts { * Updates the details of the Diagnostic for an API specified by its identifier. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("ApiDiagnostic_Update") update is ArmCustomPatchSync< DiagnosticContract, @@ -104,6 +99,7 @@ interface DiagnosticContracts { * Deletes the specified Diagnostic from an API. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("ApiDiagnostic_Delete") delete is ArmResourceDeleteSync< DiagnosticContract, @@ -150,6 +146,12 @@ interface DiagnosticContracts { >; } +@@maxLength(DiagnosticContract.name, 80); +@@minLength(DiagnosticContract.name, 1); +@@path(DiagnosticContract.name); +@@doc(DiagnosticContract.name, + "Diagnostic identifier. Must be unique in the current API Management service instance." +); @@encodedName(DiagnosticContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/EmailTemplateContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/EmailTemplateContract.tsp index 29dbd9b454..c9211e1edb 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/EmailTemplateContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/EmailTemplateContract.tsp @@ -22,7 +22,7 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( EmailTemplateContractProperties ) -model EmailTemplateContract extends ProxyResourceBase { +model EmailTemplateContract extends Foundations.ProxyResource { /** * Email Template Name Identifier. */ @@ -83,7 +83,7 @@ interface EmailTemplateContracts { * Updates API Management email template */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("EmailTemplate_Update") update is ArmCustomPatchSync< EmailTemplateContract, @@ -103,6 +103,7 @@ interface EmailTemplateContracts { * Reset the Email Template to default template provided by the API Management service instance. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("EmailTemplate_Delete") delete is ArmResourceDeleteSync< EmailTemplateContract, diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GatewayCertificateAuthorityContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GatewayCertificateAuthorityContract.tsp index 356e09e5c8..16c6883292 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GatewayCertificateAuthorityContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GatewayCertificateAuthorityContract.tsp @@ -22,18 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( GatewayCertificateAuthorityContractProperties ) -model GatewayCertificateAuthorityContract extends ProxyResourceBase { - /** - * Identifier of the certificate entity. Must be unique in the current API Management service instance. - */ - @maxLength(80) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("certificateId") - @segment("certificateAuthorities") - @visibility("read") - name: string; +model GatewayCertificateAuthorityContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = GatewayCertificateAuthorityContract, + KeyName = "certificateId", + SegmentName = "certificateAuthorities", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * Gateway certificate authority details. @@ -86,6 +81,7 @@ interface GatewayCertificateAuthorityContracts { * Remove relationship between Certificate Authority and Gateway entity. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("GatewayCertificateAuthority_Delete") delete is ArmResourceDeleteSync< GatewayCertificateAuthorityContract, @@ -132,6 +128,12 @@ interface GatewayCertificateAuthorityContracts { >; } +@@maxLength(GatewayCertificateAuthorityContract.name, 80); +@@minLength(GatewayCertificateAuthorityContract.name, 1); +@@path(GatewayCertificateAuthorityContract.name); +@@doc(GatewayCertificateAuthorityContract.name, + "Identifier of the certificate entity. Must be unique in the current API Management service instance." +); @@encodedName(GatewayCertificateAuthorityContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GatewayContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GatewayContract.tsp index 5f2499f8a6..10c76da00f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GatewayContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GatewayContract.tsp @@ -20,17 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiManagementServiceResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(GatewayContractProperties) -model GatewayContract extends ProxyResourceBase { - /** - * Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed' - */ - @maxLength(80) - @minLength(1) - @path - @key("gatewayId") - @segment("gateways") - @visibility("read") - name: string; +model GatewayContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = GatewayContract, + KeyName = "gatewayId", + SegmentName = "gateways", + NamePattern = "" + >; /** * Gateway details. @@ -83,7 +79,7 @@ interface GatewayContracts { * Updates the details of the gateway specified by its identifier. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Gateway_Update") update is ArmCustomPatchSync< GatewayContract, @@ -103,6 +99,7 @@ interface GatewayContracts { * Deletes specific Gateway. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Gateway_Delete") delete is ArmResourceDeleteSync< GatewayContract, @@ -228,6 +225,12 @@ interface GatewayContracts { ): ArmResponse | ErrorResponse; } +@@maxLength(GatewayContract.name, 80); +@@minLength(GatewayContract.name, 1); +@@path(GatewayContract.name); +@@doc(GatewayContract.name, + "Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'" +); @@encodedName(GatewayContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GatewayHostnameConfigurationContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GatewayHostnameConfigurationContract.tsp index daa553bf4e..130c7a8263 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GatewayHostnameConfigurationContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GatewayHostnameConfigurationContract.tsp @@ -22,17 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( GatewayHostnameConfigurationContractProperties ) -model GatewayHostnameConfigurationContract extends ProxyResourceBase { - /** - * Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. - */ - @maxLength(80) - @minLength(1) - @path - @key("hcId") - @segment("hostnameConfigurations") - @visibility("read") - name: string; +model GatewayHostnameConfigurationContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = GatewayHostnameConfigurationContract, + KeyName = "hcId", + SegmentName = "hostnameConfigurations", + NamePattern = "" + >; /** * Gateway hostname configuration details. @@ -85,6 +81,7 @@ interface GatewayHostnameConfigurationContracts { * Deletes the specified hostname configuration from the specified Gateway. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("GatewayHostnameConfiguration_Delete") delete is ArmResourceDeleteSync< GatewayHostnameConfigurationContract, @@ -131,6 +128,12 @@ interface GatewayHostnameConfigurationContracts { >; } +@@maxLength(GatewayHostnameConfigurationContract.name, 80); +@@minLength(GatewayHostnameConfigurationContract.name, 1); +@@path(GatewayHostnameConfigurationContract.name); +@@doc(GatewayHostnameConfigurationContract.name, + "Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity." +); @@encodedName(GatewayHostnameConfigurationContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GlobalSchemaContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GlobalSchemaContract.tsp index d137fc79e6..08f4b0cdb2 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GlobalSchemaContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GlobalSchemaContract.tsp @@ -22,17 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( GlobalSchemaContractProperties ) -model GlobalSchemaContract extends ProxyResourceBase { - /** - * Schema id identifier. Must be unique in the current API Management service instance. - */ - @maxLength(80) - @minLength(1) - @path - @key("schemaId") - @segment("schemas") - @visibility("read") - name: string; +model GlobalSchemaContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = GlobalSchemaContract, + KeyName = "schemaId", + SegmentName = "schemas", + NamePattern = "" + >; /** * Properties of the Global Schema. @@ -85,6 +81,7 @@ interface GlobalSchemaContracts { * Deletes specific Schema. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("GlobalSchema_Delete") delete is ArmResourceDeleteSync< GlobalSchemaContract, @@ -131,6 +128,12 @@ interface GlobalSchemaContracts { >; } +@@maxLength(GlobalSchemaContract.name, 80); +@@minLength(GlobalSchemaContract.name, 1); +@@path(GlobalSchemaContract.name); +@@doc(GlobalSchemaContract.name, + "Schema id identifier. Must be unique in the current API Management service instance." +); @@encodedName(GlobalSchemaContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GroupContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GroupContract.tsp index 2176bd019b..567a122fa2 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GroupContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/GroupContract.tsp @@ -20,17 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiManagementServiceResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(GroupContractProperties) -model GroupContract extends ProxyResourceBase { - /** - * Group identifier. Must be unique in the current API Management service instance. - */ - @maxLength(256) - @minLength(1) - @path - @key("groupId") - @segment("groups") - @visibility("read") - name: string; +model GroupContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = GroupContract, + KeyName = "groupId", + SegmentName = "groups", + NamePattern = "" + >; /** * Group entity contract properties. @@ -80,7 +76,7 @@ interface GroupContracts { * Updates the details of the group specified by its identifier. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Group_Update") update is ArmCustomPatchSync< GroupContract, @@ -100,6 +96,7 @@ interface GroupContracts { * Deletes specific group of the API Management service instance. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Group_Delete") delete is ArmResourceDeleteSync< GroupContract, @@ -197,6 +194,12 @@ interface GroupContracts { ): ArmResponse | ErrorResponse; } +@@maxLength(GroupContract.name, 256); +@@minLength(GroupContract.name, 1); +@@path(GroupContract.name); +@@doc(GroupContract.name, + "Group identifier. Must be unique in the current API Management service instance." +); @@encodedName(GroupContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IdentityProviderContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IdentityProviderContract.tsp index 66002fcd65..9b12c8ab0f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IdentityProviderContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IdentityProviderContract.tsp @@ -22,7 +22,7 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( IdentityProviderContractProperties ) -model IdentityProviderContract extends ProxyResourceBase { +model IdentityProviderContract extends Foundations.ProxyResource { /** * Identity Provider Type identifier. */ @@ -83,7 +83,7 @@ interface IdentityProviderContracts { * Updates an existing IdentityProvider configuration. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("IdentityProvider_Update") update is ArmCustomPatchSync< IdentityProviderContract, @@ -103,6 +103,7 @@ interface IdentityProviderContracts { * Deletes the specified identity provider configuration. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("IdentityProvider_Delete") delete is ArmResourceDeleteSync< IdentityProviderContract, diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IssueAttachmentContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IssueAttachmentContract.tsp index 3f65616092..6e5afa1128 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IssueAttachmentContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IssueAttachmentContract.tsp @@ -22,18 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( IssueAttachmentContractProperties ) -model IssueAttachmentContract extends ProxyResourceBase { - /** - * Attachment identifier within an Issue. Must be unique in the current Issue. - */ - @maxLength(256) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("attachmentId") - @segment("attachments") - @visibility("read") - name: string; +model IssueAttachmentContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = IssueAttachmentContract, + KeyName = "attachmentId", + SegmentName = "attachments", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * Properties of the Issue Attachment. @@ -86,6 +81,7 @@ interface IssueAttachmentContracts { * Deletes the specified comment from an Issue. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("ApiIssueAttachment_Delete") delete is ArmResourceDeleteSync< IssueAttachmentContract, @@ -132,6 +128,12 @@ interface IssueAttachmentContracts { >; } +@@maxLength(IssueAttachmentContract.name, 256); +@@minLength(IssueAttachmentContract.name, 1); +@@path(IssueAttachmentContract.name); +@@doc(IssueAttachmentContract.name, + "Attachment identifier within an Issue. Must be unique in the current Issue." +); @@encodedName(IssueAttachmentContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IssueCommentContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IssueCommentContract.tsp index b25aa4a469..781d18f6e1 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IssueCommentContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IssueCommentContract.tsp @@ -22,18 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( IssueCommentContractProperties ) -model IssueCommentContract extends ProxyResourceBase { - /** - * Comment identifier within an Issue. Must be unique in the current Issue. - */ - @maxLength(256) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("commentId") - @segment("comments") - @visibility("read") - name: string; +model IssueCommentContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = IssueCommentContract, + KeyName = "commentId", + SegmentName = "comments", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * Properties of the Issue Comment. @@ -86,6 +81,7 @@ interface IssueCommentContracts { * Deletes the specified comment from an Issue. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("ApiIssueComment_Delete") delete is ArmResourceDeleteSync< IssueCommentContract, @@ -132,6 +128,12 @@ interface IssueCommentContracts { >; } +@@maxLength(IssueCommentContract.name, 256); +@@minLength(IssueCommentContract.name, 1); +@@path(IssueCommentContract.name); +@@doc(IssueCommentContract.name, + "Comment identifier within an Issue. Must be unique in the current Issue." +); @@encodedName(IssueCommentContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IssueContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IssueContract.tsp index 9c7d6dc99d..f7b7a27545 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IssueContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/IssueContract.tsp @@ -20,18 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiContract) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(IssueContractProperties) -model IssueContract extends ProxyResourceBase { - /** - * Issue identifier. Must be unique in the current API Management service instance. - */ - @maxLength(256) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("issueId") - @segment("issues") - @visibility("read") - name: string; +model IssueContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = IssueContract, + KeyName = "issueId", + SegmentName = "issues", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * Properties of the Issue. @@ -92,7 +87,7 @@ interface IssueContracts { * Updates an existing issue for an API. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("ApiIssue_Update") update is ArmCustomPatchSync< IssueContract, @@ -112,6 +107,7 @@ interface IssueContracts { * Deletes the specified Issue from an API. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("ApiIssue_Delete") delete is ArmResourceDeleteSync< IssueContract, @@ -164,6 +160,12 @@ interface IssueContracts { >; } +@@maxLength(IssueContract.name, 256); +@@minLength(IssueContract.name, 1); +@@path(IssueContract.name); +@@doc(IssueContract.name, + "Issue identifier. Must be unique in the current API Management service instance." +); @@encodedName(IssueContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/LoggerContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/LoggerContract.tsp index 0f541ca7af..11c2c6309f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/LoggerContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/LoggerContract.tsp @@ -20,17 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiManagementServiceResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(LoggerContractProperties) -model LoggerContract extends ProxyResourceBase { - /** - * Logger identifier. Must be unique in the API Management service instance. - */ - @maxLength(256) - @pattern("^[^*#&+:<>?]+$") - @path - @key("loggerId") - @segment("loggers") - @visibility("read") - name: string; +model LoggerContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = LoggerContract, + KeyName = "loggerId", + SegmentName = "loggers", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * Logger entity contract properties. @@ -83,7 +79,7 @@ interface LoggerContracts { * Updates an existing logger. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Logger_Update") update is ArmCustomPatchSync< LoggerContract, @@ -103,6 +99,7 @@ interface LoggerContracts { * Deletes the specified logger. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Logger_Delete") delete is ArmResourceDeleteSync< LoggerContract, @@ -149,6 +146,11 @@ interface LoggerContracts { >; } +@@maxLength(LoggerContract.name, 256); +@@path(LoggerContract.name); +@@doc(LoggerContract.name, + "Logger identifier. Must be unique in the API Management service instance." +); @@encodedName(LoggerContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/NamedValueContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/NamedValueContract.tsp index 332cd1c720..1ecabae8e1 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/NamedValueContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/NamedValueContract.tsp @@ -20,17 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiManagementServiceResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(NamedValueContractProperties) -model NamedValueContract extends ProxyResourceBase { - /** - * Identifier of the NamedValue. - */ - @maxLength(256) - @pattern("^[^*#&+:<>?]+$") - @path - @key("namedValueId") - @segment("namedValues") - @visibility("read") - name: string; +model NamedValueContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = NamedValueContract, + KeyName = "namedValueId", + SegmentName = "namedValues", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * NamedValue entity contract properties. @@ -83,7 +79,7 @@ interface NamedValueContracts { * Updates the specific named value. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("NamedValue_Update") update is ArmCustomPatchAsync< NamedValueContract, @@ -103,6 +99,7 @@ interface NamedValueContracts { * Deletes specific named value from the API Management service instance. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("NamedValue_Delete") delete is ArmResourceDeleteSync< NamedValueContract, @@ -177,6 +174,9 @@ interface NamedValueContracts { >; } +@@maxLength(NamedValueContract.name, 256); +@@path(NamedValueContract.name); +@@doc(NamedValueContract.name, "Identifier of the NamedValue."); @@encodedName(NamedValueContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/NotificationContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/NotificationContract.tsp index 6c242c617c..66e6e6c00f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/NotificationContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/NotificationContract.tsp @@ -22,7 +22,7 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( NotificationContractProperties ) -model NotificationContract extends ProxyResourceBase { +model NotificationContract extends Foundations.ProxyResource { /** * Notification Name Identifier. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/OpenidConnectProviderContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/OpenidConnectProviderContract.tsp index 4040116438..b804c8b23b 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/OpenidConnectProviderContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/OpenidConnectProviderContract.tsp @@ -22,17 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( OpenidConnectProviderContractProperties ) -model OpenidConnectProviderContract extends ProxyResourceBase { - /** - * Identifier of the OpenID Connect Provider. - */ - @maxLength(256) - @pattern("^[^*#&+:<>?]+$") - @path - @key("opid") - @segment("openidConnectProviders") - @visibility("read") - name: string; +model OpenidConnectProviderContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = OpenidConnectProviderContract, + KeyName = "opid", + SegmentName = "openidConnectProviders", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * OpenId Connect Provider contract properties. @@ -93,7 +89,7 @@ interface OpenidConnectProviderContracts { * Updates the specific OpenID Connect Provider. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("OpenIdConnectProvider_Update") update is ArmCustomPatchSync< OpenidConnectProviderContract, @@ -121,6 +117,7 @@ interface OpenidConnectProviderContracts { * Deletes specific OpenID Connect Provider of the API Management service instance. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("OpenIdConnectProvider_Delete") delete is ArmResourceDeleteSync< OpenidConnectProviderContract, @@ -197,6 +194,11 @@ interface OpenidConnectProviderContracts { >; } +@@maxLength(OpenidConnectProviderContract.name, 256); +@@path(OpenidConnectProviderContract.name); +@@doc(OpenidConnectProviderContract.name, + "Identifier of the OpenID Connect Provider." +); @@encodedName(OpenidConnectProviderContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/OperationContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/OperationContract.tsp index b02b046b40..a9e3d19eda 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/OperationContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/OperationContract.tsp @@ -20,17 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiContract) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(OperationContractProperties) -model OperationContract extends ProxyResourceBase { - /** - * Operation identifier within an API. Must be unique in the current API Management service instance. - */ - @maxLength(80) - @minLength(1) - @path - @key("operationId") - @segment("operations") - @visibility("read") - name: string; +model OperationContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = OperationContract, + KeyName = "operationId", + SegmentName = "operations", + NamePattern = "" + >; /** * Properties of the Operation Contract. @@ -83,7 +79,7 @@ interface OperationContracts { * Updates the details of the operation in the API specified by its identifier. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("ApiOperation_Update") update is ArmCustomPatchSync< OperationContract, @@ -103,6 +99,7 @@ interface OperationContracts { * Deletes the specified operation in the API. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("ApiOperation_Delete") delete is ArmResourceDeleteSync< OperationContract, @@ -155,6 +152,12 @@ interface OperationContracts { >; } +@@maxLength(OperationContract.name, 80); +@@minLength(OperationContract.name, 1); +@@path(OperationContract.name); +@@doc(OperationContract.name, + "Operation identifier within an API. Must be unique in the current API Management service instance." +); @@encodedName(OperationContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PolicyContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PolicyContract.tsp index 67bcb01ed9..6e5baec41f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PolicyContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PolicyContract.tsp @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(OperationContract) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(PolicyContractProperties) -model PolicyContract extends ProxyResourceBase { +model PolicyContract extends Foundations.ProxyResource { /** * The identifier of the Policy. */ @@ -92,6 +92,7 @@ interface PolicyContracts { * Deletes the policy configuration at the Api Operation. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("ApiOperationPolicy_Delete") delete is ArmResourceDeleteSync< PolicyContract, diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalDelegationSettings.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalDelegationSettings.tsp index 64a99eaa1c..3556007bef 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalDelegationSettings.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalDelegationSettings.tsp @@ -23,11 +23,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( PortalDelegationSettingsProperties ) -model PortalDelegationSettings extends ProxyResourceBase { - @key("portalsetting") - @segment("portalsettings") - @visibility("read") - name: string; +model PortalDelegationSettings extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = PortalDelegationSettings, + KeyName = "portalsetting", + SegmentName = "portalsettings", + NamePattern = "" + >; /** * Delegation settings contract properties. @@ -80,7 +82,7 @@ interface PortalDelegationSettingsOperationGroup { * Update Delegation settings. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("DelegationSettings_Update") update is ArmCustomPatchSync< PortalDelegationSettings, @@ -115,6 +117,7 @@ interface PortalDelegationSettingsOperationGroup { >; } +@@doc(PortalDelegationSettings.name, ""); @@encodedName(PortalDelegationSettingsOperationGroup.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalRevisionContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalRevisionContract.tsp index 3744027da1..a726477e25 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalRevisionContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalRevisionContract.tsp @@ -22,17 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( PortalRevisionContractProperties ) -model PortalRevisionContract extends ProxyResourceBase { - /** - * Portal revision identifier. Must be unique in the current API Management service instance. - */ - @maxLength(256) - @minLength(1) - @path - @key("portalRevisionId") - @segment("portalRevisions") - @visibility("read") - name: string; +model PortalRevisionContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = PortalRevisionContract, + KeyName = "portalRevisionId", + SegmentName = "portalRevisions", + NamePattern = "" + >; /** * Properties of the portal revisions. @@ -74,7 +70,7 @@ interface PortalRevisionContracts { * Updates the description of specified portal revision or makes it current. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("PortalRevision_Update") update is ArmCustomPatchAsync< PortalRevisionContract, @@ -128,6 +124,12 @@ interface PortalRevisionContracts { >; } +@@maxLength(PortalRevisionContract.name, 256); +@@minLength(PortalRevisionContract.name, 1); +@@path(PortalRevisionContract.name); +@@doc(PortalRevisionContract.name, + "Portal revision identifier. Must be unique in the current API Management service instance." +); @@encodedName(PortalRevisionContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalSigninSettings.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalSigninSettings.tsp index 00bd38e827..e026a3fb4f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalSigninSettings.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalSigninSettings.tsp @@ -23,11 +23,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( PortalSigninSettingProperties ) -model PortalSigninSettings extends ProxyResourceBase { - @key("portalsetting") - @segment("portalsettings") - @visibility("read") - name: string; +model PortalSigninSettings extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = PortalSigninSettings, + KeyName = "portalsetting", + SegmentName = "portalsettings", + NamePattern = "" + >; /** * Sign-in settings contract properties. @@ -80,7 +82,7 @@ interface PortalSigninSettingsOperationGroup { * Update Sign-In settings. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("SignInSettings_Update") update is ArmCustomPatchSync< PortalSigninSettings, @@ -104,6 +106,7 @@ interface PortalSigninSettingsOperationGroup { listByService is ArmResourceListByParent; } +@@doc(PortalSigninSettings.name, ""); @@encodedName(PortalSigninSettingsOperationGroup.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalSignupSettings.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalSignupSettings.tsp index fda6c5b5de..681dd60458 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalSignupSettings.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PortalSignupSettings.tsp @@ -23,11 +23,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( PortalSignupSettingsProperties ) -model PortalSignupSettings extends ProxyResourceBase { - @key("portalsetting") - @segment("portalsettings") - @visibility("read") - name: string; +model PortalSignupSettings extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = PortalSignupSettings, + KeyName = "portalsetting", + SegmentName = "portalsettings", + NamePattern = "" + >; /** * Sign-up settings contract properties. @@ -80,7 +82,7 @@ interface PortalSignupSettingsOperationGroup { * Update Sign-Up settings. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("SignUpSettings_Update") update is ArmCustomPatchSync< PortalSignupSettings, @@ -104,6 +106,7 @@ interface PortalSignupSettingsOperationGroup { listByService is ArmResourceListByParent; } +@@doc(PortalSignupSettings.name, ""); @@encodedName(PortalSignupSettingsOperationGroup.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PrivateEndpointConnection.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PrivateEndpointConnection.tsp index f8c0de653c..05182d7b96 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PrivateEndpointConnection.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PrivateEndpointConnection.tsp @@ -22,15 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( PrivateEndpointConnectionProperties ) -model PrivateEndpointConnection extends ProxyResourceBase { - /** - * Name of the private endpoint connection. - */ - @path - @key("privateEndpointConnectionName") - @segment("privateEndpointConnections") - @visibility("read") - name: string; +model PrivateEndpointConnection extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = PrivateEndpointConnection, + KeyName = "privateEndpointConnectionName", + SegmentName = "privateEndpointConnections", + NamePattern = "" + >; /** * Resource properties. @@ -59,6 +57,9 @@ interface PrivateEndpointConnections { * Deletes the specified Private Endpoint Connection. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("PrivateEndpointConnection_Delete") delete is ArmResourceDeleteAsync; @@ -70,6 +71,10 @@ interface PrivateEndpointConnections { listByService is ArmResourceListByParent; } +@@path(PrivateEndpointConnection.name); +@@doc(PrivateEndpointConnection.name, + "Name of the private endpoint connection." +); @@encodedName(PrivateEndpointConnections.createOrUpdate::parameters.resource, "application/json", "privateEndpointConnectionRequest" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PrivateLinkResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PrivateLinkResource.tsp index 3e41c2f853..9023aa64c8 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PrivateLinkResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/PrivateLinkResource.tsp @@ -22,15 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( PrivateLinkResourceProperties ) -model PrivateLinkResource extends ProxyResourceBase { - /** - * Name of the private link resource. - */ - @path - @key("privateLinkSubResourceName") - @segment("privateLinkResources") - @visibility("read") - name: string; +model PrivateLinkResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = PrivateLinkResource, + KeyName = "privateLinkSubResourceName", + SegmentName = "privateLinkResources", + NamePattern = "" + >; /** * Resource properties. @@ -55,3 +53,6 @@ interface PrivateLinkResources { @operationId("PrivateEndpointConnection_ListPrivateLinkResources") listPrivateLinkResources is ArmResourceListByParent; } + +@@path(PrivateLinkResource.name); +@@doc(PrivateLinkResource.name, "Name of the private link resource."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ProductContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ProductContract.tsp index 8bc7549d15..ac5ac16d7f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ProductContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ProductContract.tsp @@ -20,17 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiManagementServiceResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(ProductContractProperties) -model ProductContract extends ProxyResourceBase { - /** - * Product identifier. Must be unique in the current API Management service instance. - */ - @maxLength(256) - @minLength(1) - @path - @key("productId") - @segment("products") - @visibility("read") - name: string; +model ProductContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = ProductContract, + KeyName = "productId", + SegmentName = "products", + NamePattern = "" + >; /** * Product entity contract properties. @@ -83,7 +79,7 @@ interface ProductContracts { * Update existing product details. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Product_Update") update is ArmCustomPatchSync< ProductContract, @@ -103,6 +99,7 @@ interface ProductContracts { * Delete product. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Product_Delete") delete is ArmResourceDeleteSync< ProductContract, @@ -320,6 +317,12 @@ interface ProductContracts { ): ArmResponse> | ErrorResponse; } +@@maxLength(ProductContract.name, 256); +@@minLength(ProductContract.name, 1); +@@path(ProductContract.name); +@@doc(ProductContract.name, + "Product identifier. Must be unique in the current API Management service instance." +); @@encodedName(ProductContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/SchemaContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/SchemaContract.tsp index 23c934ad6d..e066642b36 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/SchemaContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/SchemaContract.tsp @@ -20,17 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiContract) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(SchemaContractProperties) -model SchemaContract extends ProxyResourceBase { - /** - * Schema id identifier. Must be unique in the current API Management service instance. - */ - @maxLength(80) - @minLength(1) - @path - @key("schemaId") - @segment("schemas") - @visibility("read") - name: string; +model SchemaContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = SchemaContract, + KeyName = "schemaId", + SegmentName = "schemas", + NamePattern = "" + >; /** * Properties of the API Schema. @@ -83,6 +79,7 @@ interface SchemaContracts { * Deletes the schema configuration at the Api. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("ApiSchema_Delete") delete is ArmResourceDeleteSync< SchemaContract, @@ -135,6 +132,12 @@ interface SchemaContracts { >; } +@@maxLength(SchemaContract.name, 80); +@@minLength(SchemaContract.name, 1); +@@path(SchemaContract.name); +@@doc(SchemaContract.name, + "Schema id identifier. Must be unique in the current API Management service instance." +); @@encodedName(SchemaContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/SubscriptionContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/SubscriptionContract.tsp index aa7771a587..2e4beb8d27 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/SubscriptionContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/SubscriptionContract.tsp @@ -22,15 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( SubscriptionContractProperties ) -model SubscriptionContract extends ProxyResourceBase { - /** - * Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - */ - @path - @key("subscriptionId") - @segment("subscriptions") - @visibility("read") - name: string; +model SubscriptionContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = SubscriptionContract, + KeyName = "subscriptionId", + SegmentName = "subscriptions", + NamePattern = "" + >; /** * Subscription contract properties. @@ -97,7 +95,7 @@ interface SubscriptionContracts { * Updates the details of a subscription specified by its identifier. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Subscription_Update") update is ArmCustomPatchSync< SubscriptionContract, @@ -131,6 +129,7 @@ interface SubscriptionContracts { * Deletes the specified subscription. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Subscription_Delete") delete is ArmResourceDeleteSync< SubscriptionContract, @@ -208,6 +207,10 @@ interface SubscriptionContracts { >; } +@@path(SubscriptionContract.name); +@@doc(SubscriptionContract.name, + "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call." +); @@encodedName(SubscriptionContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/TagContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/TagContract.tsp index 854ec1a34f..172584f04c 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/TagContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/TagContract.tsp @@ -20,18 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(OperationContract) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(TagContractProperties) -model TagContract extends ProxyResourceBase { - /** - * Tag identifier. Must be unique in the current API Management service instance. - */ - @maxLength(80) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("tagId") - @segment("tags") - @visibility("read") - name: string; +model TagContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = TagContract, + KeyName = "tagId", + SegmentName = "tags", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * Tag entity contract properties. @@ -70,6 +65,7 @@ interface TagContracts { * Detach the tag from the Operation. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Tag_DetachFromOperation") detachFromOperation is ArmResourceDeleteSync; @@ -104,3 +100,10 @@ interface TagContracts { } >; } + +@@maxLength(TagContract.name, 80); +@@minLength(TagContract.name, 1); +@@path(TagContract.name); +@@doc(TagContract.name, + "Tag identifier. Must be unique in the current API Management service instance." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/TagDescriptionContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/TagDescriptionContract.tsp index d2a3983192..dc352d1321 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/TagDescriptionContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/TagDescriptionContract.tsp @@ -22,18 +22,13 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( TagDescriptionContractProperties ) -model TagDescriptionContract extends ProxyResourceBase { - /** - * Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. - */ - @maxLength(80) - @minLength(1) - @pattern("^[^*#&+:<>?]+$") - @path - @key("tagDescriptionId") - @segment("tagDescriptions") - @visibility("read") - name: string; +model TagDescriptionContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = TagDescriptionContract, + KeyName = "tagDescriptionId", + SegmentName = "tagDescriptions", + NamePattern = "^[^*#&+:<>?]+$" + >; /** * TagDescription entity contract properties. @@ -86,6 +81,7 @@ interface TagDescriptionContracts { * Delete tag description for the Api. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("ApiTagDescription_Delete") delete is ArmResourceDeleteSync< TagDescriptionContract, @@ -132,6 +128,12 @@ interface TagDescriptionContracts { >; } +@@maxLength(TagDescriptionContract.name, 80); +@@minLength(TagDescriptionContract.name, 1); +@@path(TagDescriptionContract.name); +@@doc(TagDescriptionContract.name, + "Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names." +); @@encodedName(TagDescriptionContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/TenantSettingsContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/TenantSettingsContract.tsp index ceb430debf..685eb2a7ca 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/TenantSettingsContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/TenantSettingsContract.tsp @@ -22,7 +22,7 @@ namespace Azure.ResourceManager.ApiManagement; @Azure.ResourceManager.Private.armResourceInternal( TenantSettingsContractProperties ) -model TenantSettingsContract extends ProxyResourceBase { +model TenantSettingsContract extends Foundations.ProxyResource { /** * The identifier of the settings. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/UserContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/UserContract.tsp index 1ee0818d0e..76e2990fe0 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/UserContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/UserContract.tsp @@ -20,17 +20,13 @@ namespace Azure.ResourceManager.ApiManagement; @parentResource(ApiManagementServiceResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(UserContractProperties) -model UserContract extends ProxyResourceBase { - /** - * User identifier. Must be unique in the current API Management service instance. - */ - @maxLength(80) - @minLength(1) - @path - @key("userId") - @segment("users") - @visibility("read") - name: string; +model UserContract extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = UserContract, + KeyName = "userId", + SegmentName = "users", + NamePattern = "" + >; /** * User entity contract properties. @@ -86,7 +82,7 @@ interface UserContracts { * Updates the details of the user specified by its identifier. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("User_Update") update is ArmCustomPatchSync< UserContract, @@ -106,6 +102,7 @@ interface UserContracts { * Deletes specific user. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("User_Delete") delete is ArmResourceDeleteSync< UserContract, @@ -300,6 +297,12 @@ interface UserContracts { ): ArmResponse | ErrorResponse; } +@@maxLength(UserContract.name, 80); +@@minLength(UserContract.name, 1); +@@path(UserContract.name); +@@doc(UserContract.name, + "User identifier. Must be unique in the current API Management service instance." +); @@encodedName(UserContracts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/models.tsp index 7d93036c34..2ed071e60b 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/models.tsp @@ -1605,6 +1605,7 @@ model ParameterContract { /** * Exampled defined for the parameter. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" examples?: Record; } @@ -1685,6 +1686,7 @@ model RepresentationContract { /** * Exampled defined for the representation. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" examples?: Record; } @@ -2735,11 +2737,13 @@ model BackendCredentialsContract { /** * Query Parameter description. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" query?: Record; /** * Header Parameter description. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" header?: Record; /** @@ -3302,6 +3306,7 @@ model ContentItemContract extends Resource { /** * Properties of the content item. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" properties?: Record; } @@ -3539,6 +3544,7 @@ model ApiManagementServiceBaseProperties { /** * Custom properties of the API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.

You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384 */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" customProperties?: Record; /** @@ -3903,6 +3909,7 @@ model ApiManagementServiceIdentity { * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ * providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" userAssignedIdentities?: Record; } @@ -3943,6 +3950,7 @@ model ApimResource { /** * Resource tags. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -4686,6 +4694,7 @@ model LoggerContractProperties { * The name and SendRule connection string of the event hub for azureEventHub logger. * Instrumentation key for applicationInsights logger. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" credentials?: Record; /** @@ -4726,6 +4735,7 @@ model LoggerUpdateParameters { /** * Logger credentials. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" credentials?: Record; /** @@ -6036,6 +6046,7 @@ model TenantSettingsContractProperties { /** * Tenant settings */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" settings?: Record; } diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/DenyAssignment.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/DenyAssignment.tsp index f745a0405b..84aa7f5ec6 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/DenyAssignment.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/DenyAssignment.tsp @@ -18,15 +18,13 @@ namespace Azure.ResourceManager.Authorization; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(DenyAssignmentProperties) -model DenyAssignment extends ExtensionResourceBase { - /** - * The ID of the deny assignment to get. - */ - @path - @key("denyAssignmentId") - @segment("denyAssignments") - @visibility("read") - name: string; +model DenyAssignment extends Foundations.ExtensionResource { + ...ResourceNameParameter< + Resource = DenyAssignment, + KeyName = "denyAssignmentId", + SegmentName = "denyAssignments", + NamePattern = "" + >; /** * Deny assignment properties. @@ -86,3 +84,6 @@ interface DenyAssignments { } >; } + +@@path(DenyAssignment.name); +@@doc(DenyAssignment.name, "The ID of the deny assignment to get."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/ProviderOperationsMetadata.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/ProviderOperationsMetadata.tsp index fd953a3c2e..6222ac48bc 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/ProviderOperationsMetadata.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/ProviderOperationsMetadata.tsp @@ -16,15 +16,13 @@ namespace Azure.ResourceManager.Authorization; * Provider Operations metadata */ @tenantResource -model ProviderOperationsMetadata is ProxyResource<{}> { - /** - * The namespace of the resource provider. - */ - @path - @key("resourceProviderNamespace") - @segment("providerOperations") - @visibility("read") - name: string; +model ProviderOperationsMetadata is Azure.ResourceManager.ProxyResource<{}> { + ...ResourceNameParameter< + Resource = ProviderOperationsMetadata, + KeyName = "resourceProviderNamespace", + SegmentName = "providerOperations", + NamePattern = "" + >; /** * The provider display name. @@ -78,3 +76,8 @@ interface ProviderOperationsMetadataOperationGroup { } >; } + +@@path(ProviderOperationsMetadata.name); +@@doc(ProviderOperationsMetadata.name, + "The namespace of the resource provider." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignment.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignment.tsp index 0d70af62b0..8e0e131720 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignment.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignment.tsp @@ -18,15 +18,13 @@ namespace Azure.ResourceManager.Authorization; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(RoleAssignmentProperties) -model RoleAssignment extends ExtensionResourceBase { - /** - * The name of the role assignment. It can be any valid GUID. - */ - @path - @key("roleAssignmentName") - @segment("roleAssignments") - @visibility("read") - name: string; +model RoleAssignment extends Foundations.ExtensionResource { + ...ResourceNameParameter< + Resource = RoleAssignment, + KeyName = "roleAssignmentName", + SegmentName = "roleAssignments", + NamePattern = "" + >; /** * Role assignment properties. @@ -61,6 +59,7 @@ interface RoleAssignments { /** * Delete a role assignment by scope and name. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync< RoleAssignment, { @@ -105,6 +104,10 @@ interface RoleAssignments { >; } +@@path(RoleAssignment.name); +@@doc(RoleAssignment.name, + "The name of the role assignment. It can be any valid GUID." +); @@encodedName(RoleAssignments.create::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignmentSchedule.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignmentSchedule.tsp index 00e5437d20..5c3f8b8e70 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignmentSchedule.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignmentSchedule.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.Authorization; @Azure.ResourceManager.Private.armResourceInternal( RoleAssignmentScheduleProperties ) -model RoleAssignmentSchedule extends ExtensionResourceBase { - /** - * The name (guid) of the role assignment schedule to get. - */ - @path - @key("roleAssignmentScheduleName") - @segment("roleAssignmentSchedules") - @visibility("read") - name: string; +model RoleAssignmentSchedule extends Foundations.ExtensionResource { + ...ResourceNameParameter< + Resource = RoleAssignmentSchedule, + KeyName = "roleAssignmentScheduleName", + SegmentName = "roleAssignmentSchedules", + NamePattern = "" + >; /** * Role assignment schedule properties. @@ -62,3 +60,8 @@ interface RoleAssignmentSchedules { } >; } + +@@path(RoleAssignmentSchedule.name); +@@doc(RoleAssignmentSchedule.name, + "The name (guid) of the role assignment schedule to get." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignmentScheduleInstance.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignmentScheduleInstance.tsp index b3d96fda24..f5304cb278 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignmentScheduleInstance.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignmentScheduleInstance.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.Authorization; @Azure.ResourceManager.Private.armResourceInternal( RoleAssignmentScheduleInstanceProperties ) -model RoleAssignmentScheduleInstance extends ExtensionResourceBase { - /** - * The name (hash of schedule name + time) of the role assignment schedule to get. - */ - @path - @key("roleAssignmentScheduleInstanceName") - @segment("roleAssignmentScheduleInstances") - @visibility("read") - name: string; +model RoleAssignmentScheduleInstance extends Foundations.ExtensionResource { + ...ResourceNameParameter< + Resource = RoleAssignmentScheduleInstance, + KeyName = "roleAssignmentScheduleInstanceName", + SegmentName = "roleAssignmentScheduleInstances", + NamePattern = "" + >; /** * Role assignment schedule instance properties. @@ -62,3 +60,8 @@ interface RoleAssignmentScheduleInstances { } >; } + +@@path(RoleAssignmentScheduleInstance.name); +@@doc(RoleAssignmentScheduleInstance.name, + "The name (hash of schedule name + time) of the role assignment schedule to get." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignmentScheduleRequest.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignmentScheduleRequest.tsp index bd9c5c9a88..64f341502e 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignmentScheduleRequest.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleAssignmentScheduleRequest.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.Authorization; @Azure.ResourceManager.Private.armResourceInternal( RoleAssignmentScheduleRequestProperties ) -model RoleAssignmentScheduleRequest extends ExtensionResourceBase { - /** - * The name (guid) of the role assignment schedule request to get. - */ - @path - @key("roleAssignmentScheduleRequestName") - @segment("roleAssignmentScheduleRequests") - @visibility("read") - name: string; +model RoleAssignmentScheduleRequest extends Foundations.ExtensionResource { + ...ResourceNameParameter< + Resource = RoleAssignmentScheduleRequest, + KeyName = "roleAssignmentScheduleRequestName", + SegmentName = "roleAssignmentScheduleRequests", + NamePattern = "" + >; /** * Role assignment schedule request properties. @@ -82,6 +80,10 @@ interface RoleAssignmentScheduleRequests { >; } +@@path(RoleAssignmentScheduleRequest.name); +@@doc(RoleAssignmentScheduleRequest.name, + "The name (guid) of the role assignment schedule request to get." +); @@encodedName(RoleAssignmentScheduleRequests.create::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleDefinition.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleDefinition.tsp index c2dbc6cc1c..ff5f2227f7 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleDefinition.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleDefinition.tsp @@ -18,15 +18,13 @@ namespace Azure.ResourceManager.Authorization; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(RoleDefinitionProperties) -model RoleDefinition extends ExtensionResourceBase { - /** - * The ID of the role definition. - */ - @path - @key("roleDefinitionId") - @segment("roleDefinitions") - @visibility("read") - name: string; +model RoleDefinition extends Foundations.ExtensionResource { + ...ResourceNameParameter< + Resource = RoleDefinition, + KeyName = "roleDefinitionId", + SegmentName = "roleDefinitions", + NamePattern = "" + >; /** * Role definition properties. @@ -50,6 +48,7 @@ interface RoleDefinitions { /** * Deletes a role definition. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -71,6 +70,8 @@ interface RoleDefinitions { >; } +@@path(RoleDefinition.name); +@@doc(RoleDefinition.name, "The ID of the role definition."); @@encodedName(RoleDefinitions.createOrUpdate::parameters.resource, "application/json", "roleDefinition" diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleEligibilitySchedule.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleEligibilitySchedule.tsp index ec3706e532..0a15210344 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleEligibilitySchedule.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleEligibilitySchedule.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.Authorization; @Azure.ResourceManager.Private.armResourceInternal( RoleEligibilityScheduleProperties ) -model RoleEligibilitySchedule extends ExtensionResourceBase { - /** - * The name (guid) of the role eligibility schedule to get. - */ - @path - @key("roleEligibilityScheduleName") - @segment("roleEligibilitySchedules") - @visibility("read") - name: string; +model RoleEligibilitySchedule extends Foundations.ExtensionResource { + ...ResourceNameParameter< + Resource = RoleEligibilitySchedule, + KeyName = "roleEligibilityScheduleName", + SegmentName = "roleEligibilitySchedules", + NamePattern = "" + >; /** * role eligibility schedule properties. @@ -62,3 +60,8 @@ interface RoleEligibilitySchedules { } >; } + +@@path(RoleEligibilitySchedule.name); +@@doc(RoleEligibilitySchedule.name, + "The name (guid) of the role eligibility schedule to get." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleEligibilityScheduleInstance.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleEligibilityScheduleInstance.tsp index fa6f33869f..822a0ded25 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleEligibilityScheduleInstance.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleEligibilityScheduleInstance.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.Authorization; @Azure.ResourceManager.Private.armResourceInternal( RoleEligibilityScheduleInstanceProperties ) -model RoleEligibilityScheduleInstance extends ExtensionResourceBase { - /** - * The name (hash of schedule name + time) of the role eligibility schedule to get. - */ - @path - @key("roleEligibilityScheduleInstanceName") - @segment("roleEligibilityScheduleInstances") - @visibility("read") - name: string; +model RoleEligibilityScheduleInstance extends Foundations.ExtensionResource { + ...ResourceNameParameter< + Resource = RoleEligibilityScheduleInstance, + KeyName = "roleEligibilityScheduleInstanceName", + SegmentName = "roleEligibilityScheduleInstances", + NamePattern = "" + >; /** * Role eligibility schedule instance properties. @@ -62,3 +60,8 @@ interface RoleEligibilityScheduleInstances { } >; } + +@@path(RoleEligibilityScheduleInstance.name); +@@doc(RoleEligibilityScheduleInstance.name, + "The name (hash of schedule name + time) of the role eligibility schedule to get." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleEligibilityScheduleRequest.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleEligibilityScheduleRequest.tsp index e57c044191..1926b2e66c 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleEligibilityScheduleRequest.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleEligibilityScheduleRequest.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.Authorization; @Azure.ResourceManager.Private.armResourceInternal( RoleEligibilityScheduleRequestProperties ) -model RoleEligibilityScheduleRequest extends ExtensionResourceBase { - /** - * The name (guid) of the role eligibility schedule request to get. - */ - @path - @key("roleEligibilityScheduleRequestName") - @segment("roleEligibilityScheduleRequests") - @visibility("read") - name: string; +model RoleEligibilityScheduleRequest extends Foundations.ExtensionResource { + ...ResourceNameParameter< + Resource = RoleEligibilityScheduleRequest, + KeyName = "roleEligibilityScheduleRequestName", + SegmentName = "roleEligibilityScheduleRequests", + NamePattern = "" + >; /** * Role eligibility schedule request properties. @@ -82,6 +80,10 @@ interface RoleEligibilityScheduleRequests { >; } +@@path(RoleEligibilityScheduleRequest.name); +@@doc(RoleEligibilityScheduleRequest.name, + "The name (guid) of the role eligibility schedule request to get." +); @@encodedName(RoleEligibilityScheduleRequests.create::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleManagementPolicy.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleManagementPolicy.tsp index f8ca09ee6e..971b0b033a 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleManagementPolicy.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleManagementPolicy.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.Authorization; @Azure.ResourceManager.Private.armResourceInternal( RoleManagementPolicyProperties ) -model RoleManagementPolicy extends ExtensionResourceBase { - /** - * The name (guid) of the role management policy to get. - */ - @path - @key("roleManagementPolicyName") - @segment("roleManagementPolicies") - @visibility("read") - name: string; +model RoleManagementPolicy extends Foundations.ExtensionResource { + ...ResourceNameParameter< + Resource = RoleManagementPolicy, + KeyName = "roleManagementPolicyName", + SegmentName = "roleManagementPolicies", + NamePattern = "" + >; /** * Role management policy properties. @@ -47,7 +45,7 @@ interface RoleManagementPolicies { /** * Update a role management policy */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** @@ -58,6 +56,10 @@ interface RoleManagementPolicies { listForScope is ArmResourceListByParent; } +@@path(RoleManagementPolicy.name); +@@doc(RoleManagementPolicy.name, + "The name (guid) of the role management policy to get." +); @@encodedName(RoleManagementPolicies.update::parameters.properties, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleManagementPolicyAssignment.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleManagementPolicyAssignment.tsp index dd923a5701..0ffee1b259 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleManagementPolicyAssignment.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/RoleManagementPolicyAssignment.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.Authorization; @Azure.ResourceManager.Private.armResourceInternal( RoleManagementPolicyAssignmentProperties ) -model RoleManagementPolicyAssignment extends ExtensionResourceBase { - /** - * The name of format {guid_guid} the role management policy assignment to get. - */ - @path - @key("roleManagementPolicyAssignmentName") - @segment("roleManagementPolicyAssignments") - @visibility("read") - name: string; +model RoleManagementPolicyAssignment extends Foundations.ExtensionResource { + ...ResourceNameParameter< + Resource = RoleManagementPolicyAssignment, + KeyName = "roleManagementPolicyAssignmentName", + SegmentName = "roleManagementPolicyAssignments", + NamePattern = "" + >; /** * Role management policy properties. @@ -57,6 +55,10 @@ interface RoleManagementPolicyAssignments { listForScope is ArmResourceListByParent; } +@@path(RoleManagementPolicyAssignment.name); +@@doc(RoleManagementPolicyAssignment.name, + "The name of format {guid_guid} the role management policy assignment to get." +); @@encodedName(RoleManagementPolicyAssignments.create::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/Application.tsp b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/Application.tsp index ac6a65988d..b842893a64 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/Application.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/Application.tsp @@ -16,16 +16,14 @@ namespace Microsoft.IntegrationSpaces; * An integration application under space. */ @parentResource(Space) -model Application is TrackedResource { - /** - * The name of the Application - */ - @pattern("[a-zA-Z0-9_.()-]{0,79}$") - @path - @key("applicationName") - @segment("applications") - @visibility("read") - name: string; +model Application + is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = Application, + KeyName = "applicationName", + SegmentName = "applications", + NamePattern = "[a-zA-Z0-9_.()-]{0,79}$" + >; } @armResourceOperations @@ -43,12 +41,13 @@ interface Applications { /** * Update a Application */ - @parameterVisibility("read") + @parameterVisibility patch is ArmCustomPatchSync; /** * Delete a Application */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -159,3 +158,6 @@ interface Applications { void >; } + +@@path(Application.name); +@@doc(Application.name, "The name of the Application"); diff --git a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/BusinessProcess.tsp b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/BusinessProcess.tsp index 1ce9d54810..450e620131 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/BusinessProcess.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/BusinessProcess.tsp @@ -16,16 +16,14 @@ namespace Microsoft.IntegrationSpaces; * A business process under application. */ @parentResource(Application) -model BusinessProcess is ProxyResource { - /** - * The name of the business process - */ - @pattern("[a-zA-Z0-9_.()-]{0,79}$") - @path - @key("businessProcessName") - @segment("businessProcesses") - @visibility("read") - name: string; +model BusinessProcess + is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = BusinessProcess, + KeyName = "businessProcessName", + SegmentName = "businessProcesses", + NamePattern = "[a-zA-Z0-9_.()-]{0,79}$" + >; } @armResourceOperations @@ -43,12 +41,13 @@ interface BusinessProcesses { /** * Update a BusinessProcess */ - @parameterVisibility("read") + @parameterVisibility patch is ArmCustomPatchSync; /** * Delete a BusinessProcess */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -114,3 +113,6 @@ interface BusinessProcesses { } >; } + +@@path(BusinessProcess.name); +@@doc(BusinessProcess.name, "The name of the business process"); diff --git a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/BusinessProcessVersion.tsp b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/BusinessProcessVersion.tsp index 5fd1bd3c7e..66d2893a5b 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/BusinessProcessVersion.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/BusinessProcessVersion.tsp @@ -16,15 +16,14 @@ namespace Microsoft.IntegrationSpaces; * A business process version. */ @parentResource(BusinessProcess) -model BusinessProcessVersion is ProxyResource { - /** - * The version of the business process - */ - @path - @key("businessProcessVersion") - @segment("versions") - @visibility("read") - name: string; +model BusinessProcessVersion + is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = BusinessProcessVersion, + KeyName = "businessProcessVersion", + SegmentName = "versions", + NamePattern = "" + >; } @armResourceOperations @@ -97,3 +96,6 @@ interface BusinessProcessVersions { } >; } + +@@path(BusinessProcessVersion.name); +@@doc(BusinessProcessVersion.name, "The version of the business process"); diff --git a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/InfrastructureResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/InfrastructureResource.tsp index 30c7712aad..91019c87ed 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/InfrastructureResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/InfrastructureResource.tsp @@ -17,16 +17,13 @@ namespace Microsoft.IntegrationSpaces; */ @parentResource(Space) model InfrastructureResource - is ProxyResource { - /** - * The name of the infrastructure resource in the space. - */ - @pattern("[a-zA-Z0-9_.()-]{0,79}$") - @path - @key("infrastructureResourceName") - @segment("infrastructureResources") - @visibility("read") - name: string; + is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = InfrastructureResource, + KeyName = "infrastructureResourceName", + SegmentName = "infrastructureResources", + NamePattern = "[a-zA-Z0-9_.()-]{0,79}$" + >; } @armResourceOperations @@ -44,7 +41,7 @@ interface InfrastructureResources { /** * Update a InfrastructureResource */ - @parameterVisibility("read") + @parameterVisibility patch is ArmCustomPatchSync< InfrastructureResource, InfrastructureResourceUpdate @@ -53,6 +50,7 @@ interface InfrastructureResources { /** * Delete a InfrastructureResource */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -118,3 +116,8 @@ interface InfrastructureResources { } >; } + +@@path(InfrastructureResource.name); +@@doc(InfrastructureResource.name, + "The name of the infrastructure resource in the space." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/Space.tsp b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/Space.tsp index 839ca404f0..161c06ed2d 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/Space.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/Space.tsp @@ -14,16 +14,13 @@ namespace Microsoft.IntegrationSpaces; /** * An integration space. */ -model Space is TrackedResource { - /** - * The name of the space - */ - @pattern("[a-zA-Z0-9_.()-]{0,79}$") - @path - @key("spaceName") - @segment("spaces") - @visibility("read") - name: string; +model Space is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = Space, + KeyName = "spaceName", + SegmentName = "spaces", + NamePattern = "[a-zA-Z0-9_.()-]{0,79}$" + >; } @armResourceOperations @@ -41,12 +38,13 @@ interface Spaces { /** * Update a Space */ - @parameterVisibility("read") + @parameterVisibility patch is ArmCustomPatchSync; /** * Delete a Space */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -117,3 +115,6 @@ interface Spaces { */ listBySubscription is ArmListBySubscription; } + +@@path(Space.name); +@@doc(Space.name, "The name of the space"); diff --git a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/models.tsp index 10b2cacb7a..22b0e3c2a4 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/models.tsp @@ -89,6 +89,7 @@ model SpaceUpdate { /** * Resource tags. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; /** @@ -125,6 +126,7 @@ model ApplicationProperties { /** * The tracking data stores. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" trackingDataStores: Record; } @@ -160,6 +162,7 @@ model ApplicationUpdate { /** * Resource tags. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; /** @@ -180,6 +183,7 @@ model ApplicationUpdateProperties { /** * The tracking data stores. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" trackingDataStores?: Record; } @@ -222,11 +226,13 @@ model BusinessProcessProperties { /** * The business process stages. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" businessProcessStages?: Record; /** * The business process mapping. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" businessProcessMapping?: Record; } @@ -257,6 +263,7 @@ model BusinessProcessStage { /** * The properties within the properties of the business process stage. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" properties?: Record; /** @@ -327,11 +334,13 @@ model BusinessProcessUpdateProperties { /** * The business process stages. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" businessProcessStages?: Record; /** * The business process mapping. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" businessProcessMapping?: Record; } @@ -392,16 +401,19 @@ model BusinessProcessDevelopmentArtifactProperties { /** * The business process stages. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" businessProcessStages?: Record; /** * The business process mapping. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" businessProcessMapping?: Record; /** * The tracking profile for the business process. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" trackingProfiles?: Record; } @@ -423,6 +435,7 @@ model TrackingProfileDefinition { /** * The tracking definitions. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" trackingDefinitions?: Record; } @@ -453,6 +466,7 @@ model FlowTrackingDefinition { /** * The tracking events. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" events?: Record; } @@ -498,6 +512,7 @@ model TrackingEventDefinition { /** * The properties to be collected for event. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" properties?: Record>; } diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/AvailabilitySet.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/AvailabilitySet.tsp index f089b8d095..5b7914a3d7 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/AvailabilitySet.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/AvailabilitySet.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model AvailabilitySet extends Resource { - /** - * The name of the availability set. - */ - @path - @key("availabilitySetName") - @segment("availabilitySets") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = AvailabilitySet, + KeyName = "availabilitySetName", + SegmentName = "availabilitySets", + NamePattern = "" + >; /** * Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'. @@ -54,12 +52,13 @@ interface AvailabilitySets { /** * Update an availability set. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** * Delete an availability set. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -94,6 +93,8 @@ interface AvailabilitySets { ): ArmResponse | ErrorResponse; } +@@path(AvailabilitySet.name); +@@doc(AvailabilitySet.name, "The name of the availability set."); @@encodedName(AvailabilitySets.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CapacityReservation.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CapacityReservation.tsp index 3f41f7eaa8..301a6ff6dc 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CapacityReservation.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CapacityReservation.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(CapacityReservationGroup) @includeInapplicableMetadataInPayload(false) model CapacityReservation extends Resource { - /** - * The name of the capacity reservation. - */ - @path - @key("capacityReservationName") - @segment("capacityReservations") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = CapacityReservation, + KeyName = "capacityReservationName", + SegmentName = "capacityReservations", + NamePattern = "" + >; /** * SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. @@ -72,12 +70,15 @@ interface CapacityReservations { /** * The operation to update a capacity reservation. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more details. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -88,6 +89,8 @@ interface CapacityReservations { listByCapacityReservationGroup is ArmResourceListByParent; } +@@path(CapacityReservation.name); +@@doc(CapacityReservation.name, "The name of the capacity reservation."); @@encodedName(CapacityReservations.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CapacityReservationGroup.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CapacityReservationGroup.tsp index c8cd9aeb7c..e085d574ca 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CapacityReservationGroup.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CapacityReservationGroup.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model CapacityReservationGroup extends Resource { - /** - * The name of the capacity reservation group. - */ - @path - @key("capacityReservationGroupName") - @segment("capacityReservationGroups") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = CapacityReservationGroup, + KeyName = "capacityReservationGroupName", + SegmentName = "capacityReservationGroups", + NamePattern = "" + >; /** * Availability Zones to use for this capacity reservation group. The zones can be assigned only during creation. If not provided, the group supports only regional resources in the region. If provided, enforces each capacity reservation in the group to be in one of the zones. @@ -65,7 +63,7 @@ interface CapacityReservationGroups { /** * The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may be modified. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync< CapacityReservationGroup, CapacityReservationGroupUpdate @@ -74,6 +72,7 @@ interface CapacityReservationGroups { /** * The operation to delete a capacity reservation group. This operation is allowed only if all the associated resources are disassociated from the reservation group and all capacity reservations under the reservation group have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -100,6 +99,10 @@ interface CapacityReservationGroups { listBySubscription is ArmListBySubscription; } +@@path(CapacityReservationGroup.name); +@@doc(CapacityReservationGroup.name, + "The name of the capacity reservation group." +); @@encodedName(CapacityReservationGroups.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CloudService.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CloudService.tsp index 9afc0f144b..2a7920a396 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CloudService.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CloudService.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model CloudService { - /** - * Name of the cloud service. - */ - @path - @key("cloudServiceName") - @segment("cloudServices") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = CloudService, + KeyName = "cloudServiceName", + SegmentName = "cloudServices", + NamePattern = "" + >; /** * Resource Id. @@ -47,6 +45,7 @@ model CloudService { /** * Resource tags. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; /** @@ -82,12 +81,15 @@ interface CloudServices { /** * Update a cloud service. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * Deletes a cloud service. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -200,6 +202,8 @@ interface CloudServices { ): ArmResponse | ErrorResponse; } +@@path(CloudService.name); +@@doc(CloudService.name, "Name of the cloud service."); @@encodedName(CloudServices.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CloudServiceRole.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CloudServiceRole.tsp index a2394ac1b6..b7a40a3287 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CloudServiceRole.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CloudServiceRole.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(CloudService) @includeInapplicableMetadataInPayload(false) model CloudServiceRole { - /** - * Name of the role. - */ - @path - @key("roleName") - @segment("roles") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = CloudServiceRole, + KeyName = "roleName", + SegmentName = "roles", + NamePattern = "" + >; /** * Resource id @@ -73,3 +71,6 @@ interface CloudServiceRoles { @operationId("CloudServiceRoles_List") list is ArmResourceListByParent; } + +@@path(CloudServiceRole.name); +@@doc(CloudServiceRole.name, "Name of the role."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CommunityGallery.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CommunityGallery.tsp index 2805d07d67..0051bdf3b0 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CommunityGallery.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CommunityGallery.tsp @@ -21,14 +21,12 @@ namespace Microsoft.Compute; @parentResource(SubscriptionLocationResource) @includeInapplicableMetadataInPayload(false) model CommunityGallery extends PirCommunityGalleryResource { - /** - * The public name of the community gallery. - */ - @path - @key("publicGalleryName") - @segment("communityGalleries") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = CommunityGallery, + KeyName = "publicGalleryName", + SegmentName = "communityGalleries", + NamePattern = "" + >; @extension("x-ms-client-flatten", true) @visibility("read,create") @@ -42,3 +40,6 @@ interface CommunityGalleries { */ get is ArmResourceRead; } + +@@path(CommunityGallery.name); +@@doc(CommunityGallery.name, "The public name of the community gallery."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CommunityGalleryImage.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CommunityGalleryImage.tsp index 0ce0a57531..43f8e4bc99 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CommunityGalleryImage.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CommunityGalleryImage.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(CommunityGallery) @includeInapplicableMetadataInPayload(false) model CommunityGalleryImage extends PirCommunityGalleryResource { - /** - * The name of the community gallery image definition. - */ - @path - @key("galleryImageName") - @segment("images") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = CommunityGalleryImage, + KeyName = "galleryImageName", + SegmentName = "images", + NamePattern = "" + >; /** * Describes the properties of a gallery image definition. @@ -50,3 +48,8 @@ interface CommunityGalleryImages { @operationId("CommunityGalleryImages_List") list is ArmResourceListByParent; } + +@@path(CommunityGalleryImage.name); +@@doc(CommunityGalleryImage.name, + "The name of the community gallery image definition." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CommunityGalleryImageVersion.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CommunityGalleryImageVersion.tsp index fac5981be4..7b2c9b4910 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CommunityGalleryImageVersion.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/CommunityGalleryImageVersion.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(CommunityGalleryImage) @includeInapplicableMetadataInPayload(false) model CommunityGalleryImageVersion extends PirCommunityGalleryResource { - /** - * The name of the community gallery image version. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: .. - */ - @path - @key("galleryImageVersionName") - @segment("versions") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = CommunityGalleryImageVersion, + KeyName = "galleryImageVersionName", + SegmentName = "versions", + NamePattern = "" + >; /** * Describes the properties of a gallery image version. @@ -50,3 +48,8 @@ interface CommunityGalleryImageVersions { @operationId("CommunityGalleryImageVersions_List") list is ArmResourceListByParent; } + +@@path(CommunityGalleryImageVersion.name); +@@doc(CommunityGalleryImageVersion.name, + "The name of the community gallery image version. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: .." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DedicatedHost.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DedicatedHost.tsp index 0dc0c47178..b0fb9865f9 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DedicatedHost.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DedicatedHost.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(DedicatedHostGroup) @includeInapplicableMetadataInPayload(false) model DedicatedHost extends Resource { - /** - * The name of the dedicated host. - */ - @path - @key("hostName") - @segment("hosts") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = DedicatedHost, + KeyName = "hostName", + SegmentName = "hosts", + NamePattern = "" + >; /** * SKU of the dedicated host for Hardware Generation and VM family. Only name is required to be set. List Microsoft.Compute SKUs for a list of possible values. @@ -67,12 +65,15 @@ interface DedicatedHosts { /** * Update a dedicated host . */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * Delete a dedicated host. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -115,6 +116,8 @@ interface DedicatedHosts { ): ArmResponse | ErrorResponse; } +@@path(DedicatedHost.name); +@@doc(DedicatedHost.name, "The name of the dedicated host."); @@encodedName(DedicatedHosts.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DedicatedHostGroup.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DedicatedHostGroup.tsp index cdd970b426..2bfdb02b62 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DedicatedHostGroup.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DedicatedHostGroup.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model DedicatedHostGroup extends Resource { - /** - * The name of the dedicated host group. - */ - @path - @key("hostGroupName") - @segment("hostGroups") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = DedicatedHostGroup, + KeyName = "hostGroupName", + SegmentName = "hostGroups", + NamePattern = "" + >; /** * Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, enforces each host in the group to be in the same zone. @@ -65,12 +63,13 @@ interface DedicatedHostGroups { /** * Update an dedicated host group. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** * Delete a dedicated host group. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -86,6 +85,8 @@ interface DedicatedHostGroups { listBySubscription is ArmListBySubscription; } +@@path(DedicatedHostGroup.name); +@@doc(DedicatedHostGroup.name, "The name of the dedicated host group."); @@encodedName(DedicatedHostGroups.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Disk.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Disk.tsp index 229c5c2c2d..71ec788258 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Disk.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Disk.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model Disk extends Resource { - /** - * The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. - */ - @path - @key("diskName") - @segment("disks") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = Disk, + KeyName = "diskName", + SegmentName = "disks", + NamePattern = "" + >; /** * A relative URI containing the ID of the VM that has the disk attached. @@ -76,12 +74,15 @@ interface Disks { /** * Updates (patches) a disk. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * Deletes a disk. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -107,6 +108,10 @@ interface Disks { revokeAccess is ArmResourceActionAsync; } +@@path(Disk.name); +@@doc(Disk.name, + "The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters." +); @@encodedName(Disks.createOrUpdate::parameters.resource, "application/json", "disk" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DiskAccess.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DiskAccess.tsp index 6cd0c78c14..35cc8dcb04 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DiskAccess.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DiskAccess.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model DiskAccess extends Resource { - /** - * The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. - */ - @path - @key("diskAccessName") - @segment("diskAccesses") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = DiskAccess, + KeyName = "diskAccessName", + SegmentName = "diskAccesses", + NamePattern = "" + >; /** * The extended location where the disk access will be created. Extended location cannot be changed. @@ -51,12 +49,15 @@ interface DiskAccesses { /** * Updates (patches) a disk access resource. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * Deletes a disk access resource. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -90,6 +91,10 @@ interface DiskAccesses { ): ArmResponse | ErrorResponse; } +@@path(DiskAccess.name); +@@doc(DiskAccess.name, + "The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters." +); @@encodedName(DiskAccesses.createOrUpdate::parameters.resource, "application/json", "diskAccess" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DiskEncryptionSet.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DiskEncryptionSet.tsp index 622a53ed63..4bb33360c0 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DiskEncryptionSet.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DiskEncryptionSet.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model DiskEncryptionSet extends Resource { - /** - * The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. - */ - @path - @key("diskEncryptionSetName") - @segment("diskEncryptionSets") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = DiskEncryptionSet, + KeyName = "diskEncryptionSetName", + SegmentName = "diskEncryptionSets", + NamePattern = "" + >; /** * The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. @@ -51,12 +49,15 @@ interface DiskEncryptionSets { /** * Updates (patches) a disk encryption set. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * Deletes a disk encryption set. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -90,6 +91,10 @@ interface DiskEncryptionSets { ): ArmResponse | ErrorResponse; } +@@path(DiskEncryptionSet.name); +@@doc(DiskEncryptionSet.name, + "The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters." +); @@encodedName(DiskEncryptionSets.createOrUpdate::parameters.resource, "application/json", "diskEncryptionSet" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DiskRestorePoint.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DiskRestorePoint.tsp index ac556b9f75..5e8fb77ca8 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DiskRestorePoint.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/DiskRestorePoint.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(RestorePoint) @includeInapplicableMetadataInPayload(false) model DiskRestorePoint extends ProxyOnlyResource { - /** - * The name of the disk restore point created. - */ - @path - @key("diskRestorePointName") - @segment("diskRestorePoints") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = DiskRestorePoint, + KeyName = "diskRestorePointName", + SegmentName = "diskRestorePoints", + NamePattern = "" + >; /** * Properties of an incremental disk restore point @@ -115,6 +113,8 @@ interface DiskRestorePoints { >; } +@@path(DiskRestorePoint.name); +@@doc(DiskRestorePoint.name, "The name of the disk restore point created."); @@encodedName(DiskRestorePoints.grantAccess::parameters.body, "application/json", "grantAccessData" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Gallery.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Gallery.tsp index 2e465110fd..cbbcef441a 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Gallery.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Gallery.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model Gallery extends Resource { - /** - * The name of the Shared Image Gallery. - */ - @path - @key("galleryName") - @segment("galleries") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = Gallery, + KeyName = "galleryName", + SegmentName = "galleries", + NamePattern = "" + >; /** * Describes the properties of a Shared Image Gallery. @@ -66,12 +64,15 @@ interface Galleries { /** * Update a Shared Image Gallery. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * Delete a Shared Image Gallery. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -94,6 +95,8 @@ interface Galleries { update is ArmResourceActionAsync; } +@@path(Gallery.name); +@@doc(Gallery.name, "The name of the Shared Image Gallery."); @@encodedName(Galleries.createOrUpdate::parameters.resource, "application/json", "gallery" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryApplication.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryApplication.tsp index 53e9211d53..281eaf83db 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryApplication.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryApplication.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(Gallery) @includeInapplicableMetadataInPayload(false) model GalleryApplication extends Resource { - /** - * The name of the gallery Application Definition to be retrieved. - */ - @path - @key("galleryApplicationName") - @segment("applications") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = GalleryApplication, + KeyName = "galleryApplicationName", + SegmentName = "applications", + NamePattern = "" + >; /** * Describes the properties of a gallery Application Definition. @@ -51,12 +49,15 @@ interface GalleryApplications { /** * Update a gallery Application Definition. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * Delete a gallery Application. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -67,6 +68,10 @@ interface GalleryApplications { listByGallery is ArmResourceListByParent; } +@@path(GalleryApplication.name); +@@doc(GalleryApplication.name, + "The name of the gallery Application Definition to be retrieved." +); @@encodedName(GalleryApplications.createOrUpdate::parameters.resource, "application/json", "galleryApplication" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryApplicationVersion.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryApplicationVersion.tsp index 8fa0b9ca67..3a9bd933c8 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryApplicationVersion.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryApplicationVersion.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(GalleryApplication) @includeInapplicableMetadataInPayload(false) model GalleryApplicationVersion extends Resource { - /** - * The name of the gallery Application Version to be retrieved. - */ - @path - @key("galleryApplicationVersionName") - @segment("versions") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = GalleryApplicationVersion, + KeyName = "galleryApplicationVersionName", + SegmentName = "versions", + NamePattern = "" + >; /** * Describes the properties of a gallery image version. @@ -62,7 +60,7 @@ interface GalleryApplicationVersions { /** * Update a gallery Application Version. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync< GalleryApplicationVersion, GalleryApplicationVersionUpdate @@ -71,6 +69,9 @@ interface GalleryApplicationVersions { /** * Delete a gallery Application Version. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -81,6 +82,10 @@ interface GalleryApplicationVersions { listByGalleryApplication is ArmResourceListByParent; } +@@path(GalleryApplicationVersion.name); +@@doc(GalleryApplicationVersion.name, + "The name of the gallery Application Version to be retrieved." +); @@encodedName(GalleryApplicationVersions.createOrUpdate::parameters.resource, "application/json", "galleryApplicationVersion" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryImage.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryImage.tsp index 874ed3c1e3..7a4d9072ff 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryImage.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryImage.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(Gallery) @includeInapplicableMetadataInPayload(false) model GalleryImage extends Resource { - /** - * The name of the gallery image definition to be retrieved. - */ - @path - @key("galleryImageName") - @segment("images") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = GalleryImage, + KeyName = "galleryImageName", + SegmentName = "images", + NamePattern = "" + >; /** * Describes the properties of a gallery image definition. @@ -51,12 +49,15 @@ interface GalleryImages { /** * Update a gallery image definition. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * Delete a gallery image. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -67,6 +68,10 @@ interface GalleryImages { listByGallery is ArmResourceListByParent; } +@@path(GalleryImage.name); +@@doc(GalleryImage.name, + "The name of the gallery image definition to be retrieved." +); @@encodedName(GalleryImages.createOrUpdate::parameters.resource, "application/json", "galleryImage" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryImageVersion.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryImageVersion.tsp index aff2656ca8..eef81575f6 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryImageVersion.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/GalleryImageVersion.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(GalleryImage) @includeInapplicableMetadataInPayload(false) model GalleryImageVersion extends Resource { - /** - * The name of the gallery image version to be retrieved. - */ - @path - @key("galleryImageVersionName") - @segment("versions") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = GalleryImageVersion, + KeyName = "galleryImageVersionName", + SegmentName = "versions", + NamePattern = "" + >; /** * Describes the properties of a gallery image version. @@ -62,12 +60,15 @@ interface GalleryImageVersions { /** * Update a gallery image version. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * Delete a gallery image version. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -78,6 +79,10 @@ interface GalleryImageVersions { listByGalleryImage is ArmResourceListByParent; } +@@path(GalleryImageVersion.name); +@@doc(GalleryImageVersion.name, + "The name of the gallery image version to be retrieved." +); @@encodedName(GalleryImageVersions.createOrUpdate::parameters.resource, "application/json", "galleryImageVersion" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Image.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Image.tsp index d26977a281..5219f1eb80 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Image.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Image.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model Image extends Resource { - /** - * The name of the image. - */ - @path - @key("imageName") - @segment("images") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = Image, + KeyName = "imageName", + SegmentName = "images", + NamePattern = "" + >; /** * The extended location of the Image. @@ -65,12 +63,15 @@ interface Images { /** * Update an image. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * Deletes an Image. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -86,6 +87,8 @@ interface Images { list is ArmListBySubscription; } +@@path(Image.name); +@@doc(Image.name, "The name of the image."); @@encodedName(Images.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/OSFamily.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/OSFamily.tsp index e189be72f3..6c93c2f854 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/OSFamily.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/OSFamily.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(SubscriptionLocationResource) @includeInapplicableMetadataInPayload(false) model OSFamily { - /** - * Name of the OS family. - */ - @path - @key("osFamilyName") - @segment("cloudServiceOsFamilies") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = OSFamily, + KeyName = "osFamilyName", + SegmentName = "cloudServiceOsFamilies", + NamePattern = "" + >; /** * Resource Id. @@ -70,3 +68,6 @@ interface OSFamilies { @operationId("CloudServiceOperatingSystems_ListOSFamilies") listOSFamilies is ArmResourceListByParent; } + +@@path(OSFamily.name); +@@doc(OSFamily.name, "Name of the OS family."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/OSVersion.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/OSVersion.tsp index ea3c867394..eaca8826b1 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/OSVersion.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/OSVersion.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(SubscriptionLocationResource) @includeInapplicableMetadataInPayload(false) model OSVersion { - /** - * Name of the OS version. - */ - @path - @key("osVersionName") - @segment("cloudServiceOsVersions") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = OSVersion, + KeyName = "osVersionName", + SegmentName = "cloudServiceOsVersions", + NamePattern = "" + >; /** * Resource Id. @@ -70,3 +68,6 @@ interface OSVersions { @operationId("CloudServiceOperatingSystems_ListOSVersions") listOSVersions is ArmResourceListByParent; } + +@@path(OSVersion.name); +@@doc(OSVersion.name, "Name of the OS version."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/PrivateEndpointConnection.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/PrivateEndpointConnection.tsp index cfd4dc89d7..a7504a44b2 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/PrivateEndpointConnection.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/PrivateEndpointConnection.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(DiskAccess) @includeInapplicableMetadataInPayload(false) model PrivateEndpointConnection { - /** - * The name of the private endpoint connection. - */ - @path - @key("privateEndpointConnectionName") - @segment("privateEndpointConnections") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = PrivateEndpointConnection, + KeyName = "privateEndpointConnectionName", + SegmentName = "privateEndpointConnections", + NamePattern = "" + >; /** * private endpoint connection Id @@ -68,6 +66,9 @@ interface PrivateEndpointConnections { * Deletes a private endpoint connection under a disk access resource. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("DiskAccesses_DeleteAPrivateEndpointConnection") deleteAPrivateEndpointConnection is ArmResourceDeleteAsync; @@ -79,6 +80,10 @@ interface PrivateEndpointConnections { listPrivateEndpointConnections is ArmResourceListByParent; } +@@path(PrivateEndpointConnection.name); +@@doc(PrivateEndpointConnection.name, + "The name of the private endpoint connection." +); @@encodedName(PrivateEndpointConnections.updateAPrivateEndpointConnection::parameters.resource, "application/json", "privateEndpointConnection" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/ProximityPlacementGroup.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/ProximityPlacementGroup.tsp index 2d9450473a..5c6bb836bf 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/ProximityPlacementGroup.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/ProximityPlacementGroup.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model ProximityPlacementGroup extends Resource { - /** - * The name of the proximity placement group. - */ - @path - @key("proximityPlacementGroupName") - @segment("proximityPlacementGroups") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = ProximityPlacementGroup, + KeyName = "proximityPlacementGroupName", + SegmentName = "proximityPlacementGroups", + NamePattern = "" + >; /** * Specifies the Availability Zone where virtual machine, virtual machine scale set or availability set associated with the proximity placement group can be created. @@ -65,7 +63,7 @@ interface ProximityPlacementGroups { /** * Update a proximity placement group. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync< ProximityPlacementGroup, ProximityPlacementGroupUpdate @@ -74,6 +72,7 @@ interface ProximityPlacementGroups { /** * Delete a proximity placement group. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -89,6 +88,10 @@ interface ProximityPlacementGroups { listBySubscription is ArmListBySubscription; } +@@path(ProximityPlacementGroup.name); +@@doc(ProximityPlacementGroup.name, + "The name of the proximity placement group." +); @@encodedName(ProximityPlacementGroups.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RestorePoint.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RestorePoint.tsp index 9af5bc6a3e..af009ecd7a 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RestorePoint.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RestorePoint.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(RestorePointCollection) @includeInapplicableMetadataInPayload(false) model RestorePoint extends ProxyResource { - /** - * The name of the restore point. - */ - @path - @key("restorePointName") - @segment("restorePoints") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = RestorePoint, + KeyName = "restorePointName", + SegmentName = "restorePoints", + NamePattern = "" + >; /** * The restore point properties. @@ -79,6 +77,9 @@ interface RestorePoints { /** * The operation to delete the restore point. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync< RestorePoint, { @@ -93,6 +94,8 @@ interface RestorePoints { >; } +@@path(RestorePoint.name); +@@doc(RestorePoint.name, "The name of the restore point."); @@encodedName(RestorePoints.create::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RestorePointCollection.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RestorePointCollection.tsp index 5b37ad082a..24d0a79861 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RestorePointCollection.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RestorePointCollection.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model RestorePointCollection extends Resource { - /** - * The name of the restore point collection. - */ - @path - @key("restorePointCollectionName") - @segment("restorePointCollections") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = RestorePointCollection, + KeyName = "restorePointCollectionName", + SegmentName = "restorePointCollections", + NamePattern = "" + >; /** * The restore point collection properties. @@ -77,7 +75,7 @@ interface RestorePointCollections { /** * The operation to update the restore point collection. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync< RestorePointCollection, RestorePointCollectionUpdate, @@ -95,6 +93,9 @@ interface RestorePointCollections { /** * The operation to delete the restore point collection. This operation will also delete all the contained restore points. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync< RestorePointCollection, { @@ -121,6 +122,8 @@ interface RestorePointCollections { listAll is ArmListBySubscription; } +@@path(RestorePointCollection.name); +@@doc(RestorePointCollection.name, "The name of the restore point collection."); @@encodedName(RestorePointCollections.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RoleInstance.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RoleInstance.tsp index baa2e2523d..44ef73054b 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RoleInstance.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RoleInstance.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(CloudService) @includeInapplicableMetadataInPayload(false) model RoleInstance { - /** - * Name of the role instance. - */ - @path - @key("roleInstanceName") - @segment("roleInstances") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = RoleInstance, + KeyName = "roleInstanceName", + SegmentName = "roleInstances", + NamePattern = "" + >; /** * Resource Id @@ -50,6 +48,7 @@ model RoleInstance { /** * Resource tags. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read") tags?: Record; @@ -89,6 +88,9 @@ interface RoleInstances { * Deletes a role instance from a cloud service. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("CloudServiceRoleInstances_Delete") delete is ArmResourceDeleteAsync; @@ -193,3 +195,6 @@ interface RoleInstances { accept: "application/x-rdp", ): ArmResponse | ErrorResponse; } + +@@path(RoleInstance.name); +@@doc(RoleInstance.name, "Name of the role instance."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RollingUpgradeStatusInfo.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RollingUpgradeStatusInfo.tsp index 6609fab595..e3f60f05da 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RollingUpgradeStatusInfo.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/RollingUpgradeStatusInfo.tsp @@ -21,10 +21,12 @@ namespace Microsoft.Compute; @parentResource(VirtualMachineScaleSet) @includeInapplicableMetadataInPayload(false) model RollingUpgradeStatusInfo extends Resource { - @key("rollingUpgrade") - @segment("rollingUpgrades") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = RollingUpgradeStatusInfo, + KeyName = "rollingUpgrade", + SegmentName = "rollingUpgrades", + NamePattern = "" + >; /** * The status of the latest virtual machine scale set rolling upgrade. @@ -53,3 +55,5 @@ interface RollingUpgradeStatusInfos { } >; } + +@@doc(RollingUpgradeStatusInfo.name, ""); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SharedGallery.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SharedGallery.tsp index c535220ac5..6405c250e0 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SharedGallery.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SharedGallery.tsp @@ -21,14 +21,12 @@ namespace Microsoft.Compute; @parentResource(SubscriptionLocationResource) @includeInapplicableMetadataInPayload(false) model SharedGallery extends PirSharedGalleryResource { - /** - * The unique name of the Shared Gallery. - */ - @path - @key("galleryUniqueName") - @segment("sharedGalleries") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = SharedGallery, + KeyName = "galleryUniqueName", + SegmentName = "sharedGalleries", + NamePattern = "" + >; @extension("x-ms-client-flatten", true) @visibility("read,create") @@ -60,3 +58,6 @@ interface SharedGalleries { } >; } + +@@path(SharedGallery.name); +@@doc(SharedGallery.name, "The unique name of the Shared Gallery."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SharedGalleryImage.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SharedGalleryImage.tsp index ca0e7ee317..f5066b0ecb 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SharedGalleryImage.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SharedGalleryImage.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(SharedGallery) @includeInapplicableMetadataInPayload(false) model SharedGalleryImage extends PirSharedGalleryResource { - /** - * The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. - */ - @path - @key("galleryImageName") - @segment("images") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = SharedGalleryImage, + KeyName = "galleryImageName", + SegmentName = "images", + NamePattern = "" + >; /** * Describes the properties of a gallery image definition. @@ -61,3 +59,8 @@ interface SharedGalleryImages { } >; } + +@@path(SharedGalleryImage.name); +@@doc(SharedGalleryImage.name, + "The name of the Shared Gallery Image Definition from which the Image Versions are to be listed." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SharedGalleryImageVersion.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SharedGalleryImageVersion.tsp index 2697efa070..e16a9de68c 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SharedGalleryImageVersion.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SharedGalleryImageVersion.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(SharedGalleryImage) @includeInapplicableMetadataInPayload(false) model SharedGalleryImageVersion extends PirSharedGalleryResource { - /** - * The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: .. - */ - @path - @key("galleryImageVersionName") - @segment("versions") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = SharedGalleryImageVersion, + KeyName = "galleryImageVersionName", + SegmentName = "versions", + NamePattern = "" + >; /** * Describes the properties of a gallery image version. @@ -61,3 +59,8 @@ interface SharedGalleryImageVersions { } >; } + +@@path(SharedGalleryImageVersion.name); +@@doc(SharedGalleryImageVersion.name, + "The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: .." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Snapshot.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Snapshot.tsp index f6ff9d07c7..79783ff105 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Snapshot.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Snapshot.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model Snapshot extends Resource { - /** - * The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. - */ - @path - @key("snapshotName") - @segment("snapshots") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = Snapshot, + KeyName = "snapshotName", + SegmentName = "snapshots", + NamePattern = "" + >; /** * Unused. Always Null. @@ -65,12 +63,15 @@ interface Snapshots { /** * Updates (patches) a snapshot. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * Deletes a snapshot. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -96,6 +97,10 @@ interface Snapshots { revokeAccess is ArmResourceActionAsync; } +@@path(Snapshot.name); +@@doc(Snapshot.name, + "The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters." +); @@encodedName(Snapshots.createOrUpdate::parameters.resource, "application/json", "snapshot" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SshPublicKeyResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SshPublicKeyResource.tsp index 5f08ec3504..7c72c23d51 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SshPublicKeyResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/SshPublicKeyResource.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model SshPublicKeyResource extends Resource { - /** - * The name of the SSH public key. - */ - @path - @key("sshPublicKeyName") - @segment("sshPublicKeys") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = SshPublicKeyResource, + KeyName = "sshPublicKeyName", + SegmentName = "sshPublicKeys", + NamePattern = "" + >; /** * Properties of the SSH public key. @@ -54,7 +52,7 @@ interface SshPublicKeyResources { * Updates a new SSH public key resource. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("SshPublicKeys_Update") update is ArmCustomPatchSync< SshPublicKeyResource, @@ -65,6 +63,7 @@ interface SshPublicKeyResources { * Delete an SSH public key. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("SshPublicKeys_Delete") delete is ArmResourceDeleteSync; @@ -94,6 +93,8 @@ interface SshPublicKeyResources { >; } +@@path(SshPublicKeyResource.name); +@@doc(SshPublicKeyResource.name, "The name of the SSH public key."); @@encodedName(SshPublicKeyResources.create::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachine.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachine.tsp index 3d74286e6e..4e11f13d9f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachine.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachine.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model VirtualMachine extends Resource { - /** - * The name of the virtual machine. - */ - @path - @key("vmName") - @segment("virtualMachines") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = VirtualMachine, + KeyName = "vmName", + SegmentName = "virtualMachines", + NamePattern = "" + >; /** * Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. @@ -86,12 +84,15 @@ interface VirtualMachines { /** * The operation to update a virtual machine. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * The operation to delete a virtual machine. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync< VirtualMachine, { @@ -324,6 +325,8 @@ interface VirtualMachines { ): ArmResponse | ErrorResponse; } +@@path(VirtualMachine.name); +@@doc(VirtualMachine.name, "The name of the virtual machine."); @@encodedName(VirtualMachines.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineExtension.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineExtension.tsp index b7563ad163..3324903e23 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineExtension.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineExtension.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(VirtualMachine) @includeInapplicableMetadataInPayload(false) model VirtualMachineExtension extends ResourceWithOptionalLocation { - /** - * The name of the virtual machine extension. - */ - @path - @key("vmExtensionName") - @segment("extensions") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = VirtualMachineExtension, + KeyName = "vmExtensionName", + SegmentName = "extensions", + NamePattern = "" + >; /** * Describes the properties of a Virtual Machine Extension. @@ -62,7 +60,7 @@ interface VirtualMachineExtensions { /** * The operation to update the extension. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync< VirtualMachineExtension, VirtualMachineExtensionUpdate @@ -71,6 +69,9 @@ interface VirtualMachineExtensions { /** * The operation to delete the extension. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -92,6 +93,10 @@ interface VirtualMachineExtensions { >; } +@@path(VirtualMachineExtension.name); +@@doc(VirtualMachineExtension.name, + "The name of the virtual machine extension." +); @@encodedName(VirtualMachineExtensions.createOrUpdate::parameters.resource, "application/json", "extensionParameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineExtensionImage.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineExtensionImage.tsp index 22cca480ab..73389c7e9a 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineExtensionImage.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineExtensionImage.tsp @@ -20,11 +20,12 @@ namespace Microsoft.Compute; @parentResource(SubscriptionLocationResource) @includeInapplicableMetadataInPayload(false) model VirtualMachineExtensionImage extends Resource { - @path - @key("version") - @segment("versions") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = VirtualMachineExtensionImage, + KeyName = "version", + SegmentName = "versions", + NamePattern = "" + >; /** * Describes the properties of a Virtual Machine Extension Image. @@ -47,3 +48,6 @@ interface VirtualMachineExtensionImages { @operationId("VirtualMachineExtensionImages_ListTypes") listTypes is ArmResourceListByParent; } + +@@path(VirtualMachineExtensionImage.name); +@@doc(VirtualMachineExtensionImage.name, ""); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineRunCommand.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineRunCommand.tsp index 738ecf6bce..086d83270b 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineRunCommand.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineRunCommand.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(VirtualMachine) @includeInapplicableMetadataInPayload(false) model VirtualMachineRunCommand extends Resource { - /** - * The name of the virtual machine run command. - */ - @path - @key("runCommandName") - @segment("runCommands") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = VirtualMachineRunCommand, + KeyName = "runCommandName", + SegmentName = "runCommands", + NamePattern = "" + >; /** * Describes the properties of a Virtual Machine run command. @@ -62,7 +60,7 @@ interface VirtualMachineRunCommands { /** * The operation to update the run command. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync< VirtualMachineRunCommand, VirtualMachineRunCommandUpdate @@ -71,6 +69,9 @@ interface VirtualMachineRunCommands { /** * The operation to delete the run command. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -104,6 +105,10 @@ interface VirtualMachineRunCommands { >; } +@@path(VirtualMachineRunCommand.name); +@@doc(VirtualMachineRunCommand.name, + "The name of the virtual machine run command." +); @@encodedName(VirtualMachineRunCommands.createOrUpdate::parameters.resource, "application/json", "runCommand" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSet.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSet.tsp index 0b0ed92da1..0a14dd6224 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSet.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSet.tsp @@ -18,14 +18,12 @@ namespace Microsoft.Compute; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model VirtualMachineScaleSet extends Resource { - /** - * The name of the VM scale set. - */ - @path - @key("vmScaleSetName") - @segment("virtualMachineScaleSets") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = VirtualMachineScaleSet, + KeyName = "vmScaleSetName", + SegmentName = "virtualMachineScaleSets", + NamePattern = "" + >; /** * The virtual machine scale set sku. @@ -102,7 +100,7 @@ interface VirtualMachineScaleSets { /** * Update a VM scale set. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync< VirtualMachineScaleSet, VirtualMachineScaleSetUpdate, @@ -120,6 +118,9 @@ interface VirtualMachineScaleSets { /** * Deletes a VM scale set. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync< VirtualMachineScaleSet, { @@ -571,6 +572,8 @@ interface VirtualMachineScaleSets { ): ArmResponse | ErrorResponse; } +@@path(VirtualMachineScaleSet.name); +@@doc(VirtualMachineScaleSet.name, "The name of the VM scale set."); @@encodedName(VirtualMachineScaleSets.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetExtension.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetExtension.tsp index 1fbe282a7d..77322d0bb7 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetExtension.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetExtension.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(VirtualMachineScaleSet) @includeInapplicableMetadataInPayload(false) model VirtualMachineScaleSetExtension extends SubResourceReadOnly { - /** - * The name of the VM scale set extension. - */ - @path - @key("vmssExtensionName") - @segment("extensions") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = VirtualMachineScaleSetExtension, + KeyName = "vmssExtensionName", + SegmentName = "extensions", + NamePattern = "" + >; /** * Resource type @@ -85,7 +83,7 @@ interface VirtualMachineScaleSetExtensions { /** * The operation to update an extension. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync< VirtualMachineScaleSetExtension, VirtualMachineScaleSetExtensionUpdate, @@ -103,6 +101,9 @@ interface VirtualMachineScaleSetExtensions { /** * The operation to delete the extension. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync< VirtualMachineScaleSetExtension, { @@ -135,6 +136,10 @@ interface VirtualMachineScaleSetExtensions { >; } +@@path(VirtualMachineScaleSetExtension.name); +@@doc(VirtualMachineScaleSetExtension.name, + "The name of the VM scale set extension." +); @@encodedName(VirtualMachineScaleSetExtensions.createOrUpdate::parameters.resource, "application/json", "extensionParameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetVM.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetVM.tsp index 48e7e669de..311825d70a 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetVM.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetVM.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(VirtualMachineScaleSet) @includeInapplicableMetadataInPayload(false) model VirtualMachineScaleSetVM extends Resource { - /** - * The instance ID of the virtual machine. - */ - @path - @key("instanceId") - @segment("virtualMachines") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = VirtualMachineScaleSetVM, + KeyName = "instanceId", + SegmentName = "virtualMachines", + NamePattern = "" + >; /** * The virtual machine instance ID. @@ -118,6 +116,9 @@ interface VirtualMachineScaleSetVMS { * Deletes a virtual machine from a VM scale set. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("VirtualMachineScaleSetVMs_Delete") delete is ArmResourceDeleteAsync< VirtualMachineScaleSetVM, @@ -427,6 +428,8 @@ interface VirtualMachineScaleSetVMS { ): ArmResponse | ErrorResponse; } +@@path(VirtualMachineScaleSetVM.name); +@@doc(VirtualMachineScaleSetVM.name, "The instance ID of the virtual machine."); @@encodedName(VirtualMachineScaleSetVMS.update::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetVMExtension.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetVMExtension.tsp index 81a36cdc51..8dada9401e 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetVMExtension.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetVMExtension.tsp @@ -20,14 +20,12 @@ namespace Microsoft.Compute; @parentResource(VirtualMachineScaleSetVM) @includeInapplicableMetadataInPayload(false) model VirtualMachineScaleSetVMExtension extends SubResourceReadOnly { - /** - * The name of the virtual machine extension. - */ - @path - @key("vmExtensionName") - @segment("extensions") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = VirtualMachineScaleSetVMExtension, + KeyName = "vmExtensionName", + SegmentName = "extensions", + NamePattern = "" + >; /** * Resource type @@ -96,7 +94,7 @@ interface VirtualMachineScaleSetVMExtensions { * The operation to update the VMSS VM extension. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("VirtualMachineScaleSetVMExtensions_Update") update is ArmCustomPatchAsync< VirtualMachineScaleSetVMExtension, @@ -116,6 +114,9 @@ interface VirtualMachineScaleSetVMExtensions { * The operation to delete the VMSS VM extension. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("VirtualMachineScaleSetVMExtensions_Delete") delete is ArmResourceDeleteAsync< VirtualMachineScaleSetVMExtension, @@ -155,6 +156,10 @@ interface VirtualMachineScaleSetVMExtensions { >; } +@@path(VirtualMachineScaleSetVMExtension.name); +@@doc(VirtualMachineScaleSetVMExtension.name, + "The name of the virtual machine extension." +); @@encodedName(VirtualMachineScaleSetVMExtensions.createOrUpdate::parameters.resource, "application/json", "extensionParameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/models.tsp index 8f45dd5d75..f4276cffcb 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/models.tsp @@ -3315,6 +3315,7 @@ model ResourceWithOptionalLocation { /** * Resource tags */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -3403,6 +3404,7 @@ model VirtualMachineScaleSetIdentity { /** * The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" userAssignedIdentities?: Record; } @@ -3465,6 +3467,7 @@ model Resource { /** * Resource tags */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -3902,6 +3905,7 @@ model UpdateResource { /** * Resource tags */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -5407,6 +5411,7 @@ model VirtualMachineIdentity { /** * The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" userAssignedIdentities?: Record; } @@ -6395,6 +6400,7 @@ model VirtualMachineImageResource extends SubResource { /** * Specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; /** @@ -8280,6 +8286,7 @@ model DiskUpdate { /** * Resource tags */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; /** @@ -8519,6 +8526,7 @@ model DiskAccessUpdate { /** * Resource tags */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -8606,6 +8614,7 @@ model EncryptionSetIdentity { /** * The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" userAssignedIdentities?: Record; } @@ -8683,6 +8692,7 @@ model DiskEncryptionSetUpdate { /** * Resource tags */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; /** @@ -9013,6 +9023,7 @@ model SnapshotUpdate { /** * Resource tags */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; /** @@ -9534,6 +9545,7 @@ model UpdateResourceDefinition { /** * Resource tags */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -10282,6 +10294,7 @@ model GalleryApplicationVersionPublishingProfile /** * Optional. Additional settings to pass to the vm-application-manager extension. For advanced use only. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" advancedSettings?: Record; /** @@ -11159,6 +11172,7 @@ model CloudServiceUpdate { /** * Resource tags */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } diff --git a/packages/extensions/openapi-to-typespec/test/arm-dns/tsp-output/DnsRecord.tsp b/packages/extensions/openapi-to-typespec/test/arm-dns/tsp-output/DnsRecord.tsp index 4a636e7f40..e237430554 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-dns/tsp-output/DnsRecord.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-dns/tsp-output/DnsRecord.tsp @@ -20,14 +20,12 @@ namespace Azure.ResourceManager.Dns; @parentResource(DnsZone) @includeInapplicableMetadataInPayload(false) model DnsRecord { - /** - * The name of the record set, relative to the name of the zone. - */ - @path - @key("relativeRecordSetName") - @segment("A") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = DnsRecord, + KeyName = "relativeRecordSetName", + SegmentName = "A", + NamePattern = "" + >; /** * The ID of the record set. @@ -107,7 +105,7 @@ interface DnsRecords { * Updates a record set within a DNS zone. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("RecordSets_Update") update is ArmCustomPatchSync< DnsRecord, @@ -133,6 +131,7 @@ interface DnsRecords { * Deletes a record set from a DNS zone. This operation cannot be undone. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("RecordSets_Delete") delete is ArmResourceDeleteSync< DnsRecord, @@ -184,6 +183,10 @@ interface DnsRecords { >; } +@@path(DnsRecord.name); +@@doc(DnsRecord.name, + "The name of the record set, relative to the name of the zone." +); @@encodedName(DnsRecords.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-dns/tsp-output/DnsZone.tsp b/packages/extensions/openapi-to-typespec/test/arm-dns/tsp-output/DnsZone.tsp index fd036f7a42..2f1d4997d2 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-dns/tsp-output/DnsZone.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-dns/tsp-output/DnsZone.tsp @@ -18,14 +18,12 @@ namespace Azure.ResourceManager.Dns; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) model DnsZone extends Resource { - /** - * The name of the DNS zone (without a terminating dot). - */ - @path - @key("zoneName") - @segment("dnsZones") - @visibility("read") - name: string; + ...ResourceNameParameter< + Resource = DnsZone, + KeyName = "zoneName", + SegmentName = "dnsZones", + NamePattern = "" + >; /** * The etag of the zone. @@ -76,7 +74,7 @@ interface DnsZones { * Updates a DNS zone. Does not modify DNS records within the zone. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Zones_Update") update is ArmCustomPatchSync< DnsZone, @@ -96,6 +94,9 @@ interface DnsZones { * Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Zones_Delete") delete is ArmResourceDeleteAsync< DnsZone, @@ -169,6 +170,8 @@ interface DnsZones { ): ArmResponse> | ErrorResponse; } +@@path(DnsZone.name); +@@doc(DnsZone.name, "The name of the DNS zone (without a terminating dot)."); @@encodedName(DnsZones.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-dns/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-dns/tsp-output/models.tsp index d6dcbdbb1e..85502e8d80 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-dns/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-dns/tsp-output/models.tsp @@ -43,6 +43,7 @@ model RecordSetProperties { /** * The metadata attached to the record set. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" metadata?: Record; /** @@ -419,6 +420,7 @@ model Resource { /** * Resource tags. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -429,6 +431,7 @@ model ZoneUpdateOptions { /** * Resource tags. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/BatchDeploymentTrackedResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/BatchDeploymentTrackedResource.tsp index cd4804087d..ca8c97a237 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/BatchDeploymentTrackedResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/BatchDeploymentTrackedResource.tsp @@ -18,15 +18,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(BatchEndpointTrackedResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(BatchDeployment) -model BatchDeploymentTrackedResource extends TrackedResourceBase { - /** - * The identifier for the Batch deployments. - */ - @path - @key("deploymentName") - @segment("deployments") - @visibility("read") - name: string; +model BatchDeploymentTrackedResource extends Foundations.TrackedResource { + ...ResourceNameParameter< + Resource = BatchDeploymentTrackedResource, + KeyName = "deploymentName", + SegmentName = "deployments", + NamePattern = "" + >; /** * Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. @@ -39,8 +37,8 @@ model BatchDeploymentTrackedResource extends TrackedResourceBase { @extension("x-ms-client-flatten", true) properties: BatchDeployment; - ...Azure.ResourceManager.ManagedServiceIdentity; - ...Azure.ResourceManager.ResourceSku; + ...Azure.ResourceManager.ManagedServiceIdentityProperty; + ...Azure.ResourceManager.ResourceSkuProperty; } @armResourceOperations @@ -63,7 +61,7 @@ interface BatchDeploymentTrackedResources { * Update a batch inference deployment (asynchronous). */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("BatchDeployments_Update") update is ArmCustomPatchAsync< BatchDeploymentTrackedResource, @@ -74,6 +72,9 @@ interface BatchDeploymentTrackedResources { * Delete Batch Inference deployment (asynchronous). */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("BatchDeployments_Delete") delete is ArmResourceDeleteAsync; @@ -108,6 +109,10 @@ interface BatchDeploymentTrackedResources { >; } +@@path(BatchDeploymentTrackedResource.name); +@@doc(BatchDeploymentTrackedResource.name, + "The identifier for the Batch deployments." +); @@encodedName(BatchDeploymentTrackedResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/BatchEndpointTrackedResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/BatchEndpointTrackedResource.tsp index 0062533304..e3771b85d6 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/BatchEndpointTrackedResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/BatchEndpointTrackedResource.tsp @@ -18,15 +18,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(Workspace) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(BatchEndpoint) -model BatchEndpointTrackedResource extends TrackedResourceBase { - /** - * Name for the Batch Endpoint. - */ - @path - @key("endpointName") - @segment("batchEndpoints") - @visibility("read") - name: string; +model BatchEndpointTrackedResource extends Foundations.TrackedResource { + ...ResourceNameParameter< + Resource = BatchEndpointTrackedResource, + KeyName = "endpointName", + SegmentName = "batchEndpoints", + NamePattern = "" + >; /** * Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. @@ -39,8 +37,8 @@ model BatchEndpointTrackedResource extends TrackedResourceBase { @extension("x-ms-client-flatten", true) properties: BatchEndpoint; - ...Azure.ResourceManager.ManagedServiceIdentity; - ...Azure.ResourceManager.ResourceSku; + ...Azure.ResourceManager.ManagedServiceIdentityProperty; + ...Azure.ResourceManager.ResourceSkuProperty; } @armResourceOperations @@ -63,7 +61,7 @@ interface BatchEndpointTrackedResources { * Update a batch inference endpoint (asynchronous). */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("BatchEndpoints_Update") update is ArmCustomPatchAsync< BatchEndpointTrackedResource, @@ -74,6 +72,9 @@ interface BatchEndpointTrackedResources { * Delete Batch Inference Endpoint (asynchronous). */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("BatchEndpoints_Delete") delete is ArmResourceDeleteAsync; @@ -113,6 +114,8 @@ interface BatchEndpointTrackedResources { >; } +@@path(BatchEndpointTrackedResource.name); +@@doc(BatchEndpointTrackedResource.name, "Name for the Batch Endpoint."); @@encodedName(BatchEndpointTrackedResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/CodeContainerResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/CodeContainerResource.tsp index 2e5622b9bd..e24c1ed757 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/CodeContainerResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/CodeContainerResource.tsp @@ -20,16 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(Registry) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(CodeContainer) -model CodeContainerResource extends ProxyResourceBase { - /** - * Container name. - */ - @pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$") - @path - @key("codeName") - @segment("codes") - @visibility("read") - name: string; +model CodeContainerResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = CodeContainerResource, + KeyName = "codeName", + SegmentName = "codes", + NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$" + >; /** * [Required] Additional attributes of the entity. @@ -58,6 +55,9 @@ interface CodeContainerResources { * Delete Code container. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("RegistryCodeContainers_Delete") delete is ArmResourceDeleteAsync; @@ -80,6 +80,8 @@ interface CodeContainerResources { >; } +@@path(CodeContainerResource.name); +@@doc(CodeContainerResource.name, "Container name."); @@encodedName(CodeContainerResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/CodeVersionResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/CodeVersionResource.tsp index f94d7d5c87..f077343dde 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/CodeVersionResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/CodeVersionResource.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(CodeContainerResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(CodeVersion) -model CodeVersionResource extends ProxyResourceBase { - /** - * Version identifier. - */ - @path - @key("version") - @segment("versions") - @visibility("read") - name: string; +model CodeVersionResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = CodeVersionResource, + KeyName = "version", + SegmentName = "versions", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -57,6 +55,9 @@ interface CodeVersionResources { * Delete version. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("RegistryCodeVersions_Delete") delete is ArmResourceDeleteAsync; @@ -102,6 +103,8 @@ interface CodeVersionResources { >; } +@@path(CodeVersionResource.name); +@@doc(CodeVersionResource.name, "Version identifier."); @@encodedName(CodeVersionResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ComponentContainerResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ComponentContainerResource.tsp index 0fca7360a7..e178e6cad6 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ComponentContainerResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ComponentContainerResource.tsp @@ -20,16 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(Registry) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(ComponentContainer) -model ComponentContainerResource extends ProxyResourceBase { - /** - * Container name. - */ - @pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$") - @path - @key("componentName") - @segment("components") - @visibility("read") - name: string; +model ComponentContainerResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = ComponentContainerResource, + KeyName = "componentName", + SegmentName = "components", + NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$" + >; /** * [Required] Additional attributes of the entity. @@ -58,6 +55,9 @@ interface ComponentContainerResources { * Delete container. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("RegistryComponentContainers_Delete") delete is ArmResourceDeleteAsync; @@ -80,6 +80,8 @@ interface ComponentContainerResources { >; } +@@path(ComponentContainerResource.name); +@@doc(ComponentContainerResource.name, "Container name."); @@encodedName(ComponentContainerResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ComponentVersionResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ComponentVersionResource.tsp index 8d1fcf6a77..7108a0dc69 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ComponentVersionResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ComponentVersionResource.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(ComponentContainerResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(ComponentVersion) -model ComponentVersionResource extends ProxyResourceBase { - /** - * Version identifier. - */ - @path - @key("version") - @segment("versions") - @visibility("read") - name: string; +model ComponentVersionResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = ComponentVersionResource, + KeyName = "version", + SegmentName = "versions", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -57,6 +55,9 @@ interface ComponentVersionResources { * Delete version. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("RegistryComponentVersions_Delete") delete is ArmResourceDeleteAsync; @@ -97,6 +98,8 @@ interface ComponentVersionResources { >; } +@@path(ComponentVersionResource.name); +@@doc(ComponentVersionResource.name, "Version identifier."); @@encodedName(ComponentVersionResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ComputeResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ComputeResource.tsp index 9080809e2f..9a9b3b76f3 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ComputeResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ComputeResource.tsp @@ -17,18 +17,15 @@ namespace Azure.ResourceManager.MachineLearning; * Machine Learning compute object wrapped into ARM resource envelope. */ @parentResource(Workspace) -model ComputeResource is TrackedResource<{}> { - /** - * Name of the Azure Machine Learning compute. - */ - @path - @key("computeName") - @segment("computes") - @visibility("read") - name: string; - - ...Azure.ResourceManager.ManagedServiceIdentity; - ...Azure.ResourceManager.ResourceSku; +model ComputeResource is Azure.ResourceManager.TrackedResource<{}> { + ...ResourceNameParameter< + Resource = ComputeResource, + KeyName = "computeName", + SegmentName = "computes", + NamePattern = "" + >; + ...Azure.ResourceManager.ManagedServiceIdentityProperty; + ...Azure.ResourceManager.ResourceSkuProperty; } @armResourceOperations @@ -51,7 +48,7 @@ interface ComputeResources { * Updates properties of a compute. This call will overwrite a compute if it exists. This is a nonrecoverable operation. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Compute_Update") update is ArmCustomPatchAsync; @@ -59,6 +56,9 @@ interface ComputeResources { * Deletes specified Machine Learning compute. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Compute_Delete") delete is ArmResourceDeleteAsync< ComputeResource, @@ -153,6 +153,8 @@ interface ComputeResources { >; } +@@path(ComputeResource.name); +@@doc(ComputeResource.name, "Name of the Azure Machine Learning compute."); @@encodedName(ComputeResources.createOrUpdate::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/DataContainerResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/DataContainerResource.tsp index b10fb1efcd..e90d0c80da 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/DataContainerResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/DataContainerResource.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(Registry) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(DataContainer) -model DataContainerResource extends ProxyResourceBase { - /** - * Container name. - */ - @path - @key("name") - @segment("data") - @visibility("read") - name: string; +model DataContainerResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = DataContainerResource, + KeyName = "name", + SegmentName = "data", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -57,6 +55,9 @@ interface DataContainerResources { * Delete container. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("RegistryDataContainers_Delete") delete is ArmResourceDeleteAsync; @@ -85,6 +86,8 @@ interface DataContainerResources { >; } +@@path(DataContainerResource.name); +@@doc(DataContainerResource.name, "Container name."); @@encodedName(DataContainerResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/DataVersionBaseResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/DataVersionBaseResource.tsp index 65eebff6b1..ffb2970b58 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/DataVersionBaseResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/DataVersionBaseResource.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(DataContainerResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(DataVersionBase) -model DataVersionBaseResource extends ProxyResourceBase { - /** - * Version identifier. - */ - @path - @key("version") - @segment("versions") - @visibility("read") - name: string; +model DataVersionBaseResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = DataVersionBaseResource, + KeyName = "version", + SegmentName = "versions", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -57,6 +55,9 @@ interface DataVersionBaseResources { * Delete version. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("RegistryDataVersions_Delete") delete is ArmResourceDeleteAsync; @@ -115,6 +116,8 @@ interface DataVersionBaseResources { >; } +@@path(DataVersionBaseResource.name); +@@doc(DataVersionBaseResource.name, "Version identifier."); @@encodedName(DataVersionBaseResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/DatastoreResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/DatastoreResource.tsp index 6a3cd5698e..40321a7100 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/DatastoreResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/DatastoreResource.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(Workspace) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(Datastore) -model DatastoreResource extends ProxyResourceBase { - /** - * Datastore name. - */ - @path - @key("name") - @segment("datastores") - @visibility("read") - name: string; +model DatastoreResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = DatastoreResource, + KeyName = "name", + SegmentName = "datastores", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -68,6 +66,7 @@ interface DatastoreResources { * Delete datastore. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Datastores_Delete") delete is ArmResourceDeleteSync; @@ -140,6 +139,8 @@ interface DatastoreResources { >; } +@@path(DatastoreResource.name); +@@doc(DatastoreResource.name, "Datastore name."); @@encodedName(DatastoreResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/EnvironmentContainerResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/EnvironmentContainerResource.tsp index bcaaa3e8a5..fdbc8d11cf 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/EnvironmentContainerResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/EnvironmentContainerResource.tsp @@ -20,16 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(Registry) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(EnvironmentContainer) -model EnvironmentContainerResource extends ProxyResourceBase { - /** - * Container name. This is case-sensitive. - */ - @pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$") - @path - @key("environmentName") - @segment("environments") - @visibility("read") - name: string; +model EnvironmentContainerResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = EnvironmentContainerResource, + KeyName = "environmentName", + SegmentName = "environments", + NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$" + >; /** * [Required] Additional attributes of the entity. @@ -58,6 +55,9 @@ interface EnvironmentContainerResources { * Delete container. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("RegistryEnvironmentContainers_Delete") delete is ArmResourceDeleteAsync; @@ -86,6 +86,10 @@ interface EnvironmentContainerResources { >; } +@@path(EnvironmentContainerResource.name); +@@doc(EnvironmentContainerResource.name, + "Container name. This is case-sensitive." +); @@encodedName(EnvironmentContainerResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/EnvironmentVersionResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/EnvironmentVersionResource.tsp index 22e5c2d923..95d50f945f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/EnvironmentVersionResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/EnvironmentVersionResource.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(EnvironmentContainerResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(EnvironmentVersion) -model EnvironmentVersionResource extends ProxyResourceBase { - /** - * Version identifier. This is case-sensitive. - */ - @path - @key("version") - @segment("versions") - @visibility("read") - name: string; +model EnvironmentVersionResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = EnvironmentVersionResource, + KeyName = "version", + SegmentName = "versions", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -57,6 +55,9 @@ interface EnvironmentVersionResources { * Delete version. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("RegistryEnvironmentVersions_Delete") delete is ArmResourceDeleteAsync; @@ -103,6 +104,10 @@ interface EnvironmentVersionResources { >; } +@@path(EnvironmentVersionResource.name); +@@doc(EnvironmentVersionResource.name, + "Version identifier. This is case-sensitive." +); @@encodedName(EnvironmentVersionResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Feature.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Feature.tsp index d7ee11e46c..9ec1853775 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Feature.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Feature.tsp @@ -20,16 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(FeaturesetVersion) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(FeatureProperties) -model Feature extends ProxyResourceBase { - /** - * Feature Name. This is case-sensitive. - */ - @pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$") - @path - @key("featureName") - @segment("features") - @visibility("read") - name: string; +model Feature extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = Feature, + KeyName = "featureName", + SegmentName = "features", + NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$" + >; /** * [Required] Additional attributes of the entity. @@ -75,3 +72,6 @@ interface Features { } >; } + +@@path(Feature.name); +@@doc(Feature.name, "Feature Name. This is case-sensitive."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturesetContainer.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturesetContainer.tsp index c7b53deaed..e1338237f3 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturesetContainer.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturesetContainer.tsp @@ -22,15 +22,13 @@ namespace Azure.ResourceManager.MachineLearning; @Azure.ResourceManager.Private.armResourceInternal( FeaturesetContainerProperties ) -model FeaturesetContainer extends ProxyResourceBase { - /** - * Container name. This is case-sensitive. - */ - @path - @key("name") - @segment("featuresets") - @visibility("read") - name: string; +model FeaturesetContainer extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = FeaturesetContainer, + KeyName = "name", + SegmentName = "featuresets", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -54,6 +52,9 @@ interface FeaturesetContainers { /** * Delete container. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -105,6 +106,8 @@ interface FeaturesetContainers { >; } +@@path(FeaturesetContainer.name); +@@doc(FeaturesetContainer.name, "Container name. This is case-sensitive."); @@encodedName(FeaturesetContainers.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturesetVersion.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturesetVersion.tsp index 3adfa7f44e..150086492c 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturesetVersion.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturesetVersion.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(FeaturesetContainer) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(FeaturesetVersionProperties) -model FeaturesetVersion extends ProxyResourceBase { - /** - * Version identifier. This is case-sensitive. - */ - @path - @key("version") - @segment("versions") - @visibility("read") - name: string; +model FeaturesetVersion extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = FeaturesetVersion, + KeyName = "version", + SegmentName = "versions", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -52,6 +50,9 @@ interface FeaturesetVersions { /** * Delete version. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -160,6 +161,8 @@ interface FeaturesetVersions { >; } +@@path(FeaturesetVersion.name); +@@doc(FeaturesetVersion.name, "Version identifier. This is case-sensitive."); @@encodedName(FeaturesetVersions.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturestoreEntityContainer.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturestoreEntityContainer.tsp index 4711c1e9a3..b9d41b02af 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturestoreEntityContainer.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturestoreEntityContainer.tsp @@ -22,15 +22,13 @@ namespace Azure.ResourceManager.MachineLearning; @Azure.ResourceManager.Private.armResourceInternal( FeaturestoreEntityContainerProperties ) -model FeaturestoreEntityContainer extends ProxyResourceBase { - /** - * Container name. This is case-sensitive. - */ - @path - @key("name") - @segment("featurestoreEntities") - @visibility("read") - name: string; +model FeaturestoreEntityContainer extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = FeaturestoreEntityContainer, + KeyName = "name", + SegmentName = "featurestoreEntities", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -54,6 +52,9 @@ interface FeaturestoreEntityContainers { /** * Delete container. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -105,6 +106,10 @@ interface FeaturestoreEntityContainers { >; } +@@path(FeaturestoreEntityContainer.name); +@@doc(FeaturestoreEntityContainer.name, + "Container name. This is case-sensitive." +); @@encodedName(FeaturestoreEntityContainers.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturestoreEntityVersion.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturestoreEntityVersion.tsp index 9984935b9e..4851f00b64 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturestoreEntityVersion.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/FeaturestoreEntityVersion.tsp @@ -22,15 +22,13 @@ namespace Azure.ResourceManager.MachineLearning; @Azure.ResourceManager.Private.armResourceInternal( FeaturestoreEntityVersionProperties ) -model FeaturestoreEntityVersion extends ProxyResourceBase { - /** - * Version identifier. This is case-sensitive. - */ - @path - @key("version") - @segment("versions") - @visibility("read") - name: string; +model FeaturestoreEntityVersion extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = FeaturestoreEntityVersion, + KeyName = "version", + SegmentName = "versions", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -54,6 +52,9 @@ interface FeaturestoreEntityVersions { /** * Delete version. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -117,6 +118,10 @@ interface FeaturestoreEntityVersions { >; } +@@path(FeaturestoreEntityVersion.name); +@@doc(FeaturestoreEntityVersion.name, + "Version identifier. This is case-sensitive." +); @@encodedName(FeaturestoreEntityVersions.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/JobBaseResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/JobBaseResource.tsp index 5e13955d19..42f5e4aa40 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/JobBaseResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/JobBaseResource.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(Workspace) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(JobBase) -model JobBaseResource extends ProxyResourceBase { - /** - * The name and identifier for the Job. This is case-sensitive. - */ - @path - @key("id") - @segment("jobs") - @visibility("read") - name: string; +model JobBaseResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = JobBaseResource, + KeyName = "id", + SegmentName = "jobs", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -57,7 +55,7 @@ interface JobBaseResources { * Updates a Job. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Jobs_Update") update is ArmCustomPatchSync; @@ -65,6 +63,9 @@ interface JobBaseResources { * Deletes a Job (asynchronous). */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Jobs_Delete") delete is ArmResourceDeleteAsync; @@ -130,6 +131,10 @@ interface JobBaseResources { cancel is ArmResourceActionAsync; } +@@path(JobBaseResource.name); +@@doc(JobBaseResource.name, + "The name and identifier for the Job. This is case-sensitive." +); @@encodedName(JobBaseResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/LabelingJob.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/LabelingJob.tsp index 8958db8212..bfe652545a 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/LabelingJob.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/LabelingJob.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(Workspace) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(LabelingJobProperties) -model LabelingJob extends ProxyResourceBase { - /** - * The name and identifier for the LabelingJob. - */ - @path - @key("id") - @segment("labelingJobs") - @visibility("read") - name: string; +model LabelingJob extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = LabelingJob, + KeyName = "id", + SegmentName = "labelingJobs", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -69,6 +67,7 @@ interface LabelingJobs { /** * Delete a labeling job. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -115,6 +114,8 @@ interface LabelingJobs { resume is ArmResourceActionAsync; } +@@path(LabelingJob.name); +@@doc(LabelingJob.name, "The name and identifier for the LabelingJob."); @@encodedName(LabelingJobs.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ModelContainerResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ModelContainerResource.tsp index 12c30ea115..b982ab527c 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ModelContainerResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ModelContainerResource.tsp @@ -20,16 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(Registry) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(ModelContainer) -model ModelContainerResource extends ProxyResourceBase { - /** - * Container name. This is case-sensitive. - */ - @pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$") - @path - @key("modelName") - @segment("models") - @visibility("read") - name: string; +model ModelContainerResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = ModelContainerResource, + KeyName = "modelName", + SegmentName = "models", + NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$" + >; /** * [Required] Additional attributes of the entity. @@ -58,6 +55,9 @@ interface ModelContainerResources { * Delete container. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("RegistryModelContainers_Delete") delete is ArmResourceDeleteAsync; @@ -86,6 +86,8 @@ interface ModelContainerResources { >; } +@@path(ModelContainerResource.name); +@@doc(ModelContainerResource.name, "Container name. This is case-sensitive."); @@encodedName(ModelContainerResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ModelVersionResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ModelVersionResource.tsp index ef3c1aefc7..dde8e7264a 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ModelVersionResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/ModelVersionResource.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(ModelContainerResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(ModelVersion) -model ModelVersionResource extends ProxyResourceBase { - /** - * Version identifier. This is case-sensitive. - */ - @path - @key("version") - @segment("versions") - @visibility("read") - name: string; +model ModelVersionResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = ModelVersionResource, + KeyName = "version", + SegmentName = "versions", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -57,6 +55,9 @@ interface ModelVersionResources { * Delete version. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("RegistryModelVersions_Delete") delete is ArmResourceDeleteAsync; @@ -137,6 +138,8 @@ interface ModelVersionResources { >; } +@@path(ModelVersionResource.name); +@@doc(ModelVersionResource.name, "Version identifier. This is case-sensitive."); @@encodedName(ModelVersionResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/OnlineDeploymentTrackedResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/OnlineDeploymentTrackedResource.tsp index 01a6f4e0f9..14dd95abf4 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/OnlineDeploymentTrackedResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/OnlineDeploymentTrackedResource.tsp @@ -18,15 +18,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(OnlineEndpointTrackedResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(OnlineDeployment) -model OnlineDeploymentTrackedResource extends TrackedResourceBase { - /** - * Inference Endpoint Deployment name. - */ - @path - @key("deploymentName") - @segment("deployments") - @visibility("read") - name: string; +model OnlineDeploymentTrackedResource extends Foundations.TrackedResource { + ...ResourceNameParameter< + Resource = OnlineDeploymentTrackedResource, + KeyName = "deploymentName", + SegmentName = "deployments", + NamePattern = "" + >; /** * Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. @@ -39,8 +37,8 @@ model OnlineDeploymentTrackedResource extends TrackedResourceBase { @extension("x-ms-client-flatten", true) properties: OnlineDeployment; - ...Azure.ResourceManager.ManagedServiceIdentity; - ...Azure.ResourceManager.ResourceSku; + ...Azure.ResourceManager.ManagedServiceIdentityProperty; + ...Azure.ResourceManager.ResourceSkuProperty; } @armResourceOperations @@ -63,7 +61,7 @@ interface OnlineDeploymentTrackedResources { * Update Online Deployment (asynchronous). */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("OnlineDeployments_Update") update is ArmCustomPatchAsync< OnlineDeploymentTrackedResource, @@ -74,6 +72,9 @@ interface OnlineDeploymentTrackedResources { * Delete Inference Endpoint Deployment (asynchronous). */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("OnlineDeployments_Delete") delete is ArmResourceDeleteAsync; @@ -165,6 +166,10 @@ interface OnlineDeploymentTrackedResources { ): ArmResponse | ErrorResponse; } +@@path(OnlineDeploymentTrackedResource.name); +@@doc(OnlineDeploymentTrackedResource.name, + "Inference Endpoint Deployment name." +); @@encodedName(OnlineDeploymentTrackedResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/OnlineEndpointTrackedResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/OnlineEndpointTrackedResource.tsp index 8050a474a3..798f2fdca3 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/OnlineEndpointTrackedResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/OnlineEndpointTrackedResource.tsp @@ -18,15 +18,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(Workspace) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(OnlineEndpoint) -model OnlineEndpointTrackedResource extends TrackedResourceBase { - /** - * Online Endpoint name. - */ - @path - @key("endpointName") - @segment("onlineEndpoints") - @visibility("read") - name: string; +model OnlineEndpointTrackedResource extends Foundations.TrackedResource { + ...ResourceNameParameter< + Resource = OnlineEndpointTrackedResource, + KeyName = "endpointName", + SegmentName = "onlineEndpoints", + NamePattern = "" + >; /** * Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. @@ -39,8 +37,8 @@ model OnlineEndpointTrackedResource extends TrackedResourceBase { @extension("x-ms-client-flatten", true) properties: OnlineEndpoint; - ...Azure.ResourceManager.ManagedServiceIdentity; - ...Azure.ResourceManager.ResourceSku; + ...Azure.ResourceManager.ManagedServiceIdentityProperty; + ...Azure.ResourceManager.ResourceSkuProperty; } @armResourceOperations @@ -63,7 +61,7 @@ interface OnlineEndpointTrackedResources { * Update Online Endpoint (asynchronous). */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("OnlineEndpoints_Update") update is ArmCustomPatchAsync< OnlineEndpointTrackedResource, @@ -74,6 +72,9 @@ interface OnlineEndpointTrackedResources { * Delete Online Endpoint (asynchronous). */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("OnlineEndpoints_Delete") delete is ArmResourceDeleteAsync; @@ -165,6 +166,8 @@ interface OnlineEndpointTrackedResources { >; } +@@path(OnlineEndpointTrackedResource.name); +@@doc(OnlineEndpointTrackedResource.name, "Online Endpoint name."); @@encodedName(OnlineEndpointTrackedResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/OutboundRuleBasicResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/OutboundRuleBasicResource.tsp index c85f93ed8c..14d4d13db3 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/OutboundRuleBasicResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/OutboundRuleBasicResource.tsp @@ -20,16 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(Workspace) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(OutboundRule) -model OutboundRuleBasicResource extends ProxyResourceBase { - /** - * Name of the workspace managed network outbound rule - */ - @pattern("^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$") - @path - @key("ruleName") - @segment("outboundRules") - @visibility("read") - name: string; +model OutboundRuleBasicResource extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = OutboundRuleBasicResource, + KeyName = "ruleName", + SegmentName = "outboundRules", + NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + >; /** * Outbound Rule for the managed network of a machine learning workspace. @@ -58,6 +55,9 @@ interface OutboundRuleBasicResources { * Deletes an outbound rule from the managed network of a machine learning workspace. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("ManagedNetworkSettingsRule_Delete") delete is ArmResourceDeleteAsync; @@ -69,6 +69,10 @@ interface OutboundRuleBasicResources { list is ArmResourceListByParent; } +@@path(OutboundRuleBasicResource.name); +@@doc(OutboundRuleBasicResource.name, + "Name of the workspace managed network outbound rule" +); @@encodedName(OutboundRuleBasicResources.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/PrivateEndpointConnection.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/PrivateEndpointConnection.tsp index 4545051a44..ca6570e367 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/PrivateEndpointConnection.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/PrivateEndpointConnection.tsp @@ -22,15 +22,13 @@ namespace Azure.ResourceManager.MachineLearning; @Azure.ResourceManager.Private.armResourceInternal( PrivateEndpointConnectionProperties ) -model PrivateEndpointConnection extends TrackedResourceBase { - /** - * NRP Private Endpoint Connection Name - */ - @path - @key("privateEndpointConnectionName") - @segment("privateEndpointConnections") - @visibility("read") - name: string; +model PrivateEndpointConnection extends Foundations.TrackedResource { + ...ResourceNameParameter< + Resource = PrivateEndpointConnection, + KeyName = "privateEndpointConnectionName", + SegmentName = "privateEndpointConnections", + NamePattern = "" + >; /** * Private endpoint connection properties. @@ -38,8 +36,8 @@ model PrivateEndpointConnection extends TrackedResourceBase { @extension("x-ms-client-flatten", true) properties?: PrivateEndpointConnectionProperties; - ...Azure.ResourceManager.ManagedServiceIdentity; - ...Azure.ResourceManager.ResourceSku; + ...Azure.ResourceManager.ManagedServiceIdentityProperty; + ...Azure.ResourceManager.ResourceSkuProperty; } @armResourceOperations @@ -58,6 +56,7 @@ interface PrivateEndpointConnections { /** * Called by end-users to delete a PE connection. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -68,6 +67,8 @@ interface PrivateEndpointConnections { list is ArmResourceListByParent; } +@@path(PrivateEndpointConnection.name); +@@doc(PrivateEndpointConnection.name, "NRP Private Endpoint Connection Name"); @@encodedName(PrivateEndpointConnections.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Registry.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Registry.tsp index 9fbbfede52..0effea955f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Registry.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Registry.tsp @@ -16,16 +16,13 @@ namespace Azure.ResourceManager.MachineLearning; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(RegistryProperties) -model Registry extends TrackedResourceBase { - /** - * Name of Azure Machine Learning registry. This is case-insensitive - */ - @pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{2,32}$") - @path - @key("registryName") - @segment("registries") - @visibility("read") - name: string; +model Registry extends Foundations.TrackedResource { + ...ResourceNameParameter< + Resource = Registry, + KeyName = "registryName", + SegmentName = "registries", + NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{2,32}$" + >; /** * Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. @@ -38,8 +35,8 @@ model Registry extends TrackedResourceBase { @extension("x-ms-client-flatten", true) properties: RegistryProperties; - ...Azure.ResourceManager.ManagedServiceIdentity; - ...Azure.ResourceManager.ResourceSku; + ...Azure.ResourceManager.ManagedServiceIdentityProperty; + ...Azure.ResourceManager.ResourceSkuProperty; } @armResourceOperations @@ -57,12 +54,15 @@ interface Registries { /** * Update tags */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** * Delete registry */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -83,6 +83,10 @@ interface Registries { removeRegions is ArmResourceActionAsync; } +@@path(Registry.name); +@@doc(Registry.name, + "Name of Azure Machine Learning registry. This is case-insensitive" +); @@encodedName(Registries.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Schedule.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Schedule.tsp index bd69d98373..d3765978c8 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Schedule.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Schedule.tsp @@ -20,15 +20,13 @@ namespace Azure.ResourceManager.MachineLearning; @parentResource(Workspace) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(ScheduleProperties) -model Schedule extends ProxyResourceBase { - /** - * Schedule name. - */ - @path - @key("name") - @segment("schedules") - @visibility("read") - name: string; +model Schedule extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = Schedule, + KeyName = "name", + SegmentName = "schedules", + NamePattern = "" + >; /** * [Required] Additional attributes of the entity. @@ -52,6 +50,9 @@ interface Schedules { /** * Delete schedule. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync; /** @@ -79,6 +80,8 @@ interface Schedules { >; } +@@path(Schedule.name); +@@doc(Schedule.name, "Schedule name."); @@encodedName(Schedules.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Workspace.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Workspace.tsp index 7f56f861af..a53a0fa34d 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Workspace.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/Workspace.tsp @@ -18,17 +18,13 @@ namespace Azure.ResourceManager.MachineLearning; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(WorkspaceProperties) -model Workspace extends TrackedResourceBase { - /** - * Name of Azure Machine Learning workspace. - */ - @pattern("^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$") - @path - @key("workspaceName") - @segment("workspaces") - @visibility("read") - name: string; - +model Workspace extends Foundations.TrackedResource { + ...ResourceNameParameter< + Resource = Workspace, + KeyName = "workspaceName", + SegmentName = "workspaces", + NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + >; kind?: string; /** @@ -37,8 +33,8 @@ model Workspace extends TrackedResourceBase { @extension("x-ms-client-flatten", true) properties: WorkspaceProperties; - ...Azure.ResourceManager.ManagedServiceIdentity; - ...Azure.ResourceManager.ResourceSku; + ...Azure.ResourceManager.ManagedServiceIdentityProperty; + ...Azure.ResourceManager.ResourceSkuProperty; } @armResourceOperations @@ -56,12 +52,15 @@ interface Workspaces { /** * Updates a machine learning workspace with the specified parameters. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** * Deletes a machine learning workspace. */ + #suppress "deprecated" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteAsync< Workspace, { @@ -244,6 +243,8 @@ Defined in the "[NRP] Private Endpoint Design" doc, topic "GET API for GroupIds" ): ArmResponse | ErrorResponse; } +@@path(Workspace.name); +@@doc(Workspace.name, "Name of Azure Machine Learning workspace."); @@encodedName(Workspaces.createOrUpdate::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/WorkspaceConnectionPropertiesV2BasicResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/WorkspaceConnectionPropertiesV2BasicResource.tsp index b36bfd0758..9a38a00c55 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/WorkspaceConnectionPropertiesV2BasicResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/WorkspaceConnectionPropertiesV2BasicResource.tsp @@ -20,16 +20,14 @@ namespace Azure.ResourceManager.MachineLearning; @Azure.ResourceManager.Private.armResourceInternal( WorkspaceConnectionPropertiesV2 ) -model WorkspaceConnectionPropertiesV2BasicResource extends ProxyResourceBase { - /** - * Friendly name of the workspace connection - */ - @pattern("^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$") - @path - @key("connectionName") - @segment("connections") - @visibility("read") - name: string; +model WorkspaceConnectionPropertiesV2BasicResource + extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = WorkspaceConnectionPropertiesV2BasicResource, + KeyName = "connectionName", + SegmentName = "connections", + NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + >; @extension("x-ms-client-flatten", true) properties: WorkspaceConnectionPropertiesV2; @@ -55,7 +53,7 @@ interface WorkspaceConnectionPropertiesV2BasicResources { * Update machine learning workspaces connections under the specified workspace. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("WorkspaceConnections_Update") update is ArmCustomPatchSync< WorkspaceConnectionPropertiesV2BasicResource, @@ -66,6 +64,7 @@ interface WorkspaceConnectionPropertiesV2BasicResources { * Delete machine learning workspaces connections by name. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("WorkspaceConnections_Delete") delete is ArmResourceDeleteSync; @@ -105,6 +104,10 @@ interface WorkspaceConnectionPropertiesV2BasicResources { >; } +@@path(WorkspaceConnectionPropertiesV2BasicResource.name); +@@doc(WorkspaceConnectionPropertiesV2BasicResource.name, + "Friendly name of the workspace connection" +); @@encodedName(WorkspaceConnectionPropertiesV2BasicResources.create::parameters.resource, "application/json", "body" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/models.tsp index 1495cb5198..e2f2a6cc79 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/models.tsp @@ -3122,7 +3122,9 @@ model ScaleSettings { /** * Specifies the custom service configuration */ -model CustomService extends Record { +model CustomService { + ...Record; + /** * Name of the Custom Service */ @@ -3136,6 +3138,7 @@ model CustomService extends Record { /** * Environment Variable for the container */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" environmentVariables?: Record; /** @@ -3154,7 +3157,9 @@ model CustomService extends Record { volumes?: VolumeDefinition[]; } -model Image extends Record { +model Image { + ...Record; + /** * Type of the image. Possible values are: docker - For docker images. azureml - For AzureML images */ @@ -3166,7 +3171,9 @@ model Image extends Record { reference?: string; } -model EnvironmentVariable extends Record { +model EnvironmentVariable { + ...Record; + /** * Type of the Environment Variable. Possible values are: local - For local variable */ @@ -3178,7 +3185,9 @@ model EnvironmentVariable extends Record { value?: string; } -model Docker extends Record { +model Docker { + ...Record; + /** * Indicate whether container shall run in privileged or non-privileged mode. */ @@ -3402,11 +3411,13 @@ model ResourceBase { /** * The asset property dictionary. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" properties?: Record; /** * Tag dictionary. Tags can be added, removed, and updated. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -3743,6 +3754,7 @@ model ModelVersion extends AssetBase { /** * Mapping of model flavors to their properties. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" flavors?: Record; /** @@ -3782,6 +3794,7 @@ model FlavorData { /** * Model flavor-specific data. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" data?: Record; } @@ -3798,6 +3811,7 @@ model PackageRequest { /** * Collection of environment variables. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") environmentVariables?: Record; @@ -3822,6 +3836,7 @@ model PackageRequest { /** * Tag dictionary. Tags can be added, removed, and updated. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") tags?: Record; @@ -3908,6 +3923,7 @@ model PackageResponse { /** * Collection of environment variables. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read") environmentVariables?: Record; @@ -3938,6 +3954,7 @@ model PackageResponse { /** * Tag dictionary. Tags can be added, removed, and updated. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read") tags?: Record; @@ -3999,6 +4016,7 @@ model EndpointPropertiesBase { /** * Property dictionary. Properties can be added, but not removed or altered. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" properties?: Record; /** @@ -4054,6 +4072,7 @@ model PartialManagedServiceIdentity { /** * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" userAssignedIdentities?: Record>; } @@ -4064,6 +4083,7 @@ model PartialMinimalTrackedResource { /** * Resource tags. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -4184,6 +4204,7 @@ model ResourceConfiguration { /** * Additional properties bag. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") properties?: Record>; } @@ -4225,11 +4246,13 @@ model EndpointDeploymentPropertiesBase { /** * Environment variables configuration for the deployment. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" environmentVariables?: Record; /** * Property dictionary. Properties can be added, but not removed or altered. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" properties?: Record; } @@ -4264,6 +4287,7 @@ model PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties { /** * Resource tags. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -4388,6 +4412,7 @@ model MaterializationSettings { /** * Specifies the spark compute settings */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" sparkConfiguration?: Record; /** @@ -4415,6 +4440,7 @@ model NotificationSetting { /** * Send webhook callback to a service. Key is a user-provided name for the webhook. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create", "update") webhooks?: Record; } @@ -4543,11 +4569,13 @@ model FeaturesetVersionBackfillRequest { /** * Specifies the spark compute settings */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" sparkConfiguration?: Record; /** * Specifies the tags */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -4611,6 +4639,7 @@ model FeaturesetJob { /** * Specifies the tags if any */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; /** @@ -4722,6 +4751,7 @@ model JobBase extends ResourceBase { /** * Configuration for secrets to be made available during runtime. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") secretsConfiguration?: Record; @@ -4729,6 +4759,7 @@ model JobBase extends ResourceBase { * List of JobEndpoints. * For local jobs, a job endpoint will have an endpoint value of FileStreamObject. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" services?: Record; /** @@ -4799,6 +4830,7 @@ model JobService { /** * Additional properties to set on the endpoint. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" properties?: Record; /** @@ -4841,6 +4873,7 @@ model PartialNotificationSetting { /** * Send webhook callback to a service. Key is a user-provided name for the webhook. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" webhooks?: Record; } @@ -4870,6 +4903,7 @@ model LabelingJobProperties extends JobBase { /** * Label categories of the job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create", "update") labelCategories?: Record; @@ -4950,6 +4984,7 @@ model LabelCategory { /** * Dictionary of label classes in this category. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create", "update") classes?: Record; @@ -4979,6 +5014,7 @@ model LabelClass { /** * Dictionary of subclasses of the label class. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create", "update") subclasses?: Record; } @@ -5097,6 +5133,7 @@ model OnlineEndpoint extends EndpointPropertiesBase { /** * Percentage of traffic to be mirrored to each deployment without using returned scoring. Traffic values need to sum to utmost 50. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" mirrorTraffic?: Record; /** @@ -5113,6 +5150,7 @@ model OnlineEndpoint extends EndpointPropertiesBase { /** * Percentage of traffic from endpoint to divert to each deployment. Traffic values need to sum to 100. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" traffic?: Record; } @@ -5184,6 +5222,7 @@ model DataCollector { * [Required] The collection configuration. Each collection has it own configuration to collect model data and the name of collection can be arbitrary string. * Model data collector can be used for either payload logging or custom logging or both of them. Collection request and response are reserved for payload logging, others are for custom logging. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" collections: Record; /** @@ -5763,6 +5802,7 @@ model PartialRegistryPartialTrackedResource { /** * Resource tags. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -6088,6 +6128,7 @@ model ManagedNetworkSettings { /** * Dictionary of */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" outboundRules?: Record; /** @@ -6262,7 +6303,7 @@ model WorkspaceUpdateParameters { /** * Managed service identity (system assigned and/or user assigned identities) */ - identity?: ManagedServiceIdentity; + identity?: Azure.ResourceManager.Foundations.ManagedServiceIdentity; /** * The properties that the machine learning workspace will be updated with. @@ -6277,6 +6318,7 @@ model WorkspaceUpdateParameters { /** * The resource tags for the machine learning workspace. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -6397,46 +6439,55 @@ model DiagnoseRequestProperties { /** * Setting for diagnosing dependent application insights */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" applicationInsights?: Record; /** * Setting for diagnosing dependent container registry */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" containerRegistry?: Record; /** * Setting for diagnosing dns resolution */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" dnsResolution?: Record; /** * Setting for diagnosing dependent key vault */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" keyVault?: Record; /** * Setting for diagnosing network security group */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" nsg?: Record; /** * Setting for diagnosing unclassified category of problems */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" others?: Record; /** * Setting for diagnosing resource lock */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" resourceLock?: Record; /** * Setting for diagnosing dependent storage account */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" storageAccount?: Record; /** * Setting for diagnosing user defined routing */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" udr?: Record; } @@ -6615,7 +6666,7 @@ model PrivateLinkResource extends Resource { /** * Managed service identity (system assigned and/or user assigned identities) */ - identity?: ManagedServiceIdentity; + identity?: Azure.ResourceManager.Foundations.ManagedServiceIdentity; /** * Same as workspace location. @@ -6635,6 +6686,7 @@ model PrivateLinkResource extends Resource { /** * Dictionary of */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; } @@ -6897,6 +6949,7 @@ model KubernetesProperties { /** * Instance Type Schema */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" instanceTypes?: Record; } @@ -6907,6 +6960,7 @@ model InstanceTypeSchema { /** * Node Selector */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" nodeSelector?: Record; /** @@ -6922,11 +6976,13 @@ model InstanceTypeSchemaResources { /** * Resource requests for this instance type */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" requests?: Record; /** * Resource limits for this instance type */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" limits?: Record; } @@ -8242,12 +8298,14 @@ model AutoMLJob extends JobBase { /** * Environment variables included in the job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") environmentVariables?: Record; /** * Mapping of output data bindings used in the job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") outputs?: Record; @@ -8725,11 +8783,13 @@ model BatchPipelineComponentDeploymentConfiguration /** * Run-time settings for the pipeline job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" settings?: Record; /** * The tags which will be applied to the job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; /** @@ -9098,6 +9158,7 @@ model TableVerticalFeaturizationSettings extends FeaturizationSettings { /** * Dictionary of column name and its type (int, float, string, datetime etc). */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" columnNameAndTypes?: Record; /** @@ -9115,6 +9176,7 @@ model TableVerticalFeaturizationSettings extends FeaturizationSettings { /** * User can specify additional transformers to be used along with the columns to which it would be applied and parameters for the transformer constructor. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" transformerParams?: Record; } @@ -9501,12 +9563,14 @@ model CommandJob extends JobBase { /** * Environment variables included in the job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") environmentVariables?: Record; /** * Mapping of input data bindings used in the job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") inputs?: Record; @@ -9519,6 +9583,7 @@ model CommandJob extends JobBase { /** * Mapping of output data bindings used in the job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") outputs?: Record; @@ -9640,6 +9705,7 @@ model MonitorDefinition { /** * [Required] The signals to monitor. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") signals: Record; } @@ -9684,6 +9750,7 @@ model MonitoringSignalBase { /** * Property dictionary. Properties can be added, but not removed or altered. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" properties?: Record; } @@ -9758,6 +9825,7 @@ model OnlineInferenceConfiguration { /** * Additional configurations */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" configurations?: Record; /** @@ -9827,12 +9895,14 @@ model CustomMonitoringSignal extends MonitoringSignalBase { /** * Monitoring assets to take as input. Key is the component input port name, value is the data asset. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") inputAssets?: Record; /** * Extra component parameters to take as input. Key is the component literal input port name, value is the parameter value. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") inputs?: Record; @@ -9862,6 +9932,7 @@ model MonitoringInputDataBase { /** * Mapping of column names to special uses. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") columns?: Record; @@ -9894,6 +9965,7 @@ model MonitoringWorkspaceConnection { * The properties of a workspace service connection to store as environment variables in the submitted jobs. * Key is workspace connection property path, name is environment variable key. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") environmentVariables?: Record; @@ -9901,6 +9973,7 @@ model MonitoringWorkspaceConnection { * The properties of a workspace service connection to store as secrets in the submitted jobs. * Key is workspace connection property path, name is secret key. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") secrets?: Record; } @@ -9966,6 +10039,7 @@ model DataDriftMonitoringSignal extends MonitoringSignalBase { /** * A dictionary that maps feature names to their respective data types. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") featureDataTypeOverride?: Record; @@ -10062,6 +10136,7 @@ model DataQualityMonitoringSignal extends MonitoringSignalBase { /** * A dictionary that maps feature names to their respective data types. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") featureDataTypeOverride?: Record; @@ -11547,7 +11622,7 @@ model ManagedComputeIdentity extends MonitorComputeIdentityBase { /** * Managed service identity (system assigned and/or user assigned identities) */ - identity?: ManagedServiceIdentity; + identity?: Azure.ResourceManager.Foundations.ManagedServiceIdentity; /** * [Required] Monitor compute identity type enum. @@ -12048,18 +12123,21 @@ model PipelineJob extends JobBase { /** * Inputs for the pipeline job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") inputs?: Record; /** * Jobs construct the Pipeline Job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") jobs?: Record>; /** * Outputs for the pipeline job */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") outputs?: Record; @@ -12364,6 +12442,7 @@ model SparkJob extends JobBase { /** * Spark configured properties. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") conf?: Record; @@ -12388,6 +12467,7 @@ model SparkJob extends JobBase { /** * Mapping of input data bindings used in the job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") inputs?: Record; @@ -12400,6 +12480,7 @@ model SparkJob extends JobBase { /** * Mapping of output data bindings used in the job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") outputs?: Record; @@ -12519,6 +12600,7 @@ model SweepJob extends JobBase { /** * Mapping of input data bindings used in the job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") inputs?: Record; @@ -12536,6 +12618,7 @@ model SweepJob extends JobBase { /** * Mapping of output data bindings used in the job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") outputs?: Record; @@ -12625,6 +12708,7 @@ model TrialComponent { /** * Environment variables included in the job. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" @visibility("read", "create") environmentVariables?: Record; @@ -12962,6 +13046,7 @@ model CustomKeys { /** * Dictionary of */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" keys?: Record; } diff --git a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/swagger-output/swagger.json index 8167c3a7f0..0ffd66d8cc 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/swagger-output/swagger.json @@ -387,14 +387,14 @@ "202": { "description": "Resource update request accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -449,14 +449,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -803,14 +803,14 @@ "202": { "description": "Resource update request accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -875,14 +875,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -962,14 +962,14 @@ "202": { "description": "Resource operation accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1433,7 +1433,7 @@ "storageAccountSasToken" ] }, - "Azure.ResourceManager.Foundations.ManagedIdentityProperties": { + "Azure.ResourceManager.Foundations.ManagedServiceIdentity": { "type": "object", "description": "The properties of the managed service identities assigned to this resource.", "properties": { @@ -1448,22 +1448,19 @@ "readOnly": true }, "type": { - "$ref": "#/definitions/Azure.ResourceManager.Foundations.ManagedIdentityType", + "$ref": "#/definitions/Azure.ResourceManager.Foundations.ManagedServiceIdentityType", "description": "The type of managed identity assigned to this resource." }, "userAssignedIdentities": { - "type": "object", - "description": "The identities assigned to this resource by the user.", - "additionalProperties": { - "$ref": "#/definitions/Azure.ResourceManager.Foundations.UserAssignedIdentity" - } + "$ref": "#/definitions/Azure.ResourceManager.Foundations.UserAssignedIdentities", + "description": "The identities assigned to this resource by the user." } }, "required": [ "type" ] }, - "Azure.ResourceManager.Foundations.ManagedIdentityType": { + "Azure.ResourceManager.Foundations.ManagedServiceIdentityType": { "type": "string", "description": "The kind of managed identity assigned to this resource.", "enum": [ @@ -1473,7 +1470,7 @@ "SystemAssigned, UserAssigned" ], "x-ms-enum": { - "name": "ManagedIdentityType", + "name": "ManagedServiceIdentityType", "modelAsString": true, "values": [ { @@ -1499,6 +1496,13 @@ ] } }, + "Azure.ResourceManager.Foundations.UserAssignedIdentities": { + "type": "object", + "description": "The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.\",", + "additionalProperties": { + "$ref": "#/definitions/Azure.ResourceManager.Foundations.UserAssignedIdentity" + } + }, "Azure.ResourceManager.Foundations.UserAssignedIdentity": { "type": "object", "description": "A managed identity assigned by the user.", @@ -1513,16 +1517,6 @@ } } }, - "Azure.ResourceManager.ManagedServiceIdentity": { - "type": "object", - "description": "The managed service identities envelope.", - "properties": { - "identity": { - "$ref": "#/definitions/Azure.ResourceManager.Foundations.ManagedIdentityProperties", - "description": "The managed service identities assigned to this resource." - } - } - }, "ConsumptionEndpointsProperties": { "type": "object", "description": "Details of Consumption Properties", @@ -1661,7 +1655,7 @@ ] }, "identity": { - "$ref": "#/definitions/Azure.ResourceManager.Foundations.ManagedIdentityProperties", + "$ref": "#/definitions/Azure.ResourceManager.Foundations.ManagedServiceIdentity", "description": "The managed service identities assigned to this resource." } }, @@ -1924,7 +1918,7 @@ "description": "The type used for update operations of the DataProduct.", "properties": { "identity": { - "$ref": "#/definitions/Azure.ResourceManager.ManagedServiceIdentity", + "$ref": "#/definitions/Azure.ResourceManager.Foundations.ManagedServiceIdentity", "description": "The managed service identities assigned to this resource." }, "tags": { @@ -2042,15 +2036,8 @@ "read", "create" ] - }, - "name": { - "type": "string", - "readOnly": true } }, - "required": [ - "name" - ], "allOf": [ { "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ProxyResource" diff --git a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/DataProduct.tsp b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/DataProduct.tsp index 8611ab9d95..2942ca8738 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/DataProduct.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/DataProduct.tsp @@ -14,20 +14,15 @@ namespace Microsoft.NetworkAnalytics; /** * The data product resource. */ -model DataProduct is TrackedResource { - /** - * The data product resource name - */ - @maxLength(63) - @minLength(3) - @pattern("^[a-z][a-z0-9]*$") - @path - @key("dataProductName") - @segment("dataProducts") - @visibility("read") - name: string; - - ...Azure.ResourceManager.ManagedServiceIdentity; +model DataProduct + is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = DataProduct, + KeyName = "dataProductName", + SegmentName = "dataProducts", + NamePattern = "^[a-z][a-z0-9]*$" + >; + ...Azure.ResourceManager.ManagedServiceIdentityProperty; } @armResourceOperations @@ -45,7 +40,7 @@ interface DataProducts { /** * Update data product resource. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** @@ -103,3 +98,8 @@ interface DataProducts { */ rotateKey is ArmResourceActionNoContentSync; } + +@@maxLength(DataProduct.name, 63); +@@minLength(DataProduct.name, 3); +@@path(DataProduct.name); +@@doc(DataProduct.name, "The data product resource name"); diff --git a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/DataProductsCatalog.tsp b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/DataProductsCatalog.tsp index 0688ab20b4..60e6205a81 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/DataProductsCatalog.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/DataProductsCatalog.tsp @@ -15,11 +15,14 @@ namespace Microsoft.NetworkAnalytics; * The data catalog resource. */ @singleton("default") -model DataProductsCatalog is ProxyResource { - @key("dataProductsCatalog") - @segment("dataProductsCatalogs") - @visibility("read") - name: string; +model DataProductsCatalog + is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = DataProductsCatalog, + KeyName = "dataProductsCatalog", + SegmentName = "dataProductsCatalogs", + NamePattern = "" + >; } @armResourceOperations @@ -39,3 +42,5 @@ interface DataProductsCatalogs { */ listByResourceGroup is ArmResourceListByParent; } + +@@doc(DataProductsCatalog.name, ""); diff --git a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/DataType.tsp b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/DataType.tsp index d4333fa8a1..046f9e3dd7 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/DataType.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/DataType.tsp @@ -16,18 +16,13 @@ namespace Microsoft.NetworkAnalytics; * The data type resource. */ @parentResource(DataProduct) -model DataType is ProxyResource { - /** - * The data type name. - */ - @maxLength(63) - @minLength(3) - @pattern("^[a-z][a-z0-9-]*$") - @path - @key("dataTypeName") - @segment("dataTypes") - @visibility("read") - name: string; +model DataType is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = DataType, + KeyName = "dataTypeName", + SegmentName = "dataTypes", + NamePattern = "^[a-z][a-z0-9-]*$" + >; } @armResourceOperations @@ -45,7 +40,7 @@ interface DataTypes { /** * Update data type resource. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** @@ -75,3 +70,8 @@ interface DataTypes { ContainerSasToken >; } + +@@maxLength(DataType.name, 63); +@@minLength(DataType.name, 3); +@@path(DataType.name); +@@doc(DataType.name, "The data type name."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/models.tsp index cf763e2773..c4b29940cf 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/models.tsp @@ -381,7 +381,7 @@ model ConsumptionEndpointsProperties { * Resource Id of ingestion endpoint. */ @visibility("read") - ingestionResourceId?: ResourceIdentifier<[ + ingestionResourceId?: Azure.Core.armResourceIdentifier<[ { type: "Microsoft.Storage/storageAccounts"; } @@ -397,7 +397,7 @@ model ConsumptionEndpointsProperties { * Resource Id of file access endpoint. */ @visibility("read") - fileAccessResourceId?: ResourceIdentifier<[ + fileAccessResourceId?: Azure.Core.armResourceIdentifier<[ { type: "Microsoft.Storage/storageAccounts"; } @@ -413,7 +413,7 @@ model ConsumptionEndpointsProperties { * Resource Id of query endpoint. */ @visibility("read") - queryResourceId?: ResourceIdentifier<[ + queryResourceId?: Azure.Core.armResourceIdentifier<[ { type: "Microsoft.Kusto/clusters"; } @@ -517,7 +517,7 @@ model DataProductUpdate { /** * The managed service identities assigned to this resource. */ - identity?: ManagedServiceIdentity; + identity?: Azure.ResourceManager.Foundations.ManagedServiceIdentity; /** * Resource tags. diff --git a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/swagger-output/swagger.json index 49ba37011b..341e08f053 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/swagger-output/swagger.json @@ -344,14 +344,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -636,14 +636,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -928,14 +928,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/Association.tsp b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/Association.tsp index a6f2d8a978..3f2bc4aaf1 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/Association.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/Association.tsp @@ -16,16 +16,14 @@ namespace Microsoft.ServiceNetworking; * Association Subresource of Traffic Controller */ @parentResource(TrafficController) -model Association is TrackedResource { - /** - * Name of Association - */ - @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") - @path - @key("associationName") - @segment("associations") - @visibility("read") - name: string; +model Association + is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = Association, + KeyName = "associationName", + SegmentName = "associations", + NamePattern = "^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$" + >; } @armResourceOperations @@ -43,7 +41,7 @@ interface Associations { /** * Update a Association */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** @@ -56,3 +54,6 @@ interface Associations { */ listByTrafficController is ArmResourceListByParent; } + +@@path(Association.name); +@@doc(Association.name, "Name of Association"); diff --git a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/Frontend.tsp b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/Frontend.tsp index d10270e601..a9e3f1f8e5 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/Frontend.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/Frontend.tsp @@ -16,16 +16,13 @@ namespace Microsoft.ServiceNetworking; * Frontend Subresource of Traffic Controller. */ @parentResource(TrafficController) -model Frontend is TrackedResource { - /** - * Frontends - */ - @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") - @path - @key("frontendName") - @segment("frontends") - @visibility("read") - name: string; +model Frontend is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = Frontend, + KeyName = "frontendName", + SegmentName = "frontends", + NamePattern = "^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$" + >; } @armResourceOperations @@ -43,7 +40,7 @@ interface Frontends { /** * Update a Frontend */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** @@ -56,3 +53,6 @@ interface Frontends { */ listByTrafficController is ArmResourceListByParent; } + +@@path(Frontend.name); +@@doc(Frontend.name, "Frontends"); diff --git a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/TrafficController.tsp b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/TrafficController.tsp index d631539212..df67e34d5c 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/TrafficController.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/TrafficController.tsp @@ -14,16 +14,14 @@ namespace Microsoft.ServiceNetworking; /** * Concrete tracked resource types can be created by aliasing this type using a specific property type. */ -model TrafficController is TrackedResource { - /** - * traffic controller name for path - */ - @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") - @path - @key("trafficControllerName") - @segment("trafficControllers") - @visibility("read") - name: string; +model TrafficController + is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = TrafficController, + KeyName = "trafficControllerName", + SegmentName = "trafficControllers", + NamePattern = "^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$" + >; } @armResourceOperations @@ -41,7 +39,7 @@ interface TrafficControllers { /** * Update a TrafficController */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** @@ -59,3 +57,6 @@ interface TrafficControllers { */ listBySubscription is ArmListBySubscription; } + +@@path(TrafficController.name); +@@doc(TrafficController.name, "traffic controller name for path"); diff --git a/packages/extensions/openapi-to-typespec/test/arm-sphere/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-sphere/swagger-output/swagger.json index 3ed9074a26..594a134b5c 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-sphere/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-sphere/swagger-output/swagger.json @@ -381,14 +381,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -971,14 +971,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1587,14 +1587,14 @@ "202": { "description": "Resource update request accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1655,14 +1655,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -2044,14 +2044,14 @@ "202": { "description": "Resource update request accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -2120,14 +2120,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -2207,14 +2207,14 @@ "202": { "description": "Resource operation accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -2618,14 +2618,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -2949,14 +2949,14 @@ "202": { "description": "Resource update request accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -3033,14 +3033,14 @@ "202": { "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -3134,14 +3134,14 @@ "202": { "description": "Resource operation accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, diff --git a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Catalog.tsp b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Catalog.tsp index 4994ceff5e..aae5dcff35 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Catalog.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Catalog.tsp @@ -14,16 +14,13 @@ namespace Microsoft.AzureSphere; /** * An Azure Sphere catalog */ -model Catalog is TrackedResource { - /** - * Name of catalog - */ - @pattern("^[A-Za-z0-9_-]{1,50}$") - @path - @key("catalogName") - @segment("catalogs") - @visibility("read") - name: string; +model Catalog is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = Catalog, + KeyName = "catalogName", + SegmentName = "catalogs", + NamePattern = "^[A-Za-z0-9_-]{1,50}$" + >; } @armResourceOperations @@ -41,7 +38,7 @@ interface Catalogs { /** * Update a Catalog */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** @@ -209,6 +206,8 @@ interface Catalogs { >; } +@@path(Catalog.name); +@@doc(Catalog.name, "Name of catalog"); @@doc(Catalogs.listDeviceGroups::parameters.body, "List device groups for catalog." ); diff --git a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Certificate.tsp b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Certificate.tsp index 0baa0724a5..9b0c7b3a73 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Certificate.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Certificate.tsp @@ -16,15 +16,14 @@ namespace Microsoft.AzureSphere; * An certificate resource belonging to a catalog resource. */ @parentResource(Catalog) -model Certificate is ProxyResource { - /** - * Serial number of the certificate. Use '.default' to get current active certificate. - */ - @path - @key("serialNumber") - @segment("certificates") - @visibility("read") - name: string; +model Certificate + is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = Certificate, + KeyName = "serialNumber", + SegmentName = "certificates", + NamePattern = "" + >; } @armResourceOperations @@ -87,6 +86,10 @@ interface Certificates { >; } +@@path(Certificate.name); +@@doc(Certificate.name, + "Serial number of the certificate. Use '.default' to get current active certificate." +); @@doc(Certificates.retrieveProofOfPossessionNonce::parameters.body, "Proof of possession nonce request body " ); diff --git a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Deployment.tsp b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Deployment.tsp index faee6b4d02..c7bfaaee11 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Deployment.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Deployment.tsp @@ -16,15 +16,13 @@ namespace Microsoft.AzureSphere; * An deployment resource belonging to a device group resource. */ @parentResource(DeviceGroup) -model Deployment is ProxyResource { - /** - * Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. - */ - @path - @key("deploymentName") - @segment("deployments") - @visibility("read") - name: string; +model Deployment is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = Deployment, + KeyName = "deploymentName", + SegmentName = "deployments", + NamePattern = "" + >; } @armResourceOperations @@ -78,3 +76,8 @@ interface Deployments { } >; } + +@@path(Deployment.name); +@@doc(Deployment.name, + "Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Device.tsp b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Device.tsp index 0565dd4464..d3f5b84e0c 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Device.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Device.tsp @@ -16,16 +16,13 @@ namespace Microsoft.AzureSphere; * An device resource belonging to a device group resource. */ @parentResource(DeviceGroup) -model Device is ProxyResource { - /** - * Device name - */ - @pattern("^[a-zA-Z0-9-]{128}$") - @path - @key("deviceName") - @segment("devices") - @visibility("read") - name: string; +model Device is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = Device, + KeyName = "deviceName", + SegmentName = "devices", + NamePattern = "^[a-zA-Z0-9-]{128}$" + >; } @armResourceOperations @@ -43,7 +40,7 @@ interface Devices { /** * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** @@ -66,6 +63,8 @@ interface Devices { >; } +@@path(Device.name); +@@doc(Device.name, "Device name"); @@doc(Devices.generateCapabilityImage::parameters.body, "Generate capability image request body." ); diff --git a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/DeviceGroup.tsp b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/DeviceGroup.tsp index 5099c73097..72caf44d7e 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/DeviceGroup.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/DeviceGroup.tsp @@ -16,16 +16,14 @@ namespace Microsoft.AzureSphere; * An device group resource belonging to a product resource. */ @parentResource(Product) -model DeviceGroup is ProxyResource { - /** - * Name of device group. - */ - @pattern("^[A-Za-z0-9]{1,2}$|^[A-Za-z0-9][A-Za-z0-9\\s]{1,48}[A-Za-z0-9]$|^\\.default$|^\\.unassigned$") - @path - @key("deviceGroupName") - @segment("deviceGroups") - @visibility("read") - name: string; +model DeviceGroup + is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = DeviceGroup, + KeyName = "deviceGroupName", + SegmentName = "deviceGroups", + NamePattern = "^[A-Za-z0-9]{1,2}$|^[A-Za-z0-9][A-Za-z0-9\\s]{1,48}[A-Za-z0-9]$|^\\.default$|^\\.unassigned$" + >; } @armResourceOperations @@ -43,7 +41,7 @@ interface DeviceGroups { /** * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** @@ -99,6 +97,8 @@ interface DeviceGroups { countDevices is ArmResourceActionSync; } +@@path(DeviceGroup.name); +@@doc(DeviceGroup.name, "Name of device group."); @@doc(DeviceGroups.claimDevices::parameters.body, "Bulk claim devices request body." ); diff --git a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Image.tsp b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Image.tsp index 39395dd755..6e2c8f3aae 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Image.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Image.tsp @@ -16,15 +16,13 @@ namespace Microsoft.AzureSphere; * An image resource belonging to a catalog resource. */ @parentResource(Catalog) -model Image is ProxyResource { - /** - * Image name. Use .default for image creation. - */ - @path - @key("imageName") - @segment("images") - @visibility("read") - name: string; +model Image is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = Image, + KeyName = "imageName", + SegmentName = "images", + NamePattern = "" + >; } @armResourceOperations @@ -78,3 +76,6 @@ interface Images { } >; } + +@@path(Image.name); +@@doc(Image.name, "Image name. Use .default for image creation."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Product.tsp b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Product.tsp index 467783cf7b..77842885d4 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Product.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/Product.tsp @@ -16,16 +16,13 @@ namespace Microsoft.AzureSphere; * An product resource belonging to a catalog resource. */ @parentResource(Catalog) -model Product is ProxyResource { - /** - * Name of product. - */ - @pattern("^[\\w][\\w\\s]{1,48}[\\w]$|^\\.default$|^\\.unassigned$") - @path - @key("productName") - @segment("products") - @visibility("read") - name: string; +model Product is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = Product, + KeyName = "productName", + SegmentName = "products", + NamePattern = "^[\\w][\\w\\s]{1,48}[\\w]$|^\\.default$|^\\.unassigned$" + >; } @armResourceOperations @@ -43,7 +40,7 @@ interface Products { /** * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchAsync; /** @@ -70,3 +67,6 @@ interface Products { ResourceListResult >; } + +@@path(Product.name); +@@doc(Product.name, "Name of product."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-storage/swagger-output/swagger.json index e5f1b0d554..6512d7e4c8 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/swagger-output/swagger.json @@ -734,14 +734,14 @@ "202": { "description": "Resource operation accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -1151,12 +1151,12 @@ } } }, - "delete": { - "operationId": "BlobContainers_Delete", + "patch": { + "operationId": "BlobContainers_Update", "tags": [ "BlobContainers" ], - "description": "Deletes specified container under its account.", + "description": "Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist.", "parameters": [ { "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1184,14 +1184,24 @@ "type": "string", "minLength": 3, "maxLength": 63 + }, + { + "name": "blobContainer", + "in": "body", + "description": "Properties to update for the blob container.", + "required": true, + "schema": { + "$ref": "#/definitions/BlobContainer" + }, + "x-ms-client-name": "blobContainer" } ], "responses": { "200": { - "description": "Resource deleted successfully." - }, - "204": { - "description": "Resource does not exist." + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/BlobContainer" + } }, "default": { "description": "An unexpected error response.", @@ -1201,19 +1211,17 @@ } }, "x-ms-examples": { - "DeleteContainers": { - "$ref": "./examples/BlobContainers_Delete.json" + "UpdateContainers": { + "$ref": "./examples/BlobContainers_Update.json" } } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold": { - "post": { - "operationId": "BlobContainers_ClearLegalHold", + }, + "delete": { + "operationId": "BlobContainers_Delete", "tags": [ "BlobContainers" ], - "description": "Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request.", + "description": "Deletes specified container under its account.", "parameters": [ { "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1241,24 +1249,14 @@ "type": "string", "minLength": 3, "maxLength": 63 - }, - { - "name": "LegalHold", - "in": "body", - "description": "The LegalHold property that will be clear from a blob container.", - "required": true, - "schema": { - "$ref": "#/definitions/LegalHold" - }, - "x-ms-client-name": "LegalHold" } ], "responses": { "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/LegalHold" - } + "description": "Resource deleted successfully." + }, + "204": { + "description": "Resource does not exist." }, "default": { "description": "An unexpected error response.", @@ -1268,19 +1266,19 @@ } }, "x-ms-examples": { - "ClearLegalHoldContainers": { - "$ref": "./examples/BlobContainers_ClearLegalHold.json" + "DeleteContainers": { + "$ref": "./examples/BlobContainers_Delete.json" } } } }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/containers/{name}": { - "patch": { - "operationId": "BlobContainers_Update", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold": { + "post": { + "operationId": "BlobContainers_ClearLegalHold", "tags": [ "BlobContainers" ], - "description": "Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist.", + "description": "Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request.", "parameters": [ { "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1310,30 +1308,21 @@ "maxLength": 63 }, { - "name": "name", - "in": "path", - "description": "The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.", - "required": true, - "type": "string", - "minLength": 3, - "maxLength": 63 - }, - { - "name": "blobContainer", + "name": "LegalHold", "in": "body", - "description": "Properties to update for the blob container.", + "description": "The LegalHold property that will be clear from a blob container.", "required": true, "schema": { - "$ref": "#/definitions/BlobContainer" + "$ref": "#/definitions/LegalHold" }, - "x-ms-client-name": "blobContainer" + "x-ms-client-name": "LegalHold" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/BlobContainer" + "$ref": "#/definitions/LegalHold" } }, "default": { @@ -1344,8 +1333,8 @@ } }, "x-ms-examples": { - "UpdateContainers": { - "$ref": "./examples/BlobContainers_Update.json" + "ClearLegalHoldContainers": { + "$ref": "./examples/BlobContainers_ClearLegalHold.json" } } } @@ -1810,14 +1799,14 @@ "202": { "description": "Resource operation accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -2125,9 +2114,7 @@ "$ref": "./examples/EncryptionScopes_Put_Storage_Account_Put_Encryption_Scope_With_Infrastructure_Encryption.json" } } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}/encryptionScopes/{name}": { + }, "patch": { "operationId": "EncryptionScopes_Patch", "tags": [ @@ -2162,15 +2149,6 @@ "minLength": 3, "maxLength": 63 }, - { - "name": "name", - "in": "path", - "description": "The name of the encryption scope within the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.", - "required": true, - "type": "string", - "minLength": 3, - "maxLength": 63 - }, { "name": "encryptionScope", "in": "body", @@ -2247,14 +2225,14 @@ "202": { "description": "Resource operation accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -2684,6 +2662,74 @@ } } }, + "patch": { + "operationId": "FileShares_Update", + "tags": [ + "FileShares" + ], + "description": "Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist.", + "parameters": [ + { + "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "accountName", + "in": "path", + "description": "The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.", + "required": true, + "type": "string", + "minLength": 3, + "maxLength": 24 + }, + { + "name": "shareName", + "in": "path", + "description": "The name of the file share within the specified storage account. File share names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.", + "required": true, + "type": "string", + "minLength": 3, + "maxLength": 63 + }, + { + "name": "fileShare", + "in": "body", + "description": "Properties to update for the file share.", + "required": true, + "schema": { + "$ref": "#/definitions/FileShare" + }, + "x-ms-client-name": "fileShare" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/FileShare" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "UpdateShareAcls": { + "$ref": "./examples/FileShares_Update_Update_Share_Acls.json" + }, + "UpdateShares": { + "$ref": "./examples/FileShares_Update_Update_Shares.json" + } + } + }, "delete": { "operationId": "FileShares_Delete", "tags": [ @@ -2895,85 +2941,6 @@ } } }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/shares/{name}": { - "patch": { - "operationId": "FileShares_Update", - "tags": [ - "FileShares" - ], - "description": "Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist.", - "parameters": [ - { - "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "name": "accountName", - "in": "path", - "description": "The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.", - "required": true, - "type": "string", - "minLength": 3, - "maxLength": 24 - }, - { - "name": "shareName", - "in": "path", - "description": "The name of the file share within the specified storage account. File share names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.", - "required": true, - "type": "string", - "minLength": 3, - "maxLength": 63 - }, - { - "name": "name", - "in": "path", - "description": "The name of the file share within the specified storage account. File share names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.", - "required": true, - "type": "string", - "minLength": 3, - "maxLength": 63 - }, - { - "name": "fileShare", - "in": "body", - "description": "Properties to update for the file share.", - "required": true, - "schema": { - "$ref": "#/definitions/FileShare" - }, - "x-ms-client-name": "fileShare" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/FileShare" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "UpdateShareAcls": { - "$ref": "./examples/FileShares_Update_Update_Share_Acls.json" - }, - "UpdateShares": { - "$ref": "./examples/FileShares_Update_Update_Shares.json" - } - } - } - }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hierarchicalNamespaceMigration": { "post": { "operationId": "StorageAccounts_HierarchicalNamespaceMigration", @@ -3012,14 +2979,14 @@ "202": { "description": "Resource operation accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -4836,12 +4803,12 @@ } } }, - "delete": { - "operationId": "Queue_Delete", + "patch": { + "operationId": "Queue_Update", "tags": [ "StorageQueues" ], - "description": "Deletes the queue with the specified queue name, under the specified account if it exists.", + "description": "Creates a new queue with the specified queue name, under the specified account.", "parameters": [ { "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -4870,14 +4837,24 @@ "minLength": 3, "maxLength": 63, "pattern": "^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$" + }, + { + "name": "queue", + "in": "body", + "description": "Queue properties and metadata to be created with", + "required": true, + "schema": { + "$ref": "#/definitions/StorageQueue" + }, + "x-ms-client-name": "queue" } ], "responses": { "200": { - "description": "Resource deleted successfully." - }, - "204": { - "description": "Resource does not exist." + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/StorageQueue" + } }, "default": { "description": "An unexpected error response.", @@ -4887,19 +4864,17 @@ } }, "x-ms-examples": { - "QueueOperationDelete": { - "$ref": "./examples/Queue_Delete.json" + "QueueOperationPatch": { + "$ref": "./examples/Queue_Update.json" } } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}/queues/{name}": { - "patch": { - "operationId": "Queue_Update", + }, + "delete": { + "operationId": "Queue_Delete", "tags": [ "StorageQueues" ], - "description": "Creates a new queue with the specified queue name, under the specified account.", + "description": "Deletes the queue with the specified queue name, under the specified account if it exists.", "parameters": [ { "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -4928,34 +4903,14 @@ "minLength": 3, "maxLength": 63, "pattern": "^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$" - }, - { - "name": "name", - "in": "path", - "description": "A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an alphanumeric character and it cannot have two consecutive dash(-) characters.", - "required": true, - "type": "string", - "minLength": 3, - "maxLength": 63, - "pattern": "^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$" - }, - { - "name": "queue", - "in": "body", - "description": "Queue properties and metadata to be created with", - "required": true, - "schema": { - "$ref": "#/definitions/StorageQueue" - }, - "x-ms-client-name": "queue" } ], "responses": { "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/StorageQueue" - } + "description": "Resource deleted successfully." + }, + "204": { + "description": "Resource does not exist." }, "default": { "description": "An unexpected error response.", @@ -4965,8 +4920,8 @@ } }, "x-ms-examples": { - "QueueOperationPatch": { - "$ref": "./examples/Queue_Update.json" + "QueueOperationDelete": { + "$ref": "./examples/Queue_Delete.json" } } } @@ -5079,14 +5034,14 @@ "202": { "description": "Resource operation accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - }, - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." } } }, @@ -5497,12 +5452,12 @@ } } }, - "delete": { - "operationId": "Table_Delete", + "patch": { + "operationId": "Table_Update", "tags": [ "Tables" ], - "description": "Deletes the table with the specified table name, under the specified account if it exists.", + "description": "Creates a new table with the specified table name, under the specified account.", "parameters": [ { "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -5531,14 +5486,24 @@ "minLength": 3, "maxLength": 63, "pattern": "^[A-Za-z][A-Za-z0-9]{2,62}$" + }, + { + "name": "parameters", + "in": "body", + "description": "The parameters to provide to create a table.", + "required": true, + "schema": { + "$ref": "#/definitions/Table" + }, + "x-ms-client-name": "parameters" } ], "responses": { "200": { - "description": "Resource deleted successfully." - }, - "204": { - "description": "Resource does not exist." + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/Table" + } }, "default": { "description": "An unexpected error response.", @@ -5548,19 +5513,20 @@ } }, "x-ms-examples": { - "TableOperationDelete": { - "$ref": "./examples/Table_Delete.json" + "TableOperationPatch": { + "$ref": "./examples/Table_Update_Table_Operation_Patch.json" + }, + "TableOperationPutOrPatchAcls": { + "$ref": "./examples/Table_Update_Table_Operation_Put_Or_Patch_Acls.json" } } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}/tables/{name}": { - "patch": { - "operationId": "Table_Update", + }, + "delete": { + "operationId": "Table_Delete", "tags": [ "Tables" ], - "description": "Creates a new table with the specified table name, under the specified account.", + "description": "Deletes the table with the specified table name, under the specified account if it exists.", "parameters": [ { "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -5589,34 +5555,14 @@ "minLength": 3, "maxLength": 63, "pattern": "^[A-Za-z][A-Za-z0-9]{2,62}$" - }, - { - "name": "name", - "in": "path", - "description": "A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character.", - "required": true, - "type": "string", - "minLength": 3, - "maxLength": 63, - "pattern": "^[A-Za-z][A-Za-z0-9]{2,62}$" - }, - { - "name": "parameters", - "in": "body", - "description": "The parameters to provide to create a table.", - "required": true, - "schema": { - "$ref": "#/definitions/Table" - }, - "x-ms-client-name": "parameters" } ], "responses": { "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/Table" - } + "description": "Resource deleted successfully." + }, + "204": { + "description": "Resource does not exist." }, "default": { "description": "An unexpected error response.", @@ -5626,11 +5572,8 @@ } }, "x-ms-examples": { - "TableOperationPatch": { - "$ref": "./examples/Table_Update_Table_Operation_Patch.json" - }, - "TableOperationPutOrPatchAcls": { - "$ref": "./examples/Table_Update_Table_Operation_Put_Or_Patch_Acls.json" + "TableOperationDelete": { + "$ref": "./examples/Table_Delete.json" } } } @@ -5979,19 +5922,12 @@ "type": "object", "description": "The storage account blob inventory policy.", "properties": { - "name": { - "type": "string", - "readOnly": true - }, "properties": { "$ref": "#/definitions/BlobInventoryPolicyProperties", "description": "Returns the storage account blob inventory policy rules.", "x-ms-client-flatten": true } }, - "required": [ - "name" - ], "allOf": [ { "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ProxyResource" @@ -6257,10 +6193,6 @@ "type": "object", "description": "The properties of a storage account’s Blob service.", "properties": { - "name": { - "type": "string", - "readOnly": true - }, "properties": { "$ref": "#/definitions/BlobServicePropertiesProperties", "description": "The properties of a storage account’s Blob service.", @@ -6271,9 +6203,6 @@ "description": "The SKU (Stock Keeping Unit) assigned to this resource." } }, - "required": [ - "name" - ], "allOf": [ { "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ProxyResource" @@ -7052,10 +6981,6 @@ "type": "object", "description": "The properties of File services in storage account.", "properties": { - "name": { - "type": "string", - "readOnly": true - }, "properties": { "$ref": "#/definitions/FileServicePropertiesProperties", "description": "The properties of File services in storage account.", @@ -7066,9 +6991,6 @@ "description": "The SKU (Stock Keeping Unit) assigned to this resource." } }, - "required": [ - "name" - ], "allOf": [ { "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ProxyResource" @@ -7406,10 +7328,6 @@ "type": "object", "description": "The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag.", "properties": { - "name": { - "type": "string", - "readOnly": true - }, "properties": { "$ref": "#/definitions/ImmutabilityPolicyProperty", "description": "The properties of an ImmutabilityPolicy of a blob container.", @@ -7417,7 +7335,6 @@ } }, "required": [ - "name", "properties" ], "allOf": [ @@ -8076,19 +7993,12 @@ "type": "object", "description": "The Get Storage Account ManagementPolicies operation response.", "properties": { - "name": { - "type": "string", - "readOnly": true - }, "properties": { "$ref": "#/definitions/ManagementPolicyProperties", "description": "Returns the Storage Account Data Policies Rules.", "x-ms-client-flatten": true } }, - "required": [ - "name" - ], "allOf": [ { "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ProxyResource" @@ -8838,19 +8748,12 @@ "type": "object", "description": "The properties of a storage account’s Queue service.", "properties": { - "name": { - "type": "string", - "readOnly": true - }, "properties": { "$ref": "#/definitions/QueueServicePropertiesProperties", "description": "The properties of a storage account’s Queue service.", "x-ms-client-flatten": true } }, - "required": [ - "name" - ], "allOf": [ { "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ProxyResource" @@ -10102,19 +10005,12 @@ "type": "object", "description": "The properties of a storage account’s Table service.", "properties": { - "name": { - "type": "string", - "readOnly": true - }, "properties": { "$ref": "#/definitions/TableServicePropertiesProperties", "description": "The properties of a storage account’s Table service.", "x-ms-client-flatten": true } }, - "required": [ - "name" - ], "allOf": [ { "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ProxyResource" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/BlobContainer.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/BlobContainer.tsp index e45c7087cd..cb004f52ba 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/BlobContainer.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/BlobContainer.tsp @@ -20,17 +20,13 @@ namespace Microsoft.Storage; @parentResource(BlobServiceProperties) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(ContainerProperties) -model BlobContainer extends ProxyResourceBase { - /** - * The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. - */ - @maxLength(63) - @minLength(3) - @path - @key("containerName") - @segment("containers") - @visibility("read") - name: string; +model BlobContainer extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = BlobContainer, + KeyName = "containerName", + SegmentName = "containers", + NamePattern = "" + >; /** * Properties of the blob container. @@ -54,12 +50,13 @@ interface BlobContainers { /** * Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** * Deletes specified container under its account. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -117,6 +114,12 @@ interface BlobContainers { objectLevelWorm is ArmResourceActionAsync; } +@@maxLength(BlobContainer.name, 63); +@@minLength(BlobContainer.name, 3); +@@path(BlobContainer.name); +@@doc(BlobContainer.name, + "The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number." +); @@encodedName(BlobContainers.create::parameters.resource, "application/json", "blobContainer" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/BlobInventoryPolicy.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/BlobInventoryPolicy.tsp index e3e98e5b3a..5a0c8930c2 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/BlobInventoryPolicy.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/BlobInventoryPolicy.tsp @@ -23,11 +23,13 @@ namespace Microsoft.Storage; @Azure.ResourceManager.Private.armResourceInternal( BlobInventoryPolicyProperties ) -model BlobInventoryPolicy extends ProxyResourceBase { - @key("inventoryPolicy") - @segment("inventoryPolicies") - @visibility("read") - name: string; +model BlobInventoryPolicy extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = BlobInventoryPolicy, + KeyName = "inventoryPolicy", + SegmentName = "inventoryPolicies", + NamePattern = "" + >; /** * Returns the storage account blob inventory policy rules. @@ -51,6 +53,7 @@ interface BlobInventoryPolicies { /** * Deletes the blob inventory policy associated with the specified storage account. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -61,6 +64,7 @@ interface BlobInventoryPolicies { list is ArmResourceListByParent; } +@@doc(BlobInventoryPolicy.name, ""); @@encodedName(BlobInventoryPolicies.createOrUpdate::parameters.resource, "application/json", "properties" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/BlobServiceProperties.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/BlobServiceProperties.tsp index e1cfc6817a..de82690afd 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/BlobServiceProperties.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/BlobServiceProperties.tsp @@ -23,11 +23,13 @@ namespace Microsoft.Storage; @Azure.ResourceManager.Private.armResourceInternal( BlobServicePropertiesProperties ) -model BlobServiceProperties extends ProxyResourceBase { - @key("blobService") - @segment("blobServices") - @visibility("read") - name: string; +model BlobServiceProperties extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = BlobServiceProperties, + KeyName = "blobService", + SegmentName = "blobServices", + NamePattern = "" + >; /** * The properties of a storage account’s Blob service. @@ -35,7 +37,7 @@ model BlobServiceProperties extends ProxyResourceBase { @extension("x-ms-client-flatten", true) properties?: BlobServicePropertiesProperties; - ...Azure.ResourceManager.ResourceSku; + ...Azure.ResourceManager.ResourceSkuProperty; } @armResourceOperations @@ -62,6 +64,7 @@ interface BlobServicePropertiesOperationGroup { list is ArmResourceListByParent; } +@@doc(BlobServiceProperties.name, ""); @@encodedName(BlobServicePropertiesOperationGroup.setServiceProperties::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/DeletedAccount.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/DeletedAccount.tsp index 9680f4aa1f..d0f26ea78e 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/DeletedAccount.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/DeletedAccount.tsp @@ -20,17 +20,13 @@ namespace Microsoft.Storage; @parentResource(SubscriptionLocationResource) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(DeletedAccountProperties) -model DeletedAccount extends ProxyResourceBase { - /** - * Name of the deleted storage account. - */ - @maxLength(24) - @minLength(3) - @path - @key("deletedAccountName") - @segment("deletedAccounts") - @visibility("read") - name: string; +model DeletedAccount extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = DeletedAccount, + KeyName = "deletedAccountName", + SegmentName = "deletedAccounts", + NamePattern = "" + >; /** * Properties of the deleted account. @@ -51,3 +47,8 @@ interface DeletedAccounts { */ list is ArmListBySubscription; } + +@@maxLength(DeletedAccount.name, 24); +@@minLength(DeletedAccount.name, 3); +@@path(DeletedAccount.name); +@@doc(DeletedAccount.name, "Name of the deleted storage account."); diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/EncryptionScope.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/EncryptionScope.tsp index e6316e0112..6ecef0d160 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/EncryptionScope.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/EncryptionScope.tsp @@ -20,17 +20,13 @@ namespace Microsoft.Storage; @parentResource(StorageAccount) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(EncryptionScopeProperties) -model EncryptionScope extends ProxyResourceBase { - /** - * The name of the encryption scope within the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. - */ - @maxLength(63) - @minLength(3) - @path - @key("encryptionScopeName") - @segment("encryptionScopes") - @visibility("read") - name: string; +model EncryptionScope extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = EncryptionScope, + KeyName = "encryptionScopeName", + SegmentName = "encryptionScopes", + NamePattern = "" + >; /** * Properties of the encryption scope. @@ -54,7 +50,7 @@ interface EncryptionScopes { /** * Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. */ - @parameterVisibility("read") + @parameterVisibility patch is ArmCustomPatchSync; /** @@ -90,6 +86,12 @@ interface EncryptionScopes { >; } +@@maxLength(EncryptionScope.name, 63); +@@minLength(EncryptionScope.name, 3); +@@path(EncryptionScope.name); +@@doc(EncryptionScope.name, + "The name of the encryption scope within the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number." +); @@encodedName(EncryptionScopes.put::parameters.resource, "application/json", "encryptionScope" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/FileServiceProperties.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/FileServiceProperties.tsp index ec2cac71b1..6c8f036957 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/FileServiceProperties.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/FileServiceProperties.tsp @@ -23,11 +23,13 @@ namespace Microsoft.Storage; @Azure.ResourceManager.Private.armResourceInternal( FileServicePropertiesProperties ) -model FileServiceProperties extends ProxyResourceBase { - @key("fileService") - @segment("fileServices") - @visibility("read") - name: string; +model FileServiceProperties extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = FileServiceProperties, + KeyName = "fileService", + SegmentName = "fileServices", + NamePattern = "" + >; /** * The properties of File services in storage account. @@ -35,7 +37,7 @@ model FileServiceProperties extends ProxyResourceBase { @extension("x-ms-client-flatten", true) properties?: FileServicePropertiesProperties; - ...Azure.ResourceManager.ResourceSku; + ...Azure.ResourceManager.ResourceSkuProperty; } @armResourceOperations @@ -62,6 +64,7 @@ interface FileServicePropertiesOperationGroup { list is ArmResourceListByParent; } +@@doc(FileServiceProperties.name, ""); @@encodedName(FileServicePropertiesOperationGroup.setServiceProperties::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/FileShare.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/FileShare.tsp index f93bcd8a13..fb29fd6d7e 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/FileShare.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/FileShare.tsp @@ -20,17 +20,13 @@ namespace Microsoft.Storage; @parentResource(FileServiceProperties) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(FileShareProperties) -model FileShare extends ProxyResourceBase { - /** - * The name of the file share within the specified storage account. File share names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. - */ - @maxLength(63) - @minLength(3) - @path - @key("shareName") - @segment("shares") - @visibility("read") - name: string; +model FileShare extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = FileShare, + KeyName = "shareName", + SegmentName = "shares", + NamePattern = "" + >; /** * Properties of the file share. @@ -82,12 +78,13 @@ interface FileShares { /** * Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** * Deletes specified share under its account. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync< FileShare, { @@ -161,6 +158,12 @@ interface FileShares { >; } +@@maxLength(FileShare.name, 63); +@@minLength(FileShare.name, 3); +@@path(FileShare.name); +@@doc(FileShare.name, + "The name of the file share within the specified storage account. File share names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number." +); @@encodedName(FileShares.create::parameters.resource, "application/json", "fileShare" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/ImmutabilityPolicy.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/ImmutabilityPolicy.tsp index d2683701fc..154b09dd92 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/ImmutabilityPolicy.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/ImmutabilityPolicy.tsp @@ -21,11 +21,13 @@ namespace Microsoft.Storage; @parentResource(BlobContainer) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(ImmutabilityPolicyProperty) -model ImmutabilityPolicy extends ProxyResourceBase { - @key("immutabilityPolicy") - @segment("immutabilityPolicies") - @visibility("read") - name: string; +model ImmutabilityPolicy extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = ImmutabilityPolicy, + KeyName = "immutabilityPolicy", + SegmentName = "immutabilityPolicies", + NamePattern = "" + >; /** * The properties of an ImmutabilityPolicy of a blob container. @@ -76,6 +78,7 @@ interface ImmutabilityPolicies { * Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked container. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("BlobContainers_DeleteImmutabilityPolicy") deleteImmutabilityPolicy is ArmResourceDeleteSync< ImmutabilityPolicy, @@ -131,6 +134,7 @@ interface ImmutabilityPolicies { >; } +@@doc(ImmutabilityPolicy.name, ""); @@encodedName(ImmutabilityPolicies.createOrUpdateImmutabilityPolicy::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/LocalUser.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/LocalUser.tsp index 27cc3a35ca..8abd25eea5 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/LocalUser.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/LocalUser.tsp @@ -20,17 +20,13 @@ namespace Microsoft.Storage; @parentResource(StorageAccount) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(LocalUserProperties) -model LocalUser extends ProxyResourceBase { - /** - * The name of local user. The username must contain lowercase letters and numbers only. It must be unique only within the storage account. - */ - @maxLength(64) - @minLength(3) - @path - @key("username") - @segment("localUsers") - @visibility("read") - name: string; +model LocalUser extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = LocalUser, + KeyName = "username", + SegmentName = "localUsers", + NamePattern = "" + >; /** * Storage account local user properties. @@ -54,6 +50,7 @@ interface LocalUsers { /** * Deletes the local user associated with the specified storage account. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -78,6 +75,12 @@ interface LocalUsers { >; } +@@maxLength(LocalUser.name, 64); +@@minLength(LocalUser.name, 3); +@@path(LocalUser.name); +@@doc(LocalUser.name, + "The name of local user. The username must contain lowercase letters and numbers only. It must be unique only within the storage account." +); @@encodedName(LocalUsers.createOrUpdate::parameters.resource, "application/json", "properties" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/ManagementPolicy.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/ManagementPolicy.tsp index 570855af82..a4b40a61f4 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/ManagementPolicy.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/ManagementPolicy.tsp @@ -21,11 +21,13 @@ namespace Microsoft.Storage; @parentResource(StorageAccount) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(ManagementPolicyProperties) -model ManagementPolicy extends ProxyResourceBase { - @key("managementPolicy") - @segment("managementPolicies") - @visibility("read") - name: string; +model ManagementPolicy extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = ManagementPolicy, + KeyName = "managementPolicy", + SegmentName = "managementPolicies", + NamePattern = "" + >; /** * Returns the Storage Account Data Policies Rules. @@ -49,9 +51,11 @@ interface ManagementPolicies { /** * Deletes the managementpolicy associated with the specified storage account. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; } +@@doc(ManagementPolicy.name, ""); @@encodedName(ManagementPolicies.createOrUpdate::parameters.resource, "application/json", "properties" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/ObjectReplicationPolicy.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/ObjectReplicationPolicy.tsp index f2a6a67c9b..b1789fe8fe 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/ObjectReplicationPolicy.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/ObjectReplicationPolicy.tsp @@ -22,16 +22,13 @@ namespace Microsoft.Storage; @Azure.ResourceManager.Private.armResourceInternal( ObjectReplicationPolicyProperties ) -model ObjectReplicationPolicy extends ProxyResourceBase { - /** - * For the destination account, provide the value 'default'. Configure the policy on the destination account first. For the source account, provide the value of the policy ID that is returned when you download the policy that was defined on the destination account. The policy is downloaded as a JSON file. - */ - @minLength(1) - @path - @key("objectReplicationPolicyId") - @segment("objectReplicationPolicies") - @visibility("read") - name: string; +model ObjectReplicationPolicy extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = ObjectReplicationPolicy, + KeyName = "objectReplicationPolicyId", + SegmentName = "objectReplicationPolicies", + NamePattern = "" + >; /** * Returns the Storage Account Object Replication Policy. @@ -55,6 +52,7 @@ interface ObjectReplicationPolicies { /** * Deletes the object replication policy associated with the specified storage account. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -65,6 +63,11 @@ interface ObjectReplicationPolicies { list is ArmResourceListByParent; } +@@minLength(ObjectReplicationPolicy.name, 1); +@@path(ObjectReplicationPolicy.name); +@@doc(ObjectReplicationPolicy.name, + "For the destination account, provide the value 'default'. Configure the policy on the destination account first. For the source account, provide the value of the policy ID that is returned when you download the policy that was defined on the destination account. The policy is downloaded as a JSON file." +); @@encodedName(ObjectReplicationPolicies.createOrUpdate::parameters.resource, "application/json", "properties" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/PrivateEndpointConnection.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/PrivateEndpointConnection.tsp index b03c948554..9e1ec16e4f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/PrivateEndpointConnection.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/PrivateEndpointConnection.tsp @@ -22,15 +22,13 @@ namespace Microsoft.Storage; @Azure.ResourceManager.Private.armResourceInternal( PrivateEndpointConnectionProperties ) -model PrivateEndpointConnection extends ProxyResourceBase { - /** - * The name of the private endpoint connection associated with the Azure resource - */ - @path - @key("privateEndpointConnectionName") - @segment("privateEndpointConnections") - @visibility("read") - name: string; +model PrivateEndpointConnection extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = PrivateEndpointConnection, + KeyName = "privateEndpointConnectionName", + SegmentName = "privateEndpointConnections", + NamePattern = "" + >; /** * Resource properties. @@ -54,6 +52,7 @@ interface PrivateEndpointConnections { /** * Deletes the specified private endpoint connection associated with the storage account. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -64,6 +63,10 @@ interface PrivateEndpointConnections { list is ArmResourceListByParent; } +@@path(PrivateEndpointConnection.name); +@@doc(PrivateEndpointConnection.name, + "The name of the private endpoint connection associated with the Azure resource" +); @@encodedName(PrivateEndpointConnections.put::parameters.resource, "application/json", "properties" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/QueueServiceProperties.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/QueueServiceProperties.tsp index ed4b8c6d6f..811c66cd2b 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/QueueServiceProperties.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/QueueServiceProperties.tsp @@ -23,11 +23,13 @@ namespace Microsoft.Storage; @Azure.ResourceManager.Private.armResourceInternal( QueueServicePropertiesProperties ) -model QueueServiceProperties extends ProxyResourceBase { - @key("queueService") - @segment("queueServices") - @visibility("read") - name: string; +model QueueServiceProperties extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = QueueServiceProperties, + KeyName = "queueService", + SegmentName = "queueServices", + NamePattern = "" + >; /** * The properties of a storage account’s Queue service. @@ -60,6 +62,7 @@ interface QueueServicePropertiesOperationGroup { list is ArmResourceListByParent; } +@@doc(QueueServiceProperties.name, ""); @@encodedName(QueueServicePropertiesOperationGroup.setServiceProperties::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/StorageAccount.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/StorageAccount.tsp index d2a6b1137b..04165bc2fd 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/StorageAccount.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/StorageAccount.tsp @@ -18,17 +18,13 @@ namespace Microsoft.Storage; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(StorageAccountProperties) -model StorageAccount extends TrackedResourceBase { - /** - * The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - */ - @maxLength(24) - @minLength(3) - @path - @key("accountName") - @segment("storageAccounts") - @visibility("read") - name: string; +model StorageAccount extends Foundations.TrackedResource { + ...ResourceNameParameter< + Resource = StorageAccount, + KeyName = "accountName", + SegmentName = "storageAccounts", + NamePattern = "" + >; /** * Gets the Kind. @@ -47,8 +43,8 @@ model StorageAccount extends TrackedResourceBase { @extension("x-ms-client-flatten", true) properties?: StorageAccountProperties; - ...Azure.ResourceManager.ManagedServiceIdentity; - ...Azure.ResourceManager.ResourceSku; + ...Azure.ResourceManager.ManagedServiceIdentityProperty; + ...Azure.ResourceManager.ResourceSkuProperty; } @armResourceOperations @@ -77,12 +73,13 @@ interface StorageAccounts { /** * The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** * Deletes a storage account in Microsoft Azure. */ + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" delete is ArmResourceDeleteSync; /** @@ -237,6 +234,12 @@ interface StorageAccounts { ): ArmResponse | ErrorResponse; } +@@maxLength(StorageAccount.name, 24); +@@minLength(StorageAccount.name, 3); +@@path(StorageAccount.name); +@@doc(StorageAccount.name, + "The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only." +); @@encodedName(StorageAccounts.create::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/StorageQueue.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/StorageQueue.tsp index eb4b587a9f..0f47187092 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/StorageQueue.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/StorageQueue.tsp @@ -18,18 +18,13 @@ namespace Microsoft.Storage; @parentResource(QueueServiceProperties) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(QueueProperties) -model StorageQueue extends ProxyResourceBase { - /** - * A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an alphanumeric character and it cannot have two consecutive dash(-) characters. - */ - @maxLength(63) - @minLength(3) - @pattern("^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$") - @path - @key("queueName") - @segment("queues") - @visibility("read") - name: string; +model StorageQueue extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = StorageQueue, + KeyName = "queueName", + SegmentName = "queues", + NamePattern = "^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$" + >; /** * Queue resource properties. @@ -58,7 +53,7 @@ interface StorageQueues { * Creates a new queue with the specified queue name, under the specified account. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Queue_Update") update is ArmCustomPatchSync; @@ -66,6 +61,7 @@ interface StorageQueues { * Deletes the queue with the specified queue name, under the specified account if it exists. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Queue_Delete") delete is ArmResourceDeleteSync; @@ -94,6 +90,12 @@ interface StorageQueues { >; } +@@maxLength(StorageQueue.name, 63); +@@minLength(StorageQueue.name, 3); +@@path(StorageQueue.name); +@@doc(StorageQueue.name, + "A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an alphanumeric character and it cannot have two consecutive dash(-) characters." +); @@encodedName(StorageQueues.create::parameters.resource, "application/json", "queue" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/Table.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/Table.tsp index 34e3927a9f..45aea116f6 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/Table.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/Table.tsp @@ -20,18 +20,13 @@ namespace Microsoft.Storage; @parentResource(TableServiceProperties) @includeInapplicableMetadataInPayload(false) @Azure.ResourceManager.Private.armResourceInternal(TableProperties) -model Table extends ProxyResourceBase { - /** - * A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. - */ - @maxLength(63) - @minLength(3) - @pattern("^[A-Za-z][A-Za-z0-9]{2,62}$") - @path - @key("tableName") - @segment("tables") - @visibility("read") - name: string; +model Table extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = Table, + KeyName = "tableName", + SegmentName = "tables", + NamePattern = "^[A-Za-z][A-Za-z0-9]{2,62}$" + >; /** * Table resource properties. @@ -60,7 +55,7 @@ interface Tables { * Creates a new table with the specified table name, under the specified account. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @parameterVisibility("read") + @parameterVisibility @operationId("Table_Update") update is ArmCustomPatchSync; @@ -68,6 +63,7 @@ interface Tables { * Deletes the table with the specified table name, under the specified account if it exists. */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "For backward compatibility" @operationId("Table_Delete") delete is ArmResourceDeleteSync; @@ -79,6 +75,12 @@ interface Tables { list is ArmResourceListByParent
; } +@@maxLength(Table.name, 63); +@@minLength(Table.name, 3); +@@path(Table.name); +@@doc(Table.name, + "A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character." +); @@encodedName(Tables.create::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/TableServiceProperties.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/TableServiceProperties.tsp index d891ace999..ac65574dfb 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/TableServiceProperties.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/TableServiceProperties.tsp @@ -23,11 +23,13 @@ namespace Microsoft.Storage; @Azure.ResourceManager.Private.armResourceInternal( TableServicePropertiesProperties ) -model TableServiceProperties extends ProxyResourceBase { - @key("tableService") - @segment("tableServices") - @visibility("read") - name: string; +model TableServiceProperties extends Foundations.ProxyResource { + ...ResourceNameParameter< + Resource = TableServiceProperties, + KeyName = "tableService", + SegmentName = "tableServices", + NamePattern = "" + >; /** * The properties of a storage account’s Table service. @@ -60,6 +62,7 @@ interface TableServicePropertiesOperationGroup { list is ArmResourceListByParent; } +@@doc(TableServiceProperties.name, ""); @@encodedName(TableServicePropertiesOperationGroup.setServiceProperties::parameters.resource, "application/json", "parameters" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/models.tsp index 3244b1ca6e..a71abaa302 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/models.tsp @@ -814,6 +814,7 @@ model StorageAccountCreateParameters { /** * Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; /** @@ -882,6 +883,7 @@ model Identity { /** * Gets or sets a list of key value pairs that describe the set of User Assigned identities that will be used with this storage account. The key is the ARM resource identifier of the identity. Only 1 User Assigned identity is permitted here. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" userAssignedIdentities?: Record; } @@ -1952,6 +1954,7 @@ model StorageAccountUpdateParameters { /** * Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" tags?: Record; /** @@ -3402,6 +3405,7 @@ model ContainerProperties { /** * A name-value pair to associate with the container as metadata. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" metadata?: Record; /** @@ -3802,6 +3806,7 @@ model FileShareProperties { /** * A name-value pair to associate with the share as metadata. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" metadata?: Record; /** @@ -4007,6 +4012,7 @@ model QueueProperties { /** * A name-value pair that represents queue metadata. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" metadata?: Record; /** @@ -4108,5 +4114,6 @@ model ListQueueProperties { /** * A name-value pair that represents queue metadata. */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "For backward compatibility" metadata?: Record; } diff --git a/packages/extensions/openapi-to-typespec/test/arm-test/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-test/swagger-output/swagger.json index 53aee6556d..64343b1626 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-test/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-test/swagger-output/swagger.json @@ -647,12 +647,7 @@ } } }, - "allOf": [ - { - "type": "object", - "additionalProperties": {} - } - ] + "additionalProperties": {} }, "DictProperty": { "type": "object", @@ -811,15 +806,8 @@ "read", "create" ] - }, - "name": { - "type": "string", - "readOnly": true } }, - "required": [ - "name" - ], "allOf": [ { "$ref": "../../common-types/resource-management/v3/types.json#/definitions/TrackedResource" diff --git a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/ArrayDefault.tsp b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/ArrayDefault.tsp index bf7f6340cc..a5caec70d0 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/ArrayDefault.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/ArrayDefault.tsp @@ -16,16 +16,14 @@ namespace Microsoft.Test; * A Test resource */ @parentResource(Employee) -model ArrayDefault is TrackedResource { - /** - * Name of resource - */ - @pattern("^[a-zA-Z0-9-]{3,24}$") - @path - @key("name") - @segment("arraydefaults") - @visibility("read") - name: string; +model ArrayDefault + is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = ArrayDefault, + KeyName = "name", + SegmentName = "arraydefaults", + NamePattern = "^[a-zA-Z0-9-]{3,24}$" + >; } @armResourceOperations @@ -40,3 +38,6 @@ interface ArrayDefaults { */ listByResourceGroup is ArmResourceListByParent; } + +@@path(ArrayDefault.name); +@@doc(ArrayDefault.name, "Name of resource"); diff --git a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/DictProperty.tsp b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/DictProperty.tsp index b7cfd32fc6..48dbad6ab7 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/DictProperty.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/DictProperty.tsp @@ -16,16 +16,13 @@ namespace Microsoft.Test; * A Test resource */ @parentResource(Employee) -model DictProperty is TrackedResource> { - /** - * Name of resource - */ - @pattern("^[a-zA-Z0-9-]{3,24}$") - @path - @key("name") - @segment("dictproperties") - @visibility("read") - name: string; +model DictProperty is Azure.ResourceManager.TrackedResource> { + ...ResourceNameParameter< + Resource = DictProperty, + KeyName = "name", + SegmentName = "dictproperties", + NamePattern = "^[a-zA-Z0-9-]{3,24}$" + >; } @armResourceOperations @@ -40,3 +37,6 @@ interface DictProperties { */ listByResourceGroup is ArmResourceListByParent; } + +@@path(DictProperty.name); +@@doc(DictProperty.name, "Name of resource"); diff --git a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/Employee.tsp b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/Employee.tsp index 3688d04fb8..b555f49ebb 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/Employee.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/Employee.tsp @@ -14,16 +14,13 @@ namespace Microsoft.Test; /** * A Test resource */ -model Employee is TrackedResource { - /** - * Name of employee - */ - @pattern("^[a-zA-Z0-9-]{3,24}$") - @path - @key("employeeName") - @segment("employees") - @visibility("read") - name: string; +model Employee is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = Employee, + KeyName = "employeeName", + SegmentName = "employees", + NamePattern = "^[a-zA-Z0-9-]{3,24}$" + >; } @armResourceOperations @@ -41,7 +38,7 @@ interface Employees { /** * Update a Employee */ - @parameterVisibility("read") + @parameterVisibility update is ArmCustomPatchSync; /** @@ -59,3 +56,6 @@ interface Employees { */ listBySubscription is ArmListBySubscription; } + +@@path(Employee.name); +@@doc(Employee.name, "Name of employee"); diff --git a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/Enroll.tsp b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/Enroll.tsp index 411469b307..a94d6c4472 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/Enroll.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/Enroll.tsp @@ -17,11 +17,13 @@ namespace Microsoft.Test; */ @singleton("default") @parentResource(Employee) -model Enroll is TrackedResource { - @key("enroll") - @segment("enrolls") - @visibility("read") - name: string; +model Enroll is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = Enroll, + KeyName = "enroll", + SegmentName = "enrolls", + NamePattern = "" + >; } @armResourceOperations @@ -31,3 +33,5 @@ interface Enrolls { */ get is ArmResourceRead; } + +@@doc(Enroll.name, ""); diff --git a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/models.tsp index 3a55eb9a45..5f7e517d46 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/models.tsp @@ -159,7 +159,9 @@ model EnrollProperties { /** * Resource properties */ -model ArrayDefaultProperties extends Record { +model ArrayDefaultProperties { + ...Record; + /** * Array of strings */ diff --git a/packages/extensions/openapi-to-typespec/test/openAI/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/openAI/tsp-output/models.tsp index 4b7b60795c..0ae112e243 100644 --- a/packages/extensions/openapi-to-typespec/test/openAI/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/openAI/tsp-output/models.tsp @@ -175,8 +175,9 @@ model ErrorResponseError { type?: string; } -model Paths13PiqocDeploymentsDeploymentIdEmbeddingsPostRequestbodyContentApplicationJsonSchema - extends Record { +model Paths13PiqocDeploymentsDeploymentIdEmbeddingsPostRequestbodyContentApplicationJsonSchema { + ...Record; + /** * An input to embed, encoded as a string, a list of strings, or a list of token * lists diff --git a/packages/extensions/openapi-to-typespec/test/qna/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/qna/tsp-output/models.tsp index 8eb481aaef..30c7c645a0 100644 --- a/packages/extensions/openapi-to-typespec/test/qna/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/qna/tsp-output/models.tsp @@ -392,7 +392,9 @@ model ErrorResponse { /** * The error object. */ -model Error extends Record { +model Error { + ...Record; + /** * One of a server-defined set of error codes. */ diff --git a/packages/extensions/openapi-to-typespec/test/qnaAuthoring/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/qnaAuthoring/tsp-output/models.tsp index 9c0d340a75..7d5886c417 100644 --- a/packages/extensions/openapi-to-typespec/test/qnaAuthoring/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/qnaAuthoring/tsp-output/models.tsp @@ -191,7 +191,9 @@ model ErrorResponse { /** * The error object. */ -model Error extends Record { +model Error { + ...Record; + /** * One of a server-defined set of error codes. */ diff --git a/packages/extensions/openapi-to-typespec/test/utils/generate-typespec.ts b/packages/extensions/openapi-to-typespec/test/utils/generate-typespec.ts index ecf1e7edc3..7e6779deb7 100644 --- a/packages/extensions/openapi-to-typespec/test/utils/generate-typespec.ts +++ b/packages/extensions/openapi-to-typespec/test/utils/generate-typespec.ts @@ -105,6 +105,8 @@ async function main() { for (let i = 0; i < folders.length; i++) { const folder = folders[i]; + // https://github.com/Azure/typespec-azure/issues/809#issuecomment-2105604925 + if (folder === "arm-playwrighttesting") continue; try { await generateTypespec(repoRoot, folder, debug); if (swagger) {