From a8f8ba46be5dd75aae4388a1e3b17be85c349fbd Mon Sep 17 00:00:00 2001 From: Jose Manuel Heredia Hidalgo Date: Thu, 25 Apr 2024 08:50:34 -0700 Subject: [PATCH] Remove orphan model detection (#2478) * Remove orphan model detection * update openai config * Fix formatting glob * Update smoke tests * Update cadl ranch --- packages/rlc-common/package.json | 2 +- .../review/ai-anomaly-detector.api.md | 12 ++ .../generated/typespec-ts/src/index.ts | 2 + .../generated/typespec-ts/src/models/index.ts | 2 + .../typespec-ts/src/models/models.ts | 16 ++ .../typespec-ts/review/load-testing.api.md | 157 ++++++++++++++++-- .../src/administrationOperations/index.ts | 8 + .../administrationOperations/models/index.ts | 8 + .../administrationOperations/models/models.ts | 88 ++++++++++ .../generated/typespec-ts/src/index.ts | 20 +++ .../src/testRunOperations/index.ts | 4 + .../src/testRunOperations/models/index.ts | 4 + .../src/testRunOperations/models/models.ts | 56 +++++++ .../typespec-ts/review/openai-generic.api.md | 6 + .../generated/typespec-ts/src/index.ts | 1 + .../generated/typespec-ts/src/models/index.ts | 1 + .../typespec-ts/src/models/models.ts | 4 + .../test/openai_modular/spec/tspconfig.yaml | 1 - .../review/openai-non-branded.api.md | 6 + .../generated/typespec-ts/src/index.ts | 1 + .../generated/typespec-ts/src/models/index.ts | 1 + .../typespec-ts/src/models/models.ts | 4 + .../typespec-ts/review/schema-registry.api.md | 6 + .../generated/typespec-ts/src/index.ts | 1 + .../generated/typespec-ts/src/models/index.ts | 1 + .../typespec-ts/src/models/models.ts | 9 + .../test/widget_dpg/tspconfig.yaml | 1 - packages/typespec-ts/README.md | 8 - packages/typespec-ts/package.json | 2 +- packages/typespec-ts/src/index.ts | 90 +--------- packages/typespec-ts/src/lib.ts | 2 - .../helpers/classicalOperationHelpers.ts | 10 +- .../authentication/api-key/src/index.ts | 6 +- .../api-key/src/models/index.ts | 2 +- .../api-key/src/models/models.ts | 4 + .../authentication/http-custom/src/index.ts | 6 +- .../http-custom/src/models/index.ts | 2 +- .../http-custom/src/models/models.ts | 4 + .../authentication/oauth2/src/index.ts | 6 +- .../authentication/oauth2/src/models/index.ts | 2 +- .../oauth2/src/models/models.ts | 4 + .../clientGeneratorCore/usage/src/index.ts | 1 + .../usage/src/models/index.ts | 2 +- .../usage/src/models/models.ts | 5 + 44 files changed, 454 insertions(+), 124 deletions(-) diff --git a/packages/rlc-common/package.json b/packages/rlc-common/package.json index 97ebb65633..eda3c97750 100644 --- a/packages/rlc-common/package.json +++ b/packages/rlc-common/package.json @@ -18,7 +18,7 @@ "lint:fix": "eslint src --fix --ext .ts", "format": "npm run -s prettier -- --write", "check-format": "npm run prettier -- --check", - "prettier": "prettier --config ./.prettierrc src/**/*.ts", + "prettier": "prettier --config ./.prettierrc \"src/**/*.ts\"", "build": "rimraf --glob dist/* dist-esm/* types/* && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node publishPackage.js", "build:cjs": "rimraf --glob dist/* dist-esm/* types/* && tsc -p tsconfig-cjs.json && node publishPackage.js", "build:esm": "rimraf --glob dist/* dist-esm/* types/* && tsc -p tsconfig.json && node publishPackage.js", diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md index 4d37ac9687..c15955c988 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md @@ -211,6 +211,12 @@ export interface MultivariateOperations { trainMultivariateModel: (modelInfo: MultivariateModelInfo, options?: MultivariateTrainMultivariateModelOptionalParams) => Promise; } +// @public +export interface MultivariateResponseError { + code: string; + message: string; +} + // @public (undocumented) export interface MultivariateTrainMultivariateModelOptionalParams extends OperationOptions { } @@ -246,6 +252,12 @@ export interface PageSettings { // @public (undocumented) export type TimeGranularity = "yearly" | "monthly" | "weekly" | "daily" | "hourly" | "minutely" | "secondly" | "microsecond" | "none"; +// @public +export interface UnivariateAnomalyDetectorError { + code?: AnomalyDetectorErrorCodes; + message?: string; +} + // @public (undocumented) export interface UnivariateDetectUnivariateChangePointOptionalParams extends OperationOptions { } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts index f6c06bc747..186d7f2789 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts @@ -16,6 +16,7 @@ export { MultivariateAnomalyValue, MultivariateAnomalyInterpretation, MultivariateCorrelationChanges, + MultivariateResponseError, MultivariateModelInfo, DataSchema, MultivariateAlignPolicy, @@ -34,6 +35,7 @@ export { TimeGranularity, ImputeMode, UnivariateUnivariateEntireDetectionResult, + UnivariateAnomalyDetectorError, AnomalyDetectorErrorCodes, UnivariateUnivariateLastDetectionResult, UnivariateUnivariateChangePointDetectionOptions, diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts index 88987de81e..c13ed7b64a 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts @@ -12,6 +12,7 @@ export { MultivariateAnomalyValue, MultivariateAnomalyInterpretation, MultivariateCorrelationChanges, + MultivariateResponseError, MultivariateModelInfo, DataSchema, MultivariateAlignPolicy, @@ -30,6 +31,7 @@ export { TimeGranularity, ImputeMode, UnivariateUnivariateEntireDetectionResult, + UnivariateAnomalyDetectorError, AnomalyDetectorErrorCodes, UnivariateUnivariateLastDetectionResult, UnivariateUnivariateChangePointDetectionOptions, diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts index 84349a367b..c05421c8e0 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts @@ -132,6 +132,14 @@ export interface MultivariateCorrelationChanges { changedVariables?: string[]; } +/** Error response */ +export interface MultivariateResponseError { + /** The error code. */ + code: string; + /** The message explaining the error reported by the service. */ + message: string; +} + /** * Training result of a model including its status, errors and diagnostics * information. @@ -431,6 +439,14 @@ export interface UnivariateUnivariateEntireDetectionResult { severity?: number[]; } +/** Error information returned by the API. */ +export interface UnivariateAnomalyDetectorError { + /** The error code. */ + code?: AnomalyDetectorErrorCodes; + /** A message explaining the error reported by the service. */ + message?: string; +} + /** */ export type AnomalyDetectorErrorCodes = | "InvalidCustomInterval" diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md index 097d13e6eb..43b19b4b6f 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md @@ -234,12 +234,27 @@ export interface MetricDefinition { unit?: MetricUnit; } +// @public +export interface MetricDefinitionCollection { + value: MetricDefinition[]; +} + // @public export interface MetricNamespace { description?: string; name?: string; } +// @public +export interface MetricNamespaceCollection { + value: MetricNamespace[]; +} + +// @public +export interface MetricRequestPayload { + filters?: DimensionFilter[]; +} + // @public (undocumented) export type MetricUnit = "NotSpecified" | "Percent" | "Count" | "Seconds" | "Milliseconds" | "Bytes" | "BytesPerSecond" | "CountPerSecond"; @@ -270,6 +285,12 @@ export interface PagedAsyncIterableIterator>; } +// @public +export interface PagedDimensionValueList { + nextLink?: string; + value: DimensionValueList[]; +} + // @public export interface PagedFileInfo { nextLink?: string; @@ -282,6 +303,18 @@ export interface PagedTest { value: Test[]; } +// @public +export interface PagedTestRun { + nextLink?: string; + value: TestRun[]; +} + +// @public +export interface PagedTimeSeriesElement { + nextLink?: string; + value: TimeSeriesElement[]; +} + // @public export interface PageSettings { continuationToken?: string; @@ -415,6 +448,16 @@ export interface TestRun { readonly virtualUsers?: number; } +// @public +export interface TestRunAppComponents { + components: Record; + readonly createdBy?: string; + readonly createdDateTime?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedDateTime?: string; + readonly testRunId?: string; +} + // @public export interface TestRunArtifacts { readonly inputArtifacts?: TestRunInputArtifacts; @@ -433,22 +476,17 @@ export interface TestRunInputArtifacts { // @public (undocumented) export class TestRunOperationsClient { constructor(endpointParam: string, credential: TokenCredential, options?: TestRunOperationsClientOptions); - // Warning: (ae-forgotten-export) The symbol "TestRunAppComponents" needs to be exported by the entry point index.d.ts - createOrUpdateAppComponents(testRunId: string, body: TestRunAppComponents, options?: TestRunOperationsClientCreateOrUpdateAppComponentsOptionalParams): Promise; - // Warning: (ae-forgotten-export) The symbol "TestRunServerMetricConfig" needs to be exported by the entry point index.d.ts - createOrUpdateServerMetricsConfig(testRunId: string, body: TestRunServerMetricConfig, options?: TestRunOperationsClientCreateOrUpdateServerMetricsConfigOptionalParams): Promise; + createOrUpdateAppComponents(testRunId: string, body: TestRunOperationsClientTestRunAppComponents, options?: TestRunOperationsClientCreateOrUpdateAppComponentsOptionalParams): Promise; + createOrUpdateServerMetricsConfig(testRunId: string, body: TestRunOperationsClientTestRunServerMetricConfig, options?: TestRunOperationsClientCreateOrUpdateServerMetricsConfigOptionalParams): Promise; deleteTestRun(testRunId: string, options?: DeleteTestRunOptionalParams): Promise; - getAppComponents(testRunId: string, options?: TestRunOperationsClientGetAppComponentsOptionalParams): Promise; - getServerMetricsConfig(testRunId: string, options?: TestRunOperationsClientGetServerMetricsConfigOptionalParams): Promise; + getAppComponents(testRunId: string, options?: TestRunOperationsClientGetAppComponentsOptionalParams): Promise; + getServerMetricsConfig(testRunId: string, options?: TestRunOperationsClientGetServerMetricsConfigOptionalParams): Promise; getTestRun(testRunId: string, options?: GetTestRunOptionalParams): Promise; getTestRunFile(testRunId: string, fileName: string, options?: GetTestRunFileOptionalParams): Promise; - // Warning: (ae-forgotten-export) The symbol "MetricDefinitionCollection" needs to be exported by the entry point index.d.ts - listMetricDefinitions(testRunId: string, options?: ListMetricDefinitionsOptionalParams): Promise; + listMetricDefinitions(testRunId: string, options?: ListMetricDefinitionsOptionalParams): Promise; listMetricDimensionValues(testRunId: string, name: string, metricNamespace: string, options?: ListMetricDimensionValuesOptionalParams): TestRunOperationsClientPagedAsyncIterableIterator; - // Warning: (ae-forgotten-export) The symbol "MetricNamespaceCollection" needs to be exported by the entry point index.d.ts - listMetricNamespaces(testRunId: string, options?: ListMetricNamespacesOptionalParams): Promise; - // Warning: (ae-forgotten-export) The symbol "MetricRequestPayload" needs to be exported by the entry point index.d.ts - listMetrics(testRunId: string, body: MetricRequestPayload, options?: ListMetricsOptionalParams): TestRunOperationsClientPagedAsyncIterableIterator; + listMetricNamespaces(testRunId: string, options?: ListMetricNamespacesOptionalParams): Promise; + listMetrics(testRunId: string, body: TestRunOperationsClientMetricRequestPayload, options?: ListMetricsOptionalParams): TestRunOperationsClientPagedAsyncIterableIterator; listTestRuns(options?: ListTestRunsOptionalParams): TestRunOperationsClientPagedAsyncIterableIterator; readonly pipeline: Pipeline; stopTestRun(testRunId: string, options?: StopTestRunOptionalParams): Promise; @@ -574,12 +612,27 @@ export interface TestRunOperationsClientMetricDefinition { unit?: TestRunOperationsClientMetricUnit; } +// @public +export interface TestRunOperationsClientMetricDefinitionCollection { + value: TestRunOperationsClientMetricDefinition[]; +} + // @public export interface TestRunOperationsClientMetricNamespace { description?: string; name?: string; } +// @public +export interface TestRunOperationsClientMetricNamespaceCollection { + value: TestRunOperationsClientMetricNamespace[]; +} + +// @public +export interface TestRunOperationsClientMetricRequestPayload { + filters?: TestRunOperationsClientDimensionFilter[]; +} + // @public (undocumented) export type TestRunOperationsClientMetricUnit = "NotSpecified" | "Percent" | "Count" | "Seconds" | "Milliseconds" | "Bytes" | "BytesPerSecond" | "CountPerSecond"; @@ -615,6 +668,36 @@ export interface TestRunOperationsClientPagedAsyncIterableIterator>; } +// @public +export interface TestRunOperationsClientPagedDimensionValueList { + nextLink?: string; + value: TestRunOperationsClientDimensionValueList[]; +} + +// @public +export interface TestRunOperationsClientPagedFileInfo { + nextLink?: string; + value: TestRunOperationsClientFileInfo[]; +} + +// @public +export interface TestRunOperationsClientPagedTest { + nextLink?: string; + value: TestRunOperationsClientTest[]; +} + +// @public +export interface TestRunOperationsClientPagedTestRun { + nextLink?: string; + value: TestRunOperationsClientTestRun[]; +} + +// @public +export interface TestRunOperationsClientPagedTimeSeriesElement { + nextLink?: string; + value: TestRunOperationsClientTimeSeriesElement[]; +} + // @public export interface TestRunOperationsClientPageSettings { continuationToken?: string; @@ -696,6 +779,16 @@ export interface TestRunOperationsClientTest { readonly testId?: string; } +// @public +export interface TestRunOperationsClientTestAppComponents { + components: Record; + readonly createdBy?: string; + readonly createdDateTime?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedDateTime?: string; + readonly testId?: string; +} + // @public export interface TestRunOperationsClientTestInputArtifacts { readonly additionalFileInfo?: TestRunOperationsClientFileInfo[]; @@ -734,6 +827,16 @@ export interface TestRunOperationsClientTestRun { readonly virtualUsers?: number; } +// @public +export interface TestRunOperationsClientTestRunAppComponents { + components: Record; + readonly createdBy?: string; + readonly createdDateTime?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedDateTime?: string; + readonly testRunId?: string; +} + // @public export interface TestRunOperationsClientTestRunArtifacts { readonly inputArtifacts?: TestRunOperationsClientTestRunInputArtifacts; @@ -755,6 +858,16 @@ export interface TestRunOperationsClientTestRunOutputArtifacts { resultFileInfo?: TestRunOperationsClientFileInfo; } +// @public +export interface TestRunOperationsClientTestRunServerMetricConfig { + readonly createdBy?: string; + readonly createdDateTime?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedDateTime?: string; + metrics?: Record; + readonly testRunId?: string; +} + // @public export interface TestRunOperationsClientTestRunStatistics { readonly errorCount?: number; @@ -773,6 +886,16 @@ export interface TestRunOperationsClientTestRunStatistics { readonly transaction?: string; } +// @public +export interface TestRunOperationsClientTestServerMetricConfig { + readonly createdBy?: string; + readonly createdDateTime?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedDateTime?: string; + metrics?: Record; + readonly testId?: string; +} + // @public (undocumented) export type TestRunOperationsClientTimeGrain = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; @@ -794,6 +917,16 @@ export interface TestRunOutputArtifacts { resultFileInfo?: FileInfo; } +// @public +export interface TestRunServerMetricConfig { + readonly createdBy?: string; + readonly createdDateTime?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedDateTime?: string; + metrics?: Record; + readonly testRunId?: string; +} + // @public export interface TestRunStatistics { readonly errorCount?: number; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/index.ts index af351a3c5a..cf7499d4f2 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/index.ts @@ -38,19 +38,27 @@ export { TestRunOutputArtifacts, PFTestResult, Status, + TestRunAppComponents, + TestRunServerMetricConfig, Interval, DimensionValueList, + MetricDefinitionCollection, MetricDefinition, NameAndDesc, AggregationType, MetricUnit, MetricAvailability, TimeGrain, + MetricNamespaceCollection, MetricNamespace, + MetricRequestPayload, DimensionFilter, + PagedTimeSeriesElement, TimeSeriesElement, MetricValue, DimensionValue, + PagedTestRun, + PagedDimensionValueList, CreateOrUpdateTestOptionalParams, CreateOrUpdateAppComponentsOptionalParams, CreateOrUpdateServerMetricsConfigOptionalParams, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/index.ts index f4d3f6c5d1..de820d25e0 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/index.ts @@ -34,19 +34,27 @@ export { TestRunOutputArtifacts, PFTestResult, Status, + TestRunAppComponents, + TestRunServerMetricConfig, Interval, DimensionValueList, + MetricDefinitionCollection, MetricDefinition, NameAndDesc, AggregationType, MetricUnit, MetricAvailability, TimeGrain, + MetricNamespaceCollection, MetricNamespace, + MetricRequestPayload, DimensionFilter, + PagedTimeSeriesElement, TimeSeriesElement, MetricValue, DimensionValue, + PagedTestRun, + PagedDimensionValueList, } from "./models.js"; export { CreateOrUpdateTestOptionalParams, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/models.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/models.ts index 71100691e3..daab3ea449 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/models.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/models.ts @@ -457,6 +457,47 @@ export type Status = | "FAILED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE"; + +/** Test run app component */ +export interface TestRunAppComponents { + /** + * Azure resource collection { resource id (fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + * : resource object } + */ + components: Record; + /** Test run identifier */ + readonly testRunId?: string; + /** The creation datetime(ISO 8601 literal format). */ + readonly createdDateTime?: string; + /** The user that created. */ + readonly createdBy?: string; + /** The last Modified datetime(ISO 8601 literal format). */ + readonly lastModifiedDateTime?: string; + /** The user that last modified. */ + readonly lastModifiedBy?: string; +} + +/** Test run server metrics configuration */ +export interface TestRunServerMetricConfig { + /** Test run identifier */ + readonly testRunId?: string; + /** + * Azure resource metrics collection {metric id : metrics object} (Refer : + * https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + * for metric id). + */ + metrics?: Record; + /** The creation datetime(ISO 8601 literal format). */ + readonly createdDateTime?: string; + /** The user that created. */ + readonly createdBy?: string; + /** The last Modified datetime(ISO 8601 literal format). */ + readonly lastModifiedDateTime?: string; + /** The user that last modified. */ + readonly lastModifiedBy?: string; +} + /** */ export type Interval = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; @@ -464,6 +505,12 @@ export interface DimensionValueList { value: string[]; } +/** Represents collection of metric definitions. */ +export interface MetricDefinitionCollection { + /** the values for the metric definitions. */ + value: MetricDefinition[]; +} + /** Metric definition */ export interface MetricDefinition { /** List of dimensions */ @@ -527,6 +574,12 @@ export interface MetricAvailability { /** */ export type TimeGrain = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; +/** Represents collection of metric namespaces. */ +export interface MetricNamespaceCollection { + /** The values for the metric namespaces. */ + value: MetricNamespace[]; +} + /** Metric namespace class specifies the metadata for a metric namespace. */ export interface MetricNamespace { /** The namespace description. */ @@ -535,6 +588,17 @@ export interface MetricNamespace { name?: string; } +/** Filters to fetch the set of metric */ +export interface MetricRequestPayload { + /** + * Get metrics for specific dimension values. Example: Metric contains dimension + * like SamplerName, Error. To retrieve all the time series data where SamplerName + * is equals to HTTPRequest1 or HTTPRequest2, the DimensionFilter value will be + * {"SamplerName", ["HTTPRequest1", "HTTPRequest2"} + */ + filters?: DimensionFilter[]; +} + /** Dimension name and values to filter */ export interface DimensionFilter { /** The dimension name */ @@ -543,6 +607,14 @@ export interface DimensionFilter { values?: string[]; } +/** The response to a metrics query. */ +export interface PagedTimeSeriesElement { + /** The TimeSeriesElement items on this page */ + value: TimeSeriesElement[]; + /** The link to the next page of items */ + nextLink?: string; +} + /** The time series returned when a data query is performed. */ export interface TimeSeriesElement { /** An array of data points representing the metric values. */ @@ -566,3 +638,19 @@ export interface DimensionValue { /** The value of the dimension. */ value?: string; } + +/** Collection of test runs */ +export interface PagedTestRun { + /** The TestRun items on this page */ + value: TestRun[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Paged collection of DimensionValueList items */ +export interface PagedDimensionValueList { + /** The DimensionValueList items on this page */ + value: DimensionValueList[]; + /** The link to the next page of items */ + nextLink?: string; +} diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts index 0637abf259..81afd7c170 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts @@ -38,19 +38,27 @@ export { TestRunOutputArtifacts, PFTestResult, Status, + TestRunAppComponents, + TestRunServerMetricConfig, Interval, DimensionValueList, + MetricDefinitionCollection, MetricDefinition, NameAndDesc, AggregationType, MetricUnit, MetricAvailability, TimeGrain, + MetricNamespaceCollection, MetricNamespace, + MetricRequestPayload, DimensionFilter, + PagedTimeSeriesElement, TimeSeriesElement, MetricValue, DimensionValue, + PagedTestRun, + PagedDimensionValueList, CreateOrUpdateTestOptionalParams, CreateOrUpdateAppComponentsOptionalParams, CreateOrUpdateServerMetricsConfigOptionalParams, @@ -89,8 +97,12 @@ export { FileInfo as TestRunOperationsClientFileInfo, FileType as TestRunOperationsClientFileType, FileStatus as TestRunOperationsClientFileStatus, + TestAppComponents as TestRunOperationsClientTestAppComponents, AppComponent as TestRunOperationsClientAppComponent, + TestServerMetricConfig as TestRunOperationsClientTestServerMetricConfig, ResourceMetric as TestRunOperationsClientResourceMetric, + PagedFileInfo as TestRunOperationsClientPagedFileInfo, + PagedTest as TestRunOperationsClientPagedTest, APIVersions as TestRunOperationsClientAPIVersions, TestRun as TestRunOperationsClientTestRun, ErrorDetails as TestRunOperationsClientErrorDetails, @@ -100,19 +112,27 @@ export { TestRunOutputArtifacts as TestRunOperationsClientTestRunOutputArtifacts, PFTestResult as TestRunOperationsClientPFTestResult, Status as TestRunOperationsClientStatus, + TestRunAppComponents as TestRunOperationsClientTestRunAppComponents, + TestRunServerMetricConfig as TestRunOperationsClientTestRunServerMetricConfig, Interval as TestRunOperationsClientInterval, DimensionValueList as TestRunOperationsClientDimensionValueList, + MetricDefinitionCollection as TestRunOperationsClientMetricDefinitionCollection, MetricDefinition as TestRunOperationsClientMetricDefinition, NameAndDesc as TestRunOperationsClientNameAndDesc, AggregationType as TestRunOperationsClientAggregationType, MetricUnit as TestRunOperationsClientMetricUnit, MetricAvailability as TestRunOperationsClientMetricAvailability, TimeGrain as TestRunOperationsClientTimeGrain, + MetricNamespaceCollection as TestRunOperationsClientMetricNamespaceCollection, MetricNamespace as TestRunOperationsClientMetricNamespace, + MetricRequestPayload as TestRunOperationsClientMetricRequestPayload, DimensionFilter as TestRunOperationsClientDimensionFilter, + PagedTimeSeriesElement as TestRunOperationsClientPagedTimeSeriesElement, TimeSeriesElement as TestRunOperationsClientTimeSeriesElement, MetricValue as TestRunOperationsClientMetricValue, DimensionValue as TestRunOperationsClientDimensionValue, + PagedTestRun as TestRunOperationsClientPagedTestRun, + PagedDimensionValueList as TestRunOperationsClientPagedDimensionValueList, TestRunOptionalParams, CreateOrUpdateAppComponentsOptionalParams as TestRunOperationsClientCreateOrUpdateAppComponentsOptionalParams, CreateOrUpdateServerMetricsConfigOptionalParams as TestRunOperationsClientCreateOrUpdateServerMetricsConfigOptionalParams, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/index.ts index a5e9939798..ce69fff7fc 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/index.ts @@ -23,8 +23,12 @@ export { FileInfo, FileType, FileStatus, + TestAppComponents, AppComponent, + TestServerMetricConfig, ResourceMetric, + PagedFileInfo, + PagedTest, APIVersions, TestRun, ErrorDetails, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/index.ts index c12b48b77f..d4e77750f1 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/index.ts @@ -19,8 +19,12 @@ export { FileInfo, FileType, FileStatus, + TestAppComponents, AppComponent, + TestServerMetricConfig, ResourceMetric, + PagedFileInfo, + PagedTest, APIVersions, TestRun, ErrorDetails, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/models.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/models.ts index 813ee32d3b..daab3ea449 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/models.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/models.ts @@ -202,6 +202,26 @@ export type FileStatus = | "VALIDATION_INITIATED" | "VALIDATION_NOT_REQUIRED"; +/** Test app component */ +export interface TestAppComponents { + /** + * Azure resource collection { resource id (fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + * : resource object } + */ + components: Record; + /** Test identifier */ + readonly testId?: string; + /** The creation datetime(ISO 8601 literal format). */ + readonly createdDateTime?: string; + /** The user that created. */ + readonly createdBy?: string; + /** The last Modified datetime(ISO 8601 literal format). */ + readonly lastModifiedDateTime?: string; + /** The user that last modified. */ + readonly lastModifiedBy?: string; +} + /** * An Azure resource object (Refer azure generic resource model : * https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id#genericresource) @@ -226,6 +246,26 @@ export interface AppComponent { kind?: string; } +/** Test server metrics configuration */ +export interface TestServerMetricConfig { + /** Test identifier */ + readonly testId?: string; + /** + * Azure resource metrics collection {metric id : metrics object} (Refer : + * https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + * for metric id). + */ + metrics?: Record; + /** The creation datetime(ISO 8601 literal format). */ + readonly createdDateTime?: string; + /** The user that created. */ + readonly createdBy?: string; + /** The last Modified datetime(ISO 8601 literal format). */ + readonly lastModifiedDateTime?: string; + /** The user that last modified. */ + readonly lastModifiedBy?: string; +} + /** * Associated metric definition for particular metrics of the azure resource ( * Refer : @@ -250,6 +290,22 @@ export interface ResourceMetric { resourceType: string; } +/** Collection of files. */ +export interface PagedFileInfo { + /** The FileInfo items on this page */ + value: FileInfo[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Collection of tests */ +export interface PagedTest { + /** The Test items on this page */ + value: Test[]; + /** The link to the next page of items */ + nextLink?: string; +} + /** */ export type APIVersions = "2022-11-01"; diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md b/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md index 84b6b8449a..e834c044f7 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md @@ -419,6 +419,12 @@ export interface ErrorModel { type: string; } +// @public (undocumented) +export interface ErrorResponse { + // (undocumented) + error: ErrorModel; +} + // @public (undocumented) export interface FilesCreateOptionalParams extends OperationOptions { // (undocumented) diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts index e007f2f3e8..eea3b3d89e 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts @@ -5,6 +5,7 @@ export { OpenAIClient, OpenAIClientOptions } from "./openAIClient.js"; export { CreateModerationRequest, CreateModerationResponse, + ErrorResponse, ErrorModel, CreateImageRequest, ImagesResponse, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts index 8e4000d7cd..91add3cdbf 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts @@ -4,6 +4,7 @@ export { CreateModerationRequest, CreateModerationResponse, + ErrorResponse, ErrorModel, CreateImageRequest, ImagesResponse, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts index fbab89d2a3..503e7064f4 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts @@ -51,6 +51,10 @@ export interface CreateModerationResponse { }[]; } +export interface ErrorResponse { + error: ErrorModel; +} + export interface ErrorModel { type: string; message: string; diff --git a/packages/typespec-test/test/openai_modular/spec/tspconfig.yaml b/packages/typespec-test/test/openai_modular/spec/tspconfig.yaml index 81429f19f1..4efd4b5f90 100644 --- a/packages/typespec-test/test/openai_modular/spec/tspconfig.yaml +++ b/packages/typespec-test/test/openai_modular/spec/tspconfig.yaml @@ -5,7 +5,6 @@ options: azureSdkForJs: false isModularLibrary: true hierarchyClient: false - generateOrphanModels: true "emitter-output-dir": "{project-root}/../generated/typespec-ts" packageDetails: name: "@msinternal/openai_modular" diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md index ebb053fdbe..8adae7b15f 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md @@ -419,6 +419,12 @@ export interface ErrorModel { type: string; } +// @public (undocumented) +export interface ErrorResponse { + // (undocumented) + error: ErrorModel; +} + // @public (undocumented) export interface FilesCreateOptionalParams extends OperationOptions { // (undocumented) diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts index 8b1fcb807a..5e1645033d 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts @@ -4,6 +4,7 @@ export { OpenAIClient, OpenAIClientOptions } from "./openAIClient.js"; export { CreateModerationRequest, CreateModerationResponse, + ErrorResponse, ErrorModel, CreateImageRequest, ImagesResponse, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts index 89945dca55..b25bc60d7d 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts @@ -3,6 +3,7 @@ export { CreateModerationRequest, CreateModerationResponse, + ErrorResponse, ErrorModel, CreateImageRequest, ImagesResponse, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts index c95b175ac9..1ba3558d86 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts @@ -50,6 +50,10 @@ export interface CreateModerationResponse { }[]; } +export interface ErrorResponse { + error: ErrorModel; +} + export interface ErrorModel { type: string; message: string; diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md index e02968fc26..26ee3986d4 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md @@ -41,6 +41,12 @@ export interface PageSettings { continuationToken?: string; } +// @public +export interface Schema { + definition: string; + properties: SchemaProperties; +} + // @public (undocumented) export type SchemaContentTypeValues = "application/json; serialization=Avro" | "application/json; serialization=json" | "text/plain; charset=utf-8" | "text/vnd.ms.protobuf"; diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts index 7fd47eeb61..3229f174b8 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts @@ -11,6 +11,7 @@ export { SchemaContentTypeValues, SchemaProperties, SchemaFormat, + Schema, ContentTypeEnum, ServiceApiVersions, PagedSchemaGroup, diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/index.ts index 8fd80bfa05..b7e1cdc997 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/index.ts @@ -7,6 +7,7 @@ export { SchemaContentTypeValues, SchemaProperties, SchemaFormat, + Schema, ContentTypeEnum, ServiceApiVersions, PagedSchemaGroup, diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts index 778a6d7f36..c23644e09e 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts @@ -38,6 +38,15 @@ export interface SchemaProperties { /** Represents the format of the schema to be stored by the Schema Registry service. */ /** */ export type SchemaFormat = "Avro" | "Json" | "Custom" | "Protobuf"; + +/** The schema content of a schema, along with id and meta properties. */ +export interface Schema { + /** The content of the schema. */ + definition: string; + /** The properties of the schema. */ + properties: SchemaProperties; +} + /** The content type for the schema. */ /** */ export type ContentTypeEnum = diff --git a/packages/typespec-test/test/widget_dpg/tspconfig.yaml b/packages/typespec-test/test/widget_dpg/tspconfig.yaml index 0d3a307709..7da26c3631 100644 --- a/packages/typespec-test/test/widget_dpg/tspconfig.yaml +++ b/packages/typespec-test/test/widget_dpg/tspconfig.yaml @@ -5,7 +5,6 @@ options: multiClient: false azureSdkForJs: false isModularLibrary: true - generateOrphanModels: true "emitter-output-dir": "{project-root}/generated/typespec-ts" packageDetails: name: "@msinternal/widget_dpg" diff --git a/packages/typespec-ts/README.md b/packages/typespec-ts/README.md index a69a9eea02..4417a4ba05 100644 --- a/packages/typespec-ts/README.md +++ b/packages/typespec-ts/README.md @@ -145,14 +145,6 @@ addCredentials: true credentialKeyHeaderName: Your-Subscription-Key ``` -### generateOrphanModels - -By default, we will not generate orphan models, if we want to generate them, we have to enable this option besides the `@access` and `@usage` configurations in client.tsp. - -```yaml -generateOrphanModels: true -``` - # Contributing If you want to contribute on this project read the [contrubuting document](./CONTRIBUTING.md) for more details. diff --git a/packages/typespec-ts/package.json b/packages/typespec-ts/package.json index 7a46c7385f..40f5fda8d6 100644 --- a/packages/typespec-ts/package.json +++ b/packages/typespec-ts/package.json @@ -12,7 +12,7 @@ "lint:fix": "eslint src --fix --ext .ts", "format": "npm run -s prettier -- --write", "check-format": "npm run prettier -- --check", - "prettier": "prettier --config ./.prettierrc src/**/*.ts", + "prettier": "prettier --config ./.prettierrc \"src/**/*.ts\"", "check:tree": "node --loader ts-node/esm ./test/commands/check-clean-tree.ts", "integration-test-ci": "npm run integration-test-ci:rlc && npm run integration-test-ci:modular && npm run integration-test-ci:non-branded-rlc && npm run integration-test-ci:non-branded-modular", "integration-test-ci:rlc": "npm run start-test-server:rlc & npm run copy:typespec && npm run generate-and-run:rlc && npm run stop-test-server", diff --git a/packages/typespec-ts/src/index.ts b/packages/typespec-ts/src/index.ts index 2138193f47..202aa1d063 100644 --- a/packages/typespec-ts/src/index.ts +++ b/packages/typespec-ts/src/index.ts @@ -37,7 +37,7 @@ import { import { transformRLCModel } from "./transform/transform.js"; import { emitContentByBuilder, emitModels } from "./utils/emitUtil.js"; import { createSdkContext } from "@azure-tools/typespec-client-generator-core"; -import { Project, SyntaxKind } from "ts-morph"; +import { Project } from "ts-morph"; import { buildClientContext } from "./modular/buildClientContext.js"; import { emitCodeModel } from "./modular/buildCodeModel.js"; import { @@ -251,10 +251,6 @@ export async function $onEmit(context: EmitContext) { buildRootIndex(modularCodeModel, subClient, rootIndexFile); } - if (!emitterOptions.generateOrphanModels) { - removeUnusedInterfaces(project); - } - for (const file of project.getSourceFiles()) { await emitContentByBuilder( program, @@ -337,87 +333,3 @@ export async function $onEmit(context: EmitContext) { } } } - -/** - * Removing this for now, as it has some problem when we have two models with the same name and only one of them is unused, this function will end up removing the other used models. - */ -export function removeUnusedInterfaces(project: Project) { - const allInterfaces = project.getSourceFiles().flatMap((file) => - file.getInterfaces().map((interfaceDeclaration) => { - return { interfaceDeclaration, filepath: file.getFilePath() }; - }) - ); - - const unusedInterfaces = allInterfaces.filter((interfaceDeclaration) => { - const references = interfaceDeclaration.interfaceDeclaration - .findReferencesAsNodes() - .filter((node) => { - const kind = node.getParent()?.getKind(); - return ( - kind !== SyntaxKind.ExportSpecifier && - kind !== SyntaxKind.InterfaceDeclaration - ); - }); - return references.length === 0; - }); - - unusedInterfaces.forEach((interfaceDeclaration) => { - const references = interfaceDeclaration.interfaceDeclaration - .findReferencesAsNodes() - .filter((node) => { - const kind = node.getParent()?.getKind(); - return kind === SyntaxKind.ExportSpecifier; - }); - const map = new Map(); - references.forEach((node) => { - const exportPath = node.getSourceFile().getFilePath(); - map.set(exportPath, node.getText()); - }); - - // Get the index.ts file - const indexFiles = project.getSourceFiles().filter((file) => { - return file.getFilePath().endsWith("index.ts"); - }); // Adjust the path to your index.ts file - // to make sure the top level index file is in the last - const sortedIndexFiles = indexFiles.sort((idx1, idx2) => { - return ( - idx2.getFilePath().split("/").length - - idx1.getFilePath().split("/").length - ); - }); - - const matchAliasNodes: string[] = []; - for (const indexFile of sortedIndexFiles) { - const filepath = indexFile.getFilePath(); - if (map.has(filepath)) { - // Get all export declarations - const exportDeclarations = indexFile.getExportDeclarations(); - - // Iterate over each export declaration - exportDeclarations.forEach((exportDeclaration) => { - // Find named exports that match the unused interface - const matchingExports = exportDeclaration - .getNamedExports() - .filter((ne) => { - const aliasNode = ne.getAliasNode(); - if ( - aliasNode && - aliasNode.getText() !== map.get(filepath) && - ne.getName() === map.get(filepath) - ) { - matchAliasNodes.push(aliasNode.getText()); - } - return ( - matchAliasNodes.indexOf(ne.getName()) > -1 || - ne.getName() === map.get(filepath) || - ne.getAliasNode()?.getText() === map.get(filepath) - ); - }); - // Remove the matching exports - matchingExports.forEach((me) => me.remove()); - }); - } - } - interfaceDeclaration.interfaceDeclaration.remove(); - }); -} diff --git a/packages/typespec-ts/src/lib.ts b/packages/typespec-ts/src/lib.ts index b4e0071a2d..370e57b104 100644 --- a/packages/typespec-ts/src/lib.ts +++ b/packages/typespec-ts/src/lib.ts @@ -11,7 +11,6 @@ import { Options } from "prettier"; export interface EmitterOptions extends RLCOptions { branded?: boolean; - generateOrphanModels?: boolean; } export const RLCOptionsSchema: JSONSchemaType = { @@ -84,7 +83,6 @@ export const RLCOptionsSchema: JSONSchemaType = { hierarchyClient: { type: "boolean", nullable: true }, branded: { type: "boolean", nullable: true }, flavor: { type: "string", nullable: true }, - generateOrphanModels: { type: "boolean", nullable: true }, moduleKind: { type: "string", nullable: true, diff --git a/packages/typespec-ts/src/modular/helpers/classicalOperationHelpers.ts b/packages/typespec-ts/src/modular/helpers/classicalOperationHelpers.ts index 8fa991ef7a..d3649f2307 100644 --- a/packages/typespec-ts/src/modular/helpers/classicalOperationHelpers.ts +++ b/packages/typespec-ts/src/modular/helpers/classicalOperationHelpers.ts @@ -22,13 +22,19 @@ export function getClassicalOperation( .filter((i) => { return ( i.getModuleSpecifierValue() === - `${"../".repeat(layer + 2)}api/${normalizeName(modularClientName, NameType.File)}.js` + `${"../".repeat(layer + 2)}api/${normalizeName( + modularClientName, + NameType.File + )}.js` ); }); if (!hasClientContextImport || hasClientContextImport.length === 0) { classicFile.addImportDeclaration({ namedImports: [client.rlcClientName], - moduleSpecifier: `${"../".repeat(layer + 2)}api/${normalizeName(modularClientName, NameType.File)}.js` + moduleSpecifier: `${"../".repeat(layer + 2)}api/${normalizeName( + modularClientName, + NameType.File + )}.js` }); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.ts index 11abd21e42..9b321d7224 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.ts @@ -2,4 +2,8 @@ // Licensed under the MIT license. export { ApiKeyClient, ApiKeyClientOptions } from "./apiKeyClient.js"; -export { ValidOptionalParams, InvalidOptionalParams } from "./models/index.js"; +export { + InvalidAuth, + ValidOptionalParams, + InvalidOptionalParams, +} from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/index.ts index 57fb2080f2..f7403a077a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export * from "./models.js"; +export { InvalidAuth } from "./models.js"; export { ValidOptionalParams, InvalidOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/models.ts index fd2aca680c..aa37c4ae0f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/models.ts @@ -1,2 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. + +export interface InvalidAuth { + error: string; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/index.ts index 6708a04f07..3f51907a5e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/index.ts @@ -2,4 +2,8 @@ // Licensed under the MIT license. export { CustomClient, CustomClientOptions } from "./customClient.js"; -export { ValidOptionalParams, InvalidOptionalParams } from "./models/index.js"; +export { + InvalidAuth, + ValidOptionalParams, + InvalidOptionalParams, +} from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/index.ts index 57fb2080f2..f7403a077a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export * from "./models.js"; +export { InvalidAuth } from "./models.js"; export { ValidOptionalParams, InvalidOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/models.ts index fd2aca680c..aa37c4ae0f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/models.ts @@ -1,2 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. + +export interface InvalidAuth { + error: string; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.ts index 07969ed4b7..64f90e3c47 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.ts @@ -2,4 +2,8 @@ // Licensed under the MIT license. export { OAuth2Client, OAuth2ClientOptions } from "./oAuth2Client.js"; -export { ValidOptionalParams, InvalidOptionalParams } from "./models/index.js"; +export { + InvalidAuth, + ValidOptionalParams, + InvalidOptionalParams, +} from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/index.ts index 57fb2080f2..f7403a077a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export * from "./models.js"; +export { InvalidAuth } from "./models.js"; export { ValidOptionalParams, InvalidOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/models.ts index fd2aca680c..aa37c4ae0f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/models.ts @@ -1,2 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. + +export interface InvalidAuth { + error: string; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/index.ts index ebd06e6809..b581550c3c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/index.ts @@ -5,6 +5,7 @@ export { UsageClient, UsageClientOptions } from "./usageClient.js"; export { InputModel, OutputModel, + OrphanModel, InputToInputOutputOptionalParams, OutputToInputOutputOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/index.ts index b1a56b87c9..d8f281984a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { InputModel, OutputModel } from "./models.js"; +export { InputModel, OutputModel, OrphanModel } from "./models.js"; export { InputToInputOutputOptionalParams, OutputToInputOutputOptionalParams, diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/models.ts index ef402a9eae..7a456c8422 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/models.ts @@ -10,3 +10,8 @@ export interface InputModel { export interface OutputModel { name: string; } + +/** Not used anywhere, but access is override to public so still need to be generated and exported with serialization. */ +export interface OrphanModel { + name: string; +}