diff --git a/packages/autorest.go/test/machinelearning/armmachinelearning/zz_models.go b/packages/autorest.go/test/machinelearning/armmachinelearning/zz_models.go index 5cbd7c9a9..784a2cb85 100644 --- a/packages/autorest.go/test/machinelearning/armmachinelearning/zz_models.go +++ b/packages/autorest.go/test/machinelearning/armmachinelearning/zz_models.go @@ -337,10 +337,10 @@ type AmlOperationDisplay struct { Resource *string } -// AmlOperationListResult - An array of operations supported by the resource provider. -type AmlOperationListResult struct { +// AmlOperations - An array of operations supported by the resource provider. +type AmlOperations struct { // List of AML workspace operations supported by the AML workspace resource provider. - Value []*AmlOperation + AmlOperations []*AmlOperation } // AmlToken - AML Token identity configuration. diff --git a/packages/autorest.go/test/machinelearning/armmachinelearning/zz_models_serde.go b/packages/autorest.go/test/machinelearning/armmachinelearning/zz_models_serde.go index a7a7af03e..7c53d09f0 100644 --- a/packages/autorest.go/test/machinelearning/armmachinelearning/zz_models_serde.go +++ b/packages/autorest.go/test/machinelearning/armmachinelearning/zz_models_serde.go @@ -588,15 +588,15 @@ func (a *AmlOperationDisplay) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AmlOperationListResult. -func (a AmlOperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AmlOperations. +func (a AmlOperations) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", a.Value) + populate(objectMap, "amlOperations", a.AmlOperations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AmlOperationListResult. -func (a *AmlOperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AmlOperations. +func (a *AmlOperations) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -604,8 +604,8 @@ func (a *AmlOperationListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &a.Value) + case "amlOperations": + err = unpopulate(val, "AmlOperations", &a.AmlOperations) delete(rawMsg, key) } if err != nil { diff --git a/packages/autorest.go/test/machinelearning/armmachinelearning/zz_operations_client.go b/packages/autorest.go/test/machinelearning/armmachinelearning/zz_operations_client.go index 1e209b0b7..236501371 100644 --- a/packages/autorest.go/test/machinelearning/armmachinelearning/zz_operations_client.go +++ b/packages/autorest.go/test/machinelearning/armmachinelearning/zz_operations_client.go @@ -77,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AmlOperationListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.AmlOperations); err != nil { return OperationsClientListResponse{}, err } return result, nil diff --git a/packages/autorest.go/test/machinelearning/armmachinelearning/zz_responses.go b/packages/autorest.go/test/machinelearning/armmachinelearning/zz_responses.go index e2c59afa9..bd8ff9eef 100644 --- a/packages/autorest.go/test/machinelearning/armmachinelearning/zz_responses.go +++ b/packages/autorest.go/test/machinelearning/armmachinelearning/zz_responses.go @@ -489,7 +489,7 @@ type OnlineEndpointsClientUpdateResponse struct { // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { // An array of operations supported by the resource provider. - AmlOperationListResult + AmlOperations } // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.CreateOrUpdate. diff --git a/packages/autorest.gotest/README.md b/packages/autorest.gotest/README.md index 74b063aaf..76918b2a9 100644 --- a/packages/autorest.gotest/README.md +++ b/packages/autorest.gotest/README.md @@ -46,6 +46,10 @@ File prefix for auto-generated examples. File prefix for auto-generated tests. +### --gotest.skip-lint + +Whether skip lint go file after generation. + ## Autorest Pipeline Configurations ```yaml $(go) diff --git a/packages/autorest.gotest/src/common/constant.ts b/packages/autorest.gotest/src/common/constant.ts index fc0f6febf..4ccf5b77c 100644 --- a/packages/autorest.gotest/src/common/constant.ts +++ b/packages/autorest.gotest/src/common/constant.ts @@ -21,6 +21,7 @@ export enum Config { testFilePrefix = 'test-file-prefix', sendExampleId = 'testmodeler.mock.send-example-id', verifyResponse = 'testmodeler.mock.verify-response', + skipLint = 'gotest.skip-lint' } export const configDefaults = { @@ -34,4 +35,5 @@ export const configDefaults = { [Config.filePrefix]: '', [Config.exampleFilePrefix]: '', [Config.testFilePrefix]: '', + [Config.skipLint]: false, }; diff --git a/packages/autorest.gotest/src/generator/goLinter.ts b/packages/autorest.gotest/src/generator/goLinter.ts index 728c63aca..88eaf7e2f 100644 --- a/packages/autorest.gotest/src/generator/goLinter.ts +++ b/packages/autorest.gotest/src/generator/goLinter.ts @@ -3,20 +3,22 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as path from 'path'; import { AutorestExtensionHost } from '@autorest/extension-base'; -import { Config, configDefaults } from '../common/constant'; -import { Helper } from '@autorest/testmodeler/dist/src/util/helper'; import { TestConfig } from '@autorest/testmodeler/dist/src/common/testConfig'; +import { Helper } from '@autorest/testmodeler/dist/src/util/helper'; +import * as path from 'path'; +import { Config, configDefaults } from '../common/constant'; export async function processRequest(host: AutorestExtensionHost): Promise { const testConfig = new TestConfig(await host.GetValue(''), configDefaults); - const files = await host.listInputs(); - Helper.execSync('go install golang.org/x/tools/cmd/goimports@latest'); - for (const outputFile of files) { - if (outputFile.endsWith('.go')) { - const pathName = path.join(testConfig.getValue(Config.outputFolder), outputFile); - Helper.execSync(`goimports -w ${pathName}`); + if (!testConfig.getValue(Config.skipLint)) { + const files = await host.listInputs(); + Helper.execSync('go install golang.org/x/tools/cmd/goimports@latest'); + for (const outputFile of files) { + if (outputFile.endsWith('.go')) { + const pathName = path.join(testConfig.getValue(Config.outputFolder), outputFile); + Helper.execSync(`goimports -w ${pathName}`); + } } } } diff --git a/packages/autorest.gotest/src/generator/mockTestGenerator.ts b/packages/autorest.gotest/src/generator/mockTestGenerator.ts index c07c02c37..341d5f82b 100644 --- a/packages/autorest.gotest/src/generator/mockTestGenerator.ts +++ b/packages/autorest.gotest/src/generator/mockTestGenerator.ts @@ -81,6 +81,9 @@ export class MockTestDataRender extends BaseDataRender { for (const property of schemaResponse.schema['properties']) { if (property.serializedName === valueName) { example.pageableItemName = property.language.go.name; + if (schemaResponse.schema.language.go.name === property.language.go.name) { + example.pageableItemName = `${property.language.go.name}.${example.pageableItemName}`; + } break; } } diff --git a/packages/autorest.gotest/src/template/exampleTest.go.njk b/packages/autorest.gotest/src/template/exampleTest.go.njk index 744a77166..3d0577269 100644 --- a/packages/autorest.gotest/src/template/exampleTest.go.njk +++ b/packages/autorest.gotest/src/template/exampleTest.go.njk @@ -14,11 +14,11 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azidentity" ) {{imports}} -{%- set allExamples = [] %} {%- for exampleGroup in exampleGroups %} +{%- set allExamples = [] %} {%- for example in exampleGroup.examples %} -{%- if allExamples.indexOf(example.originalFile)<0 %} -{%- set _ = allExamples.push(example.originalFile) %} +{%- if allExamples.indexOf(example.name)<0 %} +{%- set _ = allExamples.push(example.name) %} // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/{{swaggerCommit}}/{{example.originalFile}} func Example{{example.operationGroup.language.go.clientName}}_{{example.opName}}{% if exampleGroup.examples.length>1 %}_{{jsFunc.getExampleSuffix(example.name)}}{% endif %}() { cred, err := azidentity.NewDefaultAzureCredential(nil) diff --git a/packages/autorest.gotest/test/integrationtest/output/compute/armcompute/galleryimageversions_client_example_test.go b/packages/autorest.gotest/test/integrationtest/output/compute/armcompute/galleryimageversions_client_example_test.go index 771369986..eca0507df 100644 --- a/packages/autorest.gotest/test/integrationtest/output/compute/armcompute/galleryimageversions_client_example_test.go +++ b/packages/autorest.gotest/test/integrationtest/output/compute/armcompute/galleryimageversions_client_example_test.go @@ -572,6 +572,143 @@ func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimple // } } +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/compute/resource-manager/Microsoft.Compute/stable/2020-09-30/examples/CreateOrUpdateASimpleGalleryImageVersionWithSnapshotsAsSource.json +func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingSnapshotsAsASource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ + Location: to.Ptr("West US"), + Properties: &armcompute.GalleryImageVersionProperties{ + PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ + TargetRegions: []*armcompute.TargetRegion{ + { + Name: to.Ptr("West US"), + Encryption: &armcompute.EncryptionImages{ + DataDiskImages: []*armcompute.DataDiskImageEncryption{ + { + DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), + Lun: to.Ptr[int32](1), + }}, + OSDiskImage: &armcompute.OSDiskImageEncryption{ + DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), + }, + }, + RegionalReplicaCount: to.Ptr[int32](1), + }, + { + Name: to.Ptr("East US"), + Encryption: &armcompute.EncryptionImages{ + DataDiskImages: []*armcompute.DataDiskImageEncryption{ + { + DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), + Lun: to.Ptr[int32](1), + }}, + OSDiskImage: &armcompute.OSDiskImageEncryption{ + DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), + }, + }, + RegionalReplicaCount: to.Ptr[int32](2), + StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), + }}, + }, + StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ + DataDiskImages: []*armcompute.GalleryDataDiskImage{ + { + HostCaching: to.Ptr(armcompute.HostCachingNone), + Source: &armcompute.GalleryArtifactVersionSource{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"), + }, + Lun: to.Ptr[int32](1), + }}, + OSDiskImage: &armcompute.GalleryOSDiskImage{ + HostCaching: to.Ptr(armcompute.HostCachingReadOnly), + Source: &armcompute.GalleryArtifactVersionSource{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"), + }, + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.GalleryImageVersion = armcompute.GalleryImageVersion{ + // Name: to.Ptr("1.0.0"), + // Location: to.Ptr("West US"), + // Properties: &armcompute.GalleryImageVersionProperties{ + // ProvisioningState: to.Ptr(armcompute.GalleryImageVersionPropertiesProvisioningStateSucceeded), + // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ + // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), + // ReplicaCount: to.Ptr[int32](1), + // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), + // TargetRegions: []*armcompute.TargetRegion{ + // { + // Name: to.Ptr("West US"), + // Encryption: &armcompute.EncryptionImages{ + // DataDiskImages: []*armcompute.DataDiskImageEncryption{ + // { + // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), + // Lun: to.Ptr[int32](1), + // }}, + // OSDiskImage: &armcompute.OSDiskImageEncryption{ + // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), + // }, + // }, + // RegionalReplicaCount: to.Ptr[int32](1), + // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), + // }, + // { + // Name: to.Ptr("East US"), + // Encryption: &armcompute.EncryptionImages{ + // DataDiskImages: []*armcompute.DataDiskImageEncryption{ + // { + // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), + // Lun: to.Ptr[int32](1), + // }}, + // OSDiskImage: &armcompute.OSDiskImageEncryption{ + // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), + // }, + // }, + // RegionalReplicaCount: to.Ptr[int32](2), + // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), + // }}, + // }, + // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ + // DataDiskImages: []*armcompute.GalleryDataDiskImage{ + // { + // HostCaching: to.Ptr(armcompute.HostCachingNone), + // SizeInGB: to.Ptr[int32](10), + // Source: &armcompute.GalleryArtifactVersionSource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"), + // }, + // Lun: to.Ptr[int32](1), + // }}, + // OSDiskImage: &armcompute.GalleryOSDiskImage{ + // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), + // SizeInGB: to.Ptr[int32](10), + // Source: &armcompute.GalleryArtifactVersionSource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"), + // }, + // }, + // }, + // }, + // } +} + // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/compute/resource-manager/Microsoft.Compute/stable/2020-09-30/examples/CreateOrUpdateASimpleGalleryImageVersionWithVHD.json func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingVhdAsASource() { cred, err := azidentity.NewDefaultAzureCredential(nil) diff --git a/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/go-tester-pre.yaml b/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/go-tester-pre.yaml index 10feeff39..55d804f32 100644 --- a/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/go-tester-pre.yaml +++ b/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/go-tester-pre.yaml @@ -15653,7 +15653,7 @@ schemas: - name language: default: - name: AmlOperationListResultValue + name: AmlOperations description: List of AML workspace operations supported by the AML workspace resource provider. go: name: '[]*AmlOperation' @@ -15661,16 +15661,16 @@ schemas: elementIsPtr: true marshallingFormat: json protocol: {} - serializedName: value + serializedName: amlOperations extensions: x-ms-identifiers: - name language: &ref_2498 default: - name: value + name: amlOperations description: List of AML workspace operations supported by the AML workspace resource provider. go: - name: Value + name: AmlOperations description: List of AML workspace operations supported by the AML workspace resource provider. byValue: true protocol: {} @@ -15680,12 +15680,12 @@ schemas: - output language: default: - name: AmlOperationListResult + name: AmlOperations description: An array of operations supported by the resource provider. namespace: '' go: - name: AmlOperationListResult - description: AmlOperationListResult - An array of operations supported by the resource provider. + name: AmlOperations + description: AmlOperations - An array of operations supported by the resource provider. hasArrayMap: true marshallingFormat: json namespace: '' @@ -38673,7 +38673,7 @@ operationGroups: responses: '200': body: - value: + amlOperations: - name: Microsoft.MachineLearningServices/workspaces/write display: operation: Create/Update Machine Learning workspaces @@ -38690,12 +38690,14 @@ operationGroups: provider: Microsoft MachineLearningServices resource: workspaces x-ms-pageable: + itemName: amlOperations nextLinkName: null language: default: name: List description: Lists all of the available Azure Machine Learning Workspaces REST API operations. paging: + itemName: amlOperations nextLinkName: null go: name: List @@ -38722,6 +38724,7 @@ operationGroups: go: *ref_1287 protocol: {} paging: + itemName: amlOperations nextLinkName: null protocolNaming: internalMethod: listOperation @@ -38732,10 +38735,10 @@ operationGroups: properties: - &ref_1289 schema: *ref_1285 - serializedName: AmlOperationListResult + serializedName: AmlOperations language: default: &ref_1288 - name: AmlOperationListResult + name: AmlOperations description: An array of operations supported by the resource provider. byValue: true embeddedType: true @@ -70643,7 +70646,7 @@ testModel: schema: *ref_1285 parentsValue: {} properties: - value: + amlOperations: schema: *ref_1199 elements: - schema: *ref_61 diff --git a/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/go-tester.yaml b/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/go-tester.yaml index 67baf133c..6a9d3b026 100644 --- a/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/go-tester.yaml +++ b/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/go-tester.yaml @@ -15653,7 +15653,7 @@ schemas: - name language: default: - name: AmlOperationListResultValue + name: AmlOperations description: List of AML workspace operations supported by the AML workspace resource provider. go: name: '[]*AmlOperation' @@ -15661,16 +15661,16 @@ schemas: elementIsPtr: true marshallingFormat: json protocol: {} - serializedName: value + serializedName: amlOperations extensions: x-ms-identifiers: - name language: &ref_2498 default: - name: value + name: amlOperations description: List of AML workspace operations supported by the AML workspace resource provider. go: - name: Value + name: AmlOperations description: List of AML workspace operations supported by the AML workspace resource provider. byValue: true protocol: {} @@ -15680,12 +15680,12 @@ schemas: - output language: default: - name: AmlOperationListResult + name: AmlOperations description: An array of operations supported by the resource provider. namespace: '' go: - name: AmlOperationListResult - description: AmlOperationListResult - An array of operations supported by the resource provider. + name: AmlOperations + description: AmlOperations - An array of operations supported by the resource provider. hasArrayMap: true marshallingFormat: json namespace: '' @@ -38673,7 +38673,7 @@ operationGroups: responses: '200': body: - value: + amlOperations: - name: Microsoft.MachineLearningServices/workspaces/write display: operation: Create/Update Machine Learning workspaces @@ -38690,12 +38690,14 @@ operationGroups: provider: Microsoft MachineLearningServices resource: workspaces x-ms-pageable: + itemName: amlOperations nextLinkName: null language: default: name: List description: Lists all of the available Azure Machine Learning Workspaces REST API operations. paging: + itemName: amlOperations nextLinkName: null go: name: List @@ -38722,6 +38724,7 @@ operationGroups: go: *ref_1287 protocol: {} paging: &ref_2500 + itemName: amlOperations nextLinkName: null protocolNaming: internalMethod: listOperation @@ -38732,10 +38735,10 @@ operationGroups: properties: - &ref_1289 schema: *ref_1285 - serializedName: AmlOperationListResult + serializedName: AmlOperations language: default: &ref_1288 - name: AmlOperationListResult + name: AmlOperations description: An array of operations supported by the resource provider. byValue: true embeddedType: true @@ -70649,10 +70652,10 @@ testModel: operation: *ref_2491 operationGroup: *ref_2492 originalFile: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-02-01-preview/examples/Workspace/operationsList.json - pageableItemName: Value + pageableItemName: AmlOperations.AmlOperations responseOutput: |- - armmachinelearningservices.AmlOperationListResult{ - Value: []*armmachinelearningservices.AmlOperation{ + armmachinelearningservices.AmlOperations{ + AmlOperations: []*armmachinelearningservices.AmlOperation{ { Name: to.Ptr("Microsoft.MachineLearningServices/workspaces/write"), Display: &armmachinelearningservices.AmlOperationDisplay{ @@ -70678,7 +70681,7 @@ testModel: }, }}, } - responseType: AmlOperationListResult + responseType: AmlOperations responseTypePointer: false returnInfo: - '*runtime.Pager[OperationsClientListResponse]' @@ -70688,7 +70691,7 @@ testModel: schema: *ref_1285 parentsValue: {} properties: - value: + amlOperations: schema: *ref_1199 elements: - schema: *ref_61 diff --git a/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/test-modeler-pre.yaml b/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/test-modeler-pre.yaml index d3746162d..369aa9455 100644 --- a/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/test-modeler-pre.yaml +++ b/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/test-modeler-pre.yaml @@ -15653,7 +15653,7 @@ schemas: - name language: default: - name: AmlOperationListResultValue + name: AmlOperations description: List of AML workspace operations supported by the AML workspace resource provider. go: name: '[]*AmlOperation' @@ -15661,16 +15661,16 @@ schemas: elementIsPtr: true marshallingFormat: json protocol: {} - serializedName: value + serializedName: amlOperations extensions: x-ms-identifiers: - name language: default: - name: value + name: amlOperations description: List of AML workspace operations supported by the AML workspace resource provider. go: - name: Value + name: AmlOperations description: List of AML workspace operations supported by the AML workspace resource provider. byValue: true protocol: {} @@ -15680,12 +15680,12 @@ schemas: - output language: default: - name: AmlOperationListResult + name: AmlOperations description: An array of operations supported by the resource provider. namespace: '' go: - name: AmlOperationListResult - description: AmlOperationListResult - An array of operations supported by the resource provider. + name: AmlOperations + description: AmlOperations - An array of operations supported by the resource provider. hasArrayMap: true marshallingFormat: json namespace: '' @@ -38671,7 +38671,7 @@ operationGroups: responses: '200': body: - value: + amlOperations: - name: Microsoft.MachineLearningServices/workspaces/write display: operation: Create/Update Machine Learning workspaces @@ -38688,12 +38688,14 @@ operationGroups: provider: Microsoft MachineLearningServices resource: workspaces x-ms-pageable: + itemName: amlOperations nextLinkName: null language: default: name: List description: Lists all of the available Azure Machine Learning Workspaces REST API operations. paging: + itemName: amlOperations nextLinkName: null go: name: List @@ -38720,6 +38722,7 @@ operationGroups: go: *ref_1287 protocol: {} paging: + itemName: amlOperations nextLinkName: null protocolNaming: internalMethod: listOperation @@ -38730,10 +38733,10 @@ operationGroups: properties: - &ref_1289 schema: *ref_1285 - serializedName: AmlOperationListResult + serializedName: AmlOperations language: default: &ref_1288 - name: AmlOperationListResult + name: AmlOperations description: An array of operations supported by the resource provider. byValue: true embeddedType: true diff --git a/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/test-modeler.yaml b/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/test-modeler.yaml index b1cc13273..a1c26f437 100644 --- a/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/test-modeler.yaml +++ b/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/__debug/test-modeler.yaml @@ -15653,7 +15653,7 @@ schemas: - name language: default: - name: AmlOperationListResultValue + name: AmlOperations description: List of AML workspace operations supported by the AML workspace resource provider. go: name: '[]*AmlOperation' @@ -15661,16 +15661,16 @@ schemas: elementIsPtr: true marshallingFormat: json protocol: {} - serializedName: value + serializedName: amlOperations extensions: x-ms-identifiers: - name language: &ref_2674 default: - name: value + name: amlOperations description: List of AML workspace operations supported by the AML workspace resource provider. go: - name: Value + name: AmlOperations description: List of AML workspace operations supported by the AML workspace resource provider. byValue: true protocol: {} @@ -15680,12 +15680,12 @@ schemas: - output language: default: - name: AmlOperationListResult + name: AmlOperations description: An array of operations supported by the resource provider. namespace: '' go: - name: AmlOperationListResult - description: AmlOperationListResult - An array of operations supported by the resource provider. + name: AmlOperations + description: AmlOperations - An array of operations supported by the resource provider. hasArrayMap: true marshallingFormat: json namespace: '' @@ -38673,7 +38673,7 @@ operationGroups: responses: '200': body: - value: + amlOperations: - name: Microsoft.MachineLearningServices/workspaces/write display: operation: Create/Update Machine Learning workspaces @@ -38690,12 +38690,14 @@ operationGroups: provider: Microsoft MachineLearningServices resource: workspaces x-ms-pageable: + itemName: amlOperations nextLinkName: null language: default: name: List description: Lists all of the available Azure Machine Learning Workspaces REST API operations. paging: + itemName: amlOperations nextLinkName: null go: name: List @@ -38722,6 +38724,7 @@ operationGroups: go: *ref_1287 protocol: {} paging: + itemName: amlOperations nextLinkName: null protocolNaming: internalMethod: listOperation @@ -38732,10 +38735,10 @@ operationGroups: properties: - &ref_1289 schema: *ref_1285 - serializedName: AmlOperationListResult + serializedName: AmlOperations language: default: &ref_1288 - name: AmlOperationListResult + name: AmlOperations description: An array of operations supported by the resource provider. byValue: true embeddedType: true @@ -70643,7 +70646,7 @@ testModel: schema: *ref_1285 parentsValue: {} properties: - value: + amlOperations: schema: *ref_1199 elements: - schema: *ref_61 diff --git a/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/mock_test.go b/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/mock_test.go index 5f7573035..41e90c2b7 100644 --- a/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/mock_test.go +++ b/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/mock_test.go @@ -82,8 +82,8 @@ func (testsuite *MockTestSuite) TestOperations_List() { nextResult, err := pager.NextPage(ctx) testsuite.Require().NoError(err, "Failed to advance page for example specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-02-01-preview/examples/Workspace/operationsList.json") // Response check - pagerExampleRes := armmachinelearningservices.AmlOperationListResult{ - Value: []*armmachinelearningservices.AmlOperation{ + pagerExampleRes := armmachinelearningservices.AmlOperations{ + AmlOperations: []*armmachinelearningservices.AmlOperation{ { Name: to.Ptr("Microsoft.MachineLearningServices/workspaces/write"), Display: &armmachinelearningservices.AmlOperationDisplay{ @@ -109,9 +109,9 @@ func (testsuite *MockTestSuite) TestOperations_List() { }, }}, } - if !reflect.DeepEqual(pagerExampleRes, nextResult.AmlOperationListResult) { + if !reflect.DeepEqual(pagerExampleRes, nextResult.AmlOperations) { exampleResJson, _ := json.Marshal(pagerExampleRes) - mockResJson, _ := json.Marshal(nextResult.AmlOperationListResult) + mockResJson, _ := json.Marshal(nextResult.AmlOperations) testsuite.Failf("Failed to validate response", "Mock response is not equal to example response for example specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-02-01-preview/examples/Workspace/operationsList.json:\nmock response: %s\nexample response: %s", mockResJson, exampleResJson) } } diff --git a/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/operations_client_example_test.go b/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/operations_client_example_test.go index 47026045b..8c09cf1ed 100644 --- a/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/operations_client_example_test.go +++ b/packages/autorest.gotest/test/integrationtest/output/machinelearningservices/armmachinelearningservices/operations_client_example_test.go @@ -34,13 +34,13 @@ func ExampleOperationsClient_NewListPager() { if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range page.Value { + for _, v := range page.AmlOperations.AmlOperations { // You could use page here. We use blank identifier for just demo purposes. _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AmlOperationListResult = armmachinelearningservices.AmlOperationListResult{ - // Value: []*armmachinelearningservices.AmlOperation{ + // page.AmlOperations = armmachinelearningservices.AmlOperations{ + // AmlOperations: []*armmachinelearningservices.AmlOperation{ // { // Name: to.Ptr("Microsoft.MachineLearningServices/workspaces/write"), // Display: &armmachinelearningservices.AmlOperationDisplay{ diff --git a/swagger/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-02-01-preview/examples/Workspace/operationsList.json b/swagger/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-02-01-preview/examples/Workspace/operationsList.json index cd045334c..5ba8a7317 100644 --- a/swagger/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-02-01-preview/examples/Workspace/operationsList.json +++ b/swagger/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-02-01-preview/examples/Workspace/operationsList.json @@ -5,7 +5,7 @@ "responses": { "200": { "body": { - "value": [ + "amlOperations": [ { "name": "Microsoft.MachineLearningServices/workspaces/write", "display": { diff --git a/swagger/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-02-01-preview/machineLearningServices.json b/swagger/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-02-01-preview/machineLearningServices.json index 24efcb30a..2a2168b33 100644 --- a/swagger/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-02-01-preview/machineLearningServices.json +++ b/swagger/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-02-01-preview/machineLearningServices.json @@ -55,7 +55,7 @@ "200": { "description": "The request was successful; the request was well-formed and received properly.", "schema": { - "$ref": "#/definitions/AmlOperationListResult" + "$ref": "#/definitions/AmlOperations" } }, "default": { @@ -66,7 +66,8 @@ } }, "x-ms-pageable": { - "nextLinkName": null + "nextLinkName": null, + "itemName": "amlOperations" } } }, @@ -2012,11 +2013,11 @@ } } }, - "AmlOperationListResult": { + "AmlOperations": { "type": "object", "description": "An array of operations supported by the resource provider.", "properties": { - "value": { + "amlOperations": { "type": "array", "items": { "$ref": "#/definitions/AmlOperation"