Skip to content

Support x-ms-parameter-grouping in modular #3704

@kazrael2119

Description

@kazrael2119

Issue Description:
In typespec, if we want to enable x-ms-parameter-grouping, we have to use customized operation and use @@override to customize it.
https://github.com/Azure/azure-rest-api-specs/pull/38573/files#diff-3f12f17bb6c86f457a820260516d30e8141d1835db5ae6a2d848d48fafb84036R22-R29
But in our generarted codes, we have compile failure with

src/api/sharedPrivateLinkResources/operations.ts:267:50 - error TS2339: Property 'clientRequestId' does not exist on type 'SharedPrivateLinkResourcesGetOptionalParams'.

267           ? { "x-ms-client-request-id": options?.clientRequestId }
                                                     ~~~~~~~~~~~~~~~

src/api/usages/operations.ts:45:22 - error TS2339: Property 'clientRequestId' does not exist on type 'UsagesListBySubscriptionOptionalParams'.

45         ...(options?.clientRequestId !== undefined

generated code:

  return context
    .path(path)
    .get({
      ...operationOptionsToRequestParameters(options),
      headers: {
        ...(options?.clientRequestId !== undefined 
          ? { "x-ms-client-request-id": options?.clientRequestId } // ❌should be options.{x-ms-parameter-grouping name}.clientRequestId
          : {}),
        accept: "application/json",
        ...options.requestOptions?.headers,
      },
    });

it also has a generation issue with:

export interface UsagesListBySubscriptionOptionalParams extends OperationOptions {
  params?: SearchManagementRequestOptions;
}

export interface SearchManagementRequestOptions {} // ❌should be { clientRequestId?: string; }

Additional info:
origin swagger link: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/search/resource-manager/Microsoft.Search/Search/stable/2025-05-01/search.json#L2950-L2961

current sdk link: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/search/arm-search/src/models/index.ts#L1313

From swagger, we have service which uses a flag named x-ms-parameter-grouping for their origin model, In sdk generation, it will generate a parent model for this origin model, and the parent model name is the value of x-ms-parameter-grouping.

sdk code would be like

export interface AdminKeysRegenerateOptionalParams extends coreClient.OperationOptions {
  searchManagementRequestOptions?: SearchManagementRequestOptions;
}
export interface SearchManagementRequestOptions {
  clientRequestId?: string;
}

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions