Skip to content

Commit

Permalink
support title config for typespec generation (#2941)
Browse files Browse the repository at this point in the history
* support title config for typespec generation

* update

* format

* update

* add ut

* fix yaml config missing

* update ut

* fix ci

* update

* update

* update sample ut

* fix ci

* ut

* Update emitUtil.ts

* Update README.md

* Update README.md

* Update README.md

* resolve comment

* Update buildRootIndex.ts

---------

Co-authored-by: Qiaoqiao Zhang <qiaozha@microsoft.com>
Co-authored-by: Qiaoqiao Zhang <55688292+qiaozha@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 13, 2025
1 parent a4c8ba4 commit 5fa4524
Show file tree
Hide file tree
Showing 42 changed files with 479 additions and 109 deletions.
10 changes: 7 additions & 3 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/rlc-common/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ export interface RLCOptions {
clearOutputFolder?: boolean;
ignorePropertyNameNormalize?: boolean;
compatibilityQueryMultiFormat?: boolean;
typespecTitleMap?: Record<string, string>;
}

export interface ServiceInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ export interface ManagedServiceIdentityV4 {
}

// @public (undocumented)
export class NetworkAnalyticsClient {
constructor(credential: TokenCredential, subscriptionId: string, options?: NetworkAnalyticsClientOptionalParams);
export class NetworkAnalyticsApi {
constructor(credential: TokenCredential, subscriptionId: string, options?: NetworkAnalyticsApiOptionalParams);
readonly dataProducts: DataProductsOperations;
readonly dataProductsCatalogs: DataProductsCatalogsOperations;
readonly dataTypes: DataTypesOperations;
Expand All @@ -440,7 +440,7 @@ export class NetworkAnalyticsClient {
}

// @public
export interface NetworkAnalyticsClientOptionalParams extends ClientOptions {
export interface NetworkAnalyticsApiOptionalParams extends ClientOptions {
apiVersion?: string;
}

Expand Down Expand Up @@ -507,7 +507,7 @@ export interface Resource {
}

// @public
export function restorePoller<TResponse extends PathUncheckedResponse, TResult>(client: NetworkAnalyticsClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike<OperationState<TResult>, TResult>, options?: RestorePollerOptions<TResult>): PollerLike<OperationState<TResult>, TResult>;
export function restorePoller<TResponse extends PathUncheckedResponse, TResult>(client: NetworkAnalyticsApi, serializedState: string, sourceOperation: (...args: any[]) => PollerLike<OperationState<TResult>, TResult>, options?: RestorePollerOptions<TResult>): PollerLike<OperationState<TResult>, TResult>;

// @public (undocumented)
export interface RestorePollerOptions<TResult, TResponse extends PathUncheckedResponse = PathUncheckedResponse> extends OperationOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import { NetworkAnalyticsApi } from "@azure/arm-networkanalytics";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand All @@ -13,7 +13,7 @@ import { DefaultAzureCredential } from "@azure/identity";
async function dataProductsAddUserRoleMaximumSetGen() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new NetworkAnalyticsClient(credential, subscriptionId);
const client = new NetworkAnalyticsApi(credential, subscriptionId);
const result = await client.dataProducts.addUserRole(
"aoiresourceGroupName",
"dataproduct01",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import { NetworkAnalyticsApi } from "@azure/arm-networkanalytics";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand All @@ -13,7 +13,7 @@ import { DefaultAzureCredential } from "@azure/identity";
async function dataProductsCreateMaximumSetGen() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new NetworkAnalyticsClient(credential, subscriptionId);
const client = new NetworkAnalyticsApi(credential, subscriptionId);
const result = await client.dataProducts.create(
"aoiresourceGroupName",
"dataproduct01",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import { NetworkAnalyticsApi } from "@azure/arm-networkanalytics";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand All @@ -13,7 +13,7 @@ import { DefaultAzureCredential } from "@azure/identity";
async function dataProductsDeleteMaximumSetGen() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new NetworkAnalyticsClient(credential, subscriptionId);
const client = new NetworkAnalyticsApi(credential, subscriptionId);
await client.dataProducts.delete("aoiresourceGroupName", "dataproduct01");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import { NetworkAnalyticsApi } from "@azure/arm-networkanalytics";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand All @@ -13,7 +13,7 @@ import { DefaultAzureCredential } from "@azure/identity";
async function dataProductsGenerateStorageAccountSasTokenMaximumSetGen() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new NetworkAnalyticsClient(credential, subscriptionId);
const client = new NetworkAnalyticsApi(credential, subscriptionId);
const result = await client.dataProducts.generateStorageAccountSasToken(
"aoiresourceGroupName",
"dataproduct01",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import { NetworkAnalyticsApi } from "@azure/arm-networkanalytics";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand All @@ -13,7 +13,7 @@ import { DefaultAzureCredential } from "@azure/identity";
async function dataProductsListByResourceGroupMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new NetworkAnalyticsClient(credential, subscriptionId);
const client = new NetworkAnalyticsApi(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.dataProducts.listByResourceGroup(
"aoiresourceGroupName",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import { NetworkAnalyticsApi } from "@azure/arm-networkanalytics";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand All @@ -13,7 +13,7 @@ import { DefaultAzureCredential } from "@azure/identity";
async function dataProductsRotateKeyMaximumSetGen() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new NetworkAnalyticsClient(credential, subscriptionId);
const client = new NetworkAnalyticsApi(credential, subscriptionId);
await client.dataProducts.rotateKey("aoiresourceGroupName", "dataproduct01", {
keyVaultUrl: "https://myKeyVault.vault.azure.net",
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import { NetworkAnalyticsApi } from "@azure/arm-networkanalytics";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand All @@ -13,7 +13,7 @@ import { DefaultAzureCredential } from "@azure/identity";
async function dataProductsUpdateMaximumSetGen() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new NetworkAnalyticsClient(credential, subscriptionId);
const client = new NetworkAnalyticsApi(credential, subscriptionId);
const result = await client.dataProducts.update(
"aoiresourceGroupName",
"dataproduct01",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import {
NetworkAnalyticsContext as Client,
NetworkAnalyticsApiContext as Client,
DataProductsAddUserRoleOptionalParams,
DataProductsCreateOptionalParams,
DataProductsDeleteOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import {
NetworkAnalyticsContext as Client,
NetworkAnalyticsApiContext as Client,
DataProductsCatalogsGetOptionalParams,
DataProductsCatalogsListByResourceGroupOptionalParams,
DataProductsCatalogsListBySubscriptionOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import {
NetworkAnalyticsContext as Client,
NetworkAnalyticsApiContext as Client,
DataTypesCreateOptionalParams,
DataTypesDeleteDataOptionalParams,
DataTypesDeleteOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Licensed under the MIT License.

export {
createNetworkAnalytics,
NetworkAnalyticsContext,
NetworkAnalyticsClientOptionalParams,
} from "./networkAnalyticsContext.js";
createNetworkAnalyticsApi,
NetworkAnalyticsApiContext,
NetworkAnalyticsApiOptionalParams,
} from "./networkAnalyticsApiContext.js";
export {
DataProductsListBySubscriptionOptionalParams,
DataProductsListByResourceGroupOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { KnownVersions } from "../models/models.js";
import { Client, ClientOptions, getClient } from "@azure-rest/core-client";
import { TokenCredential } from "@azure/core-auth";

export interface NetworkAnalyticsContext extends Client {
export interface NetworkAnalyticsApiContext extends Client {
/** The API version to use for this operation. */
/** Known values of {@link KnownVersions} that the service accepts. */
apiVersion: string;
Expand All @@ -15,17 +15,17 @@ export interface NetworkAnalyticsContext extends Client {
}

/** Optional parameters for the client. */
export interface NetworkAnalyticsClientOptionalParams extends ClientOptions {
export interface NetworkAnalyticsApiOptionalParams extends ClientOptions {
/** The API version to use for this operation. */
/** Known values of {@link KnownVersions} that the service accepts. */
apiVersion?: string;
}

export function createNetworkAnalytics(
export function createNetworkAnalyticsApi(
credential: TokenCredential,
subscriptionId: string,
options: NetworkAnalyticsClientOptionalParams = {},
): NetworkAnalyticsContext {
options: NetworkAnalyticsApiOptionalParams = {},
): NetworkAnalyticsApiContext {
const endpointUrl =
options.endpoint ?? options.baseUrl ?? "https://management.azure.com";
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
Expand Down Expand Up @@ -63,5 +63,5 @@ export function createNetworkAnalytics(
...clientContext,
apiVersion,
subscriptionId,
} as NetworkAnalyticsContext;
} as NetworkAnalyticsApiContext;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import {
NetworkAnalyticsContext as Client,
NetworkAnalyticsApiContext as Client,
OperationsListOptionalParams,
} from "../index.js";
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { NetworkAnalyticsContext } from "../../api/networkAnalyticsContext.js";
import { NetworkAnalyticsApiContext } from "../../api/networkAnalyticsApiContext.js";
import {
listBySubscription,
listByResourceGroup,
Expand Down Expand Up @@ -120,7 +120,7 @@ export interface DataProductsOperations {
) => PollerLike<OperationState<DataProduct>, DataProduct>;
}

function _getDataProducts(context: NetworkAnalyticsContext) {
function _getDataProducts(context: NetworkAnalyticsApiContext) {
return {
listBySubscription: (
options?: DataProductsListBySubscriptionOptionalParams,
Expand Down Expand Up @@ -208,7 +208,7 @@ function _getDataProducts(context: NetworkAnalyticsContext) {
}

export function getDataProductsOperations(
context: NetworkAnalyticsContext,
context: NetworkAnalyticsApiContext,
): DataProductsOperations {
return {
..._getDataProducts(context),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { NetworkAnalyticsContext } from "../../api/networkAnalyticsContext.js";
import { NetworkAnalyticsApiContext } from "../../api/networkAnalyticsApiContext.js";
import {
listBySubscription,
listByResourceGroup,
Expand Down Expand Up @@ -33,7 +33,7 @@ export interface DataProductsCatalogsOperations {
) => Promise<DataProductsCatalog>;
}

function _getDataProductsCatalogs(context: NetworkAnalyticsContext) {
function _getDataProductsCatalogs(context: NetworkAnalyticsApiContext) {
return {
listBySubscription: (
options?: DataProductsCatalogsListBySubscriptionOptionalParams,
Expand All @@ -50,7 +50,7 @@ function _getDataProductsCatalogs(context: NetworkAnalyticsContext) {
}

export function getDataProductsCatalogsOperations(
context: NetworkAnalyticsContext,
context: NetworkAnalyticsApiContext,
): DataProductsCatalogsOperations {
return {
..._getDataProductsCatalogs(context),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { NetworkAnalyticsContext } from "../../api/networkAnalyticsContext.js";
import { NetworkAnalyticsApiContext } from "../../api/networkAnalyticsApiContext.js";
import {
listByDataProduct,
generateStorageContainerSasToken,
Expand Down Expand Up @@ -90,7 +90,7 @@ export interface DataTypesOperations {
) => PollerLike<OperationState<DataType>, DataType>;
}

function _getDataTypes(context: NetworkAnalyticsContext) {
function _getDataTypes(context: NetworkAnalyticsApiContext) {
return {
listByDataProduct: (
resourceGroupName: string,
Expand Down Expand Up @@ -182,7 +182,7 @@ function _getDataTypes(context: NetworkAnalyticsContext) {
}

export function getDataTypesOperations(
context: NetworkAnalyticsContext,
context: NetworkAnalyticsApiContext,
): DataTypesOperations {
return {
..._getDataTypes(context),
Expand Down
Loading

0 comments on commit 5fa4524

Please sign in to comment.