Skip to content

Commit

Permalink
Generate knownable api version and fix flattening enum issue (#2889)
Browse files Browse the repository at this point in the history
* Add the knownable enum for apiVersion

* Fix flattening union issues

* fix ci

* Update the Unit Tests for fixings

* Update the test cases for flatten and enum cases

* Update .vscode/launch.json

* Update the format

* Update the ARM libs

* Update the flattening to respect experimentalExtensibleEnums value

* Update the integration tests for modular

---------

Co-authored-by: Jiao Di (MSFT) <[email protected]>
  • Loading branch information
MaryGao and v-jiaodi authored Nov 6, 2024
1 parent 8e18787 commit dc2b510
Show file tree
Hide file tree
Showing 89 changed files with 794 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,11 @@ export enum KnownProvisioningState {
Updating = "Updating"
}

// @public
export enum KnownVersions {
v2023_11_15 = "2023-11-15"
}

// @public
export interface ListRoleAssignments {
count: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

import { logger } from "../logger.js";
import { KnownVersions } from "../models/models.js";
import { Client, ClientOptions, getClient } from "@azure-rest/core-client";
import { TokenCredential } from "@azure/core-auth";

Expand All @@ -10,6 +11,7 @@ export interface NetworkAnalyticsContext extends Client {}
/** Optional parameters for the client. */
export interface NetworkAnalyticsClientOptionalParams extends ClientOptions {
/** The API version to use for this operation. */
/** Known values of {@link KnownVersions} that the service accepts. */
apiVersion?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export {
Origin,
KnownActionType,
ActionType,
KnownVersions,
} from "./models/index.js";
export {
NetworkAnalyticsClientOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ export {
Origin,
KnownActionType,
ActionType,
KnownVersions,
} from "./models.js";
Original file line number Diff line number Diff line change
Expand Up @@ -1453,3 +1453,9 @@ export function operationArrayDeserializer(result: Array<Operation>): any[] {
return operationDeserializer(item);
});
}

/** The available API versions for the Microsoft.NetworkAnalytics RP. */
export enum KnownVersions {
/** The 2023-11-15 stable version. */
v2023_11_15 = "2023-11-15",
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ export type ContinuablePage<TElement, TPage = TElement[]> = TPage & {
continuationToken?: string;
};

// @public
export enum KnownVersions {
// (undocumented)
v1_1 = "v1.1"
}

// @public
export type MultivariateAlignMode = "Inner" | "Outer";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

import { logger } from "../logger.js";
import { KnownVersions } from "../models/models.js";
import { Client, ClientOptions, getClient } from "@azure-rest/core-client";
import { KeyCredential } from "@azure/core-auth";

Expand All @@ -28,6 +29,7 @@ export interface AnomalyDetectorContext extends Client {}
/** Optional parameters for the client. */
export interface AnomalyDetectorClientOptionalParams extends ClientOptions {
/** Api Version */
/** Known values of {@link KnownVersions} that the service accepts. */
apiVersion?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export {
UnivariateUnivariateChangePointDetectionOptions,
UnivariateUnivariateChangePointDetectionResult,
APIVersion,
KnownVersions,
} from "./models/index.js";
export {
AnomalyDetectorClientOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ export {
UnivariateUnivariateChangePointDetectionOptions,
UnivariateUnivariateChangePointDetectionResult,
APIVersion,
KnownVersions,
} from "./models.js";
Original file line number Diff line number Diff line change
Expand Up @@ -1073,3 +1073,8 @@ export function univariateUnivariateChangePointDetectionResultDeserializer(

/** Type of APIVersion */
export type APIVersion = "v1.1";

/** Known values of {@link Versions} that the service accepts. */
export enum KnownVersions {
v1_1 = "v1.1",
}
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,11 @@ export interface JobStatistics {
writeIOps: number;
}

// @public
export enum KnownVersions {
"2023-05-01.17.0" = "2023-05-01.17.0"
}

// @public
export interface LinuxUserConfiguration {
gid?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

import { logger } from "../logger.js";
import { KnownVersions } from "../models/models.js";
import { Client, ClientOptions, getClient } from "@azure-rest/core-client";
import { TokenCredential } from "@azure/core-auth";

Expand All @@ -11,6 +12,7 @@ export interface BatchContext extends Client {}
/** Optional parameters for the client. */
export interface BatchClientOptionalParams extends ClientOptions {
/** The API version to use for this operation. */
/** Known values of {@link KnownVersions} that the service accepts. */
apiVersion?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export {
BatchPoolReplaceOptions,
NodeRemoveOptions,
BatchApplication,
KnownVersions,
} from "./models/index.js";
export {
BatchClientOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,5 @@ export {
BatchPoolReplaceOptions,
NodeRemoveOptions,
BatchApplication,
KnownVersions,
} from "./models.js";
Original file line number Diff line number Diff line change
Expand Up @@ -6229,3 +6229,9 @@ export function batchApplicationArrayDeserializer(
return batchApplicationDeserializer(item);
});
}

/** The Azure Batch service version. */
export enum KnownVersions {
/** API Version 2023-05-01.17.0 */
"2023-05-01.17.0" = "2023-05-01.17.0",
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ export interface CreateStreamingOptionalParams extends OperationOptions {
// @public
export type FinishReason = "stop" | "length";

// @public
export enum KnownAPIVersion {
// (undocumented)
v20231001Preview = "2023-10-01-preview"
}

// @public
export interface StreamingChatCompletionOptionsRecord {
context?: Record<string, any>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export {
ChatCompletionOptionsRecord,
ChatCompletionRecord,
ChatChoiceRecord,
KnownAPIVersion,
} from "./models/index.js";
export {
ChatProtocolClientOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export {
ChatCompletionOptionsRecord,
ChatCompletionRecord,
ChatChoiceRecord,
KnownAPIVersion,
} from "./models.js";
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,8 @@ export function chatChoiceRecordArrayDeserializer(
return chatChoiceRecordDeserializer(item);
});
}

/** Known values of {@link APIVersion} that the service accepts. */
export enum KnownAPIVersion {
v20231001Preview = "2023-10-01-preview",
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ export interface ImageData {
content?: Uint8Array;
}

// @public
export enum KnownVersions {
// (undocumented)
v2023_10_01 = "2023-10-01"
}

// @public
export interface ListTextBlocklistItemsOptionalParams extends OperationOptions {
maxpagesize?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

import { logger } from "../logger.js";
import { KnownVersions } from "../models/models.js";
import { Client, ClientOptions, getClient } from "@azure-rest/core-client";
import { KeyCredential, TokenCredential } from "@azure/core-auth";

Expand All @@ -11,6 +12,7 @@ export interface ContentSafetyContext extends Client {}
/** Optional parameters for the client. */
export interface ContentSafetyClientOptionalParams extends ClientOptions {
/** The API version to use for this operation. */
/** Known values of {@link KnownVersions} that the service accepts. */
apiVersion?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export {
AnalyzeTextResult,
TextBlocklistMatchResult,
TextAnalyzeSeverityResult,
KnownVersions,
} from "./models/index.js";
export {
ContentSafetyClientOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ export {
AnalyzeTextResult,
TextBlocklistMatchResult,
TextAnalyzeSeverityResult,
KnownVersions,
} from "./models.js";
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ export function textAnalyzeSeverityResultArrayDeserializer(
});
}

/** Known values of {@link Versions} that the service accepts. */
export enum KnownVersions {
v2023_10_01 = "2023-10-01",
}

/** Paged collection of TextBlocklist items */
export interface _PagedTextBlocklist {
/** The TextBlocklist items on this page */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ export interface FailedLockToken {
lockToken: string;
}

// @public
export enum KnownServiceApiVersions {
// (undocumented)
v2023_06_01_preview = "2023-06-01-preview"
}

// @public
export interface PublishCloudEventOptionalParams extends OperationOptions {
contentType?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

import { logger } from "../logger.js";
import { KnownServiceApiVersions } from "../models/models.js";
import { Client, ClientOptions, getClient } from "@azure-rest/core-client";
import { KeyCredential } from "@azure/core-auth";

Expand All @@ -11,6 +12,7 @@ export interface EventGridContext extends Client {}
/** Optional parameters for the client. */
export interface EventGridClientOptionalParams extends ClientOptions {
/** The API version to use for this operation. */
/** Known values of {@link KnownServiceApiVersions} that the service accepts. */
apiVersion?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export {
ReleaseResult,
RejectOptions,
RejectResult,
KnownServiceApiVersions,
} from "./models/index.js";
export {
EventGridClientOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export {
ReleaseResult,
RejectOptions,
RejectResult,
KnownServiceApiVersions,
} from "./models.js";
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ export function rejectResultDeserializer(item: any): RejectResult {
};
}

/** Known values of {@link ServiceApiVersions} that the service accepts. */
export enum KnownServiceApiVersions {
v2023_06_01_preview = "2023-06-01-preview",
}

export function cloudEventArraySerializer(result: Array<CloudEvent>): any[] {
return result.map((item) => {
return cloudEventSerializer(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ export interface InferRadiologyInsightsOptionalParams extends OperationOptions {
// @public
export type JobStatus = "notStarted" | "running" | "succeeded" | "failed" | "canceled";

// @public
export enum KnownApiVersion {
// (undocumented)
v2023_09_01_Preview = "2023-09-01-preview"
}

// @public
export interface LateralityDiscrepancyInference extends RadiologyInsightsInference {
discrepancyType: LateralityDiscrepancyType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

import { logger } from "../logger.js";
import { KnownApiVersion } from "../models/models.js";
import { Client, ClientOptions, getClient } from "@azure-rest/core-client";
import { KeyCredential } from "@azure/core-auth";

Expand All @@ -10,6 +11,7 @@ export interface RadiologyInsightsContext extends Client {}
/** Optional parameters for the client. */
export interface RadiologyInsightsClientOptionalParams extends ClientOptions {
/** The API version to use for this operation. */
/** Known values of {@link KnownApiVersion} that the service accepts. */
apiVersion?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export {
DomainResourceUnion,
Narrative,
RadiologyInsightsResult,
KnownApiVersion,
} from "./models/index.js";
export {
InferRadiologyInsightsOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ export {
DomainResourceUnion,
Narrative,
RadiologyInsightsResult,
KnownApiVersion,
} from "./models.js";
Original file line number Diff line number Diff line change
Expand Up @@ -2285,3 +2285,8 @@ export function radiologyInsightsResultDeserializer(
: radiologyInsightsInferenceResultDeserializer(item["result"]),
};
}

/** Known values of {@link ApiVersion} that the service accepts. */
export enum KnownApiVersion {
v2023_09_01_Preview = "2023-09-01-preview",
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ export enum KnownAggregationType {
Total = "Total"
}

// @public
export enum KnownAPIVersions {
v2022_11_01 = "2022-11-01",
v2023_04_01_preview = "2023-04-01-preview",
v2024_03_01_preview = "2024-03-01-preview",
v2024_05_01_preview = "2024-05-01-preview"
}

// @public
export enum KnownCertificateType {
AKV_CERT_URI = "AKV_CERT_URI"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export {
TestProfileRunRecommendation,
KnownRecommendationCategory,
RecommendationCategory,
KnownAPIVersions,
} from "./models/index.js";
export {
LoadTestAdministrationClientOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

import { logger } from "../../logger.js";
import { KnownAPIVersions } from "../../models/models.js";
import { Client, ClientOptions, getClient } from "@azure-rest/core-client";
import { TokenCredential } from "@azure/core-auth";

Expand All @@ -11,6 +12,7 @@ export interface LoadTestAdministrationContext extends Client {}
export interface LoadTestAdministrationClientOptionalParams
extends ClientOptions {
/** The API version to use for this operation. */
/** Known values of {@link KnownAPIVersions} that the service accepts. */
apiVersion?: string;
}

Expand Down
Loading

0 comments on commit dc2b510

Please sign in to comment.