зеркало из https://github.com/Azure/autorest.git
Change body to bodyroot in converter (#5032)
Co-authored-by: Pan Shao <pashao@microsoft.com>
This commit is contained in:
Родитель
264b421ef4
Коммит
306c387fdd
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"changes": [
|
||||
{
|
||||
"packageName": "@autorest/openapi-to-typespec",
|
||||
"comment": "Change @body to @bodyRoot",
|
||||
"type": "patch"
|
||||
}
|
||||
],
|
||||
"packageName": "@autorest/openapi-to-typespec"
|
||||
}
|
|
@ -81,7 +81,7 @@ export function generateProviderAction(operation: TspArmProviderActionOperation)
|
|||
const responses = [...new Set(operation.responses)];
|
||||
// Workaround for array response, refactor later.
|
||||
const response =
|
||||
responses.length === 1 && responses[0].endsWith("[]") ? `{@body _: ${responses[0]}}` : responses.join("|");
|
||||
responses.length === 1 && responses[0].endsWith("[]") ? `{@bodyRoot _: ${responses[0]}}` : responses.join("|");
|
||||
if (response !== "void") {
|
||||
templateParameters.push(`Response = ${response}`);
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ function convertResourceCreateOrReplaceOperation(
|
|||
if (acceptedResponse) {
|
||||
let responseParameter = `ArmResourceCreatedResponse<${resourceMetadata.SwaggerModelName}> | ArmResourceUpdatedResponse<${resourceMetadata.SwaggerModelName}>`;
|
||||
if (isResponseSchema(acceptedResponse) && acceptedResponse.schema) {
|
||||
responseParameter += `| (ArmAcceptedLroResponse & {@body _: ${resourceMetadata.SwaggerModelName};})`;
|
||||
responseParameter += `| (ArmAcceptedLroResponse & {@bodyRoot _: ${resourceMetadata.SwaggerModelName};})`;
|
||||
} else responseParameter += `| ArmAcceptedLroResponse`;
|
||||
templateParameters.push(`Response = ${responseParameter}`);
|
||||
suppressions = getSuppressionsForArmResourceCreateOrReplaceAsync();
|
||||
|
|
|
@ -42,7 +42,7 @@ interface AnalysisServicesServersOperationGroup {
|
|||
create is ArmResourceCreateOrReplaceAsync<
|
||||
AnalysisServicesServer,
|
||||
Response = ArmResourceCreatedResponse<AnalysisServicesServer> | ArmResourceUpdatedResponse<AnalysisServicesServer> | (ArmAcceptedLroResponse & {
|
||||
@body _: AnalysisServicesServer;
|
||||
@bodyRoot _: AnalysisServicesServer;
|
||||
})
|
||||
>;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ interface Disks {
|
|||
createOrUpdate is ArmResourceCreateOrReplaceAsync<
|
||||
Disk,
|
||||
Response = ArmResourceCreatedResponse<Disk> | ArmResourceUpdatedResponse<Disk> | (ArmAcceptedLroResponse & {
|
||||
@body _: Disk;
|
||||
@bodyRoot _: Disk;
|
||||
})
|
||||
>;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ interface DiskAccesses {
|
|||
createOrUpdate is ArmResourceCreateOrReplaceAsync<
|
||||
DiskAccess,
|
||||
Response = ArmResourceCreatedResponse<DiskAccess> | ArmResourceUpdatedResponse<DiskAccess> | (ArmAcceptedLroResponse & {
|
||||
@body _: DiskAccess;
|
||||
@bodyRoot _: DiskAccess;
|
||||
})
|
||||
>;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ interface DiskEncryptionSets {
|
|||
createOrUpdate is ArmResourceCreateOrReplaceAsync<
|
||||
DiskEncryptionSet,
|
||||
Response = ArmResourceCreatedResponse<DiskEncryptionSet> | ArmResourceUpdatedResponse<DiskEncryptionSet> | (ArmAcceptedLroResponse & {
|
||||
@body _: DiskEncryptionSet;
|
||||
@bodyRoot _: DiskEncryptionSet;
|
||||
})
|
||||
>;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ interface Galleries {
|
|||
createOrUpdate is ArmResourceCreateOrReplaceAsync<
|
||||
Gallery,
|
||||
Response = ArmResourceCreatedResponse<Gallery> | ArmResourceUpdatedResponse<Gallery> | (ArmAcceptedLroResponse & {
|
||||
@body _: Gallery;
|
||||
@bodyRoot _: Gallery;
|
||||
})
|
||||
>;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ interface GalleryApplications {
|
|||
createOrUpdate is ArmResourceCreateOrReplaceAsync<
|
||||
GalleryApplication,
|
||||
Response = ArmResourceCreatedResponse<GalleryApplication> | ArmResourceUpdatedResponse<GalleryApplication> | (ArmAcceptedLroResponse & {
|
||||
@body _: GalleryApplication;
|
||||
@bodyRoot _: GalleryApplication;
|
||||
})
|
||||
>;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ interface GalleryApplicationVersions {
|
|||
createOrUpdate is ArmResourceCreateOrReplaceAsync<
|
||||
GalleryApplicationVersion,
|
||||
Response = ArmResourceCreatedResponse<GalleryApplicationVersion> | ArmResourceUpdatedResponse<GalleryApplicationVersion> | (ArmAcceptedLroResponse & {
|
||||
@body _: GalleryApplicationVersion;
|
||||
@bodyRoot _: GalleryApplicationVersion;
|
||||
})
|
||||
>;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ interface GalleryImages {
|
|||
createOrUpdate is ArmResourceCreateOrReplaceAsync<
|
||||
GalleryImage,
|
||||
Response = ArmResourceCreatedResponse<GalleryImage> | ArmResourceUpdatedResponse<GalleryImage> | (ArmAcceptedLroResponse & {
|
||||
@body _: GalleryImage;
|
||||
@bodyRoot _: GalleryImage;
|
||||
})
|
||||
>;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ interface GalleryImageVersions {
|
|||
createOrUpdate is ArmResourceCreateOrReplaceAsync<
|
||||
GalleryImageVersion,
|
||||
Response = ArmResourceCreatedResponse<GalleryImageVersion> | ArmResourceUpdatedResponse<GalleryImageVersion> | (ArmAcceptedLroResponse & {
|
||||
@body _: GalleryImageVersion;
|
||||
@bodyRoot _: GalleryImageVersion;
|
||||
})
|
||||
>;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ interface PrivateEndpointConnections {
|
|||
updateAPrivateEndpointConnection is ArmResourceCreateOrReplaceAsync<
|
||||
PrivateEndpointConnection,
|
||||
Response = ArmResourceCreatedResponse<PrivateEndpointConnection> | ArmResourceUpdatedResponse<PrivateEndpointConnection> | (ArmAcceptedLroResponse & {
|
||||
@body _: PrivateEndpointConnection;
|
||||
@bodyRoot _: PrivateEndpointConnection;
|
||||
})
|
||||
>;
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ interface Snapshots {
|
|||
createOrUpdate is ArmResourceCreateOrReplaceAsync<
|
||||
Snapshot,
|
||||
Response = ArmResourceCreatedResponse<Snapshot> | ArmResourceUpdatedResponse<Snapshot> | (ArmAcceptedLroResponse & {
|
||||
@body _: Snapshot;
|
||||
@bodyRoot _: Snapshot;
|
||||
})
|
||||
>;
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ interface VirtualMachineScaleSetVMS {
|
|||
update is ArmResourceCreateOrReplaceAsync<
|
||||
VirtualMachineScaleSetVM,
|
||||
Response = ArmResourceCreatedResponse<VirtualMachineScaleSetVM> | ArmResourceUpdatedResponse<VirtualMachineScaleSetVM> | (ArmAcceptedLroResponse & {
|
||||
@body _: VirtualMachineScaleSetVM;
|
||||
@bodyRoot _: VirtualMachineScaleSetVM;
|
||||
})
|
||||
>;
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ interface VirtualMachineImagesOperations {
|
|||
@action("versions")
|
||||
list is ArmProviderActionAsync<
|
||||
Response = {
|
||||
@body _: VirtualMachineImageResource[];
|
||||
@bodyRoot _: VirtualMachineImageResource[];
|
||||
},
|
||||
Scope = SubscriptionActionScope,
|
||||
Parameters = {
|
||||
|
@ -177,7 +177,7 @@ interface VirtualMachineImagesOperations {
|
|||
@action("artifacttypes/vmimage/offers")
|
||||
listOffers is ArmProviderActionAsync<
|
||||
Response = {
|
||||
@body _: VirtualMachineImageResource[];
|
||||
@bodyRoot _: VirtualMachineImageResource[];
|
||||
},
|
||||
Scope = SubscriptionActionScope,
|
||||
Parameters = {
|
||||
|
@ -200,7 +200,7 @@ interface VirtualMachineImagesOperations {
|
|||
@action("publishers")
|
||||
listPublishers is ArmProviderActionAsync<
|
||||
Response = {
|
||||
@body _: VirtualMachineImageResource[];
|
||||
@bodyRoot _: VirtualMachineImageResource[];
|
||||
},
|
||||
Scope = SubscriptionActionScope,
|
||||
Parameters = LocationParameter
|
||||
|
@ -214,7 +214,7 @@ interface VirtualMachineImagesOperations {
|
|||
@action("skus")
|
||||
listSkus is ArmProviderActionAsync<
|
||||
Response = {
|
||||
@body _: VirtualMachineImageResource[];
|
||||
@bodyRoot _: VirtualMachineImageResource[];
|
||||
},
|
||||
Scope = SubscriptionActionScope,
|
||||
Parameters = {
|
||||
|
@ -313,7 +313,7 @@ interface VirtualMachineImagesEdgeZoneOperations {
|
|||
@action("versions")
|
||||
list is ArmProviderActionAsync<
|
||||
Response = {
|
||||
@body _: VirtualMachineImageResource[];
|
||||
@bodyRoot _: VirtualMachineImageResource[];
|
||||
},
|
||||
Scope = SubscriptionActionScope,
|
||||
Parameters = {
|
||||
|
@ -375,7 +375,7 @@ interface VirtualMachineImagesEdgeZoneOperations {
|
|||
@action("artifacttypes/vmimage/offers")
|
||||
listOffers is ArmProviderActionAsync<
|
||||
Response = {
|
||||
@body _: VirtualMachineImageResource[];
|
||||
@bodyRoot _: VirtualMachineImageResource[];
|
||||
},
|
||||
Scope = SubscriptionActionScope,
|
||||
Parameters = {
|
||||
|
@ -405,7 +405,7 @@ interface VirtualMachineImagesEdgeZoneOperations {
|
|||
@action("publishers")
|
||||
listPublishers is ArmProviderActionAsync<
|
||||
Response = {
|
||||
@body _: VirtualMachineImageResource[];
|
||||
@bodyRoot _: VirtualMachineImageResource[];
|
||||
},
|
||||
Scope = SubscriptionActionScope,
|
||||
Parameters = {
|
||||
|
@ -428,7 +428,7 @@ interface VirtualMachineImagesEdgeZoneOperations {
|
|||
@action("skus")
|
||||
listSkus is ArmProviderActionAsync<
|
||||
Response = {
|
||||
@body _: VirtualMachineImageResource[];
|
||||
@bodyRoot _: VirtualMachineImageResource[];
|
||||
},
|
||||
Scope = SubscriptionActionScope,
|
||||
Parameters = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче