Skip to content

Commit

Permalink
Support for anyObject (#4958)
Browse files Browse the repository at this point in the history
Fix #4957
Fix #4959

---------

Co-authored-by: Pan Shao <pashao@microsoft.com>
  • Loading branch information
pshao25 and Pan Shao authored Apr 26, 2024
1 parent 03fc9ad commit 33f1071
Show file tree
Hide file tree
Showing 213 changed files with 26,861 additions and 145 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@autorest/openapi-to-typespec",
"comment": "Support AnyObject",
"type": "patch"
}
],
"packageName": "@autorest/openapi-to-typespec"
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function generateArmResourceModel(resource: TspArmResource): string {
}

if (resource.locationParent) {
definitions.push(`@parentResource("${resource.locationParent}")`);
definitions.push(`@parentResource(${resource.locationParent})`);
}

if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
isResourceSchema,
} from "../utils/resource-discovery";
import { isResponseSchema } from "../utils/schemas";
import { transformObjectProperty } from "./transform-object";
import { getTypespecType, transformObjectProperty } from "./transform-object";
import { transformParameter, transformRequest } from "./transform-operations";

const generatedResourceObjects: Map<string, string> = new Map<string, string>();
Expand Down Expand Up @@ -536,7 +536,7 @@ function convertResourceActionOperations(
}
}

const request = bodyParam ? bodyParam.schema.language.default.name : "void";
const request = bodyParam ? getTypespecType(bodyParam.schema, getSession().model) : "void";
const baseParameters = buildOperationBaseParameters(swaggerOperation, resourceMetadata);
let kind;
if (!okResponse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.ApiManagement;
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility"
@subscriptionResource
@parentResource("SubscriptionLocationResource")
@parentResource(SubscriptionLocationResource)
@includeInapplicableMetadataInPayload(false)
@Azure.ResourceManager.Private.armResourceInternal(
DeletedServiceContractProperties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Microsoft.Compute;
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility"
@subscriptionResource
@parentResource("SubscriptionLocationResource")
@parentResource(SubscriptionLocationResource)
@includeInapplicableMetadataInPayload(false)
model CommunityGallery extends PirCommunityGalleryResource {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.Compute;
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility"
@subscriptionResource
@parentResource("SubscriptionLocationResource")
@parentResource(SubscriptionLocationResource)
@includeInapplicableMetadataInPayload(false)
model OSFamily {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.Compute;
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility"
@subscriptionResource
@parentResource("SubscriptionLocationResource")
@parentResource(SubscriptionLocationResource)
@includeInapplicableMetadataInPayload(false)
model OSVersion {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Microsoft.Compute;
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility"
@subscriptionResource
@parentResource("SubscriptionLocationResource")
@parentResource(SubscriptionLocationResource)
@includeInapplicableMetadataInPayload(false)
model SharedGallery extends PirSharedGalleryResource {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.Compute;
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility"
@subscriptionResource
@parentResource("SubscriptionLocationResource")
@parentResource(SubscriptionLocationResource)
@includeInapplicableMetadataInPayload(false)
model VirtualMachineExtensionImage extends Resource {
@path
Expand Down
Loading

0 comments on commit 33f1071

Please sign in to comment.