Skip to content

Commit 9928ed1

Browse files
mikeharderharryli0108
authored andcommitted
[TypeSpec CI] Ensure TypeSpec sources are formatted according to "tsp format" (Azure#24041)
1 parent 9b22d1a commit 9928ed1

File tree

28 files changed

+713
-640
lines changed

28 files changed

+713
-640
lines changed

eng/pipelines/templates/steps/typespec-ci.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,16 @@ steps:
2424
fi
2525
2626
# Pass "--no" to ensure npx does not install anything (TypeSpec compiler should already be installed)
27-
27+
2828
if test -f main.tsp; then
2929
npx --no tsp compile . --warn-as-error || exit_code=1
3030
fi
3131
if test -f client.tsp; then
3232
npx --no tsp compile client.tsp --no-emit --warn-as-error || exit_code=1
3333
fi
34-
3534
36-
# Format parent folder to include shared files (disabled until formatting diffs are fixed)
37-
# npx tsp format ../**/*.tsp
35+
# Format parent folder to include shared files
36+
npx tsp format ../**/*.tsp
3837
3938
popd
4039

specification/cognitiveservices/AnomalyDetector/client.tsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ import "./main.tsp";
33

44
using Azure.ClientGenerator.Core;
55

6-
@@convenientAPI(AnomalyDetector.Univariate.detectUnivariateEntireSeries, false)
6+
@@convenientAPI(AnomalyDetector.Univariate.detectUnivariateEntireSeries, false);

specification/cognitiveservices/AnomalyDetector/main.tsp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ using TypeSpec.Http;
99
using TypeSpec.Versioning;
1010

1111
@versioned(APIVersion)
12-
@service({title: "Anomaly Detector"})
12+
@service({
13+
title: "Anomaly Detector",
14+
})
1315
@useAuth(AnomalyDetectorApiKeyAuth)
1416
@server(
1517
"{Endpoint}/anomalydetector/{ApiVersion}",
@@ -20,7 +22,7 @@ Supported Azure Cognitive Services endpoints (protocol and host name, such as
2022
https://westus2.api.cognitive.microsoft.com).
2123
""")
2224
Endpoint: string,
23-
25+
2426
@doc("Api Version")
2527
@path
2628
ApiVersion: APIVersion,
@@ -47,7 +49,8 @@ discover incidents and establish a logic flow for root cause analysis.
4749
namespace AnomalyDetector;
4850

4951
@doc("The secret key for your Azure Cognitive Services subscription.")
50-
model AnomalyDetectorApiKeyAuth is ApiKeyAuth<ApiKeyLocation.header, "Ocp-Apim-Subscription-Key">;
52+
model AnomalyDetectorApiKeyAuth
53+
is ApiKeyAuth<ApiKeyLocation.header, "Ocp-Apim-Subscription-Key">;
5154

5255
#suppress "@azure-tools/typespec-azure-core/documentation-required" "https://github.com/Azure/typespec-azure/issues/3107"
5356
enum APIVersion {

specification/cognitiveservices/AnomalyDetector/multivariate/models.tsp

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ namespace AnomalyDetector.Multivariate;
1111
#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update"
1212
@doc("Field that indicates how missing values will be filled.")
1313
enum FillNAMethod {
14-
"Previous",
15-
"Subsequent",
16-
"Linear",
17-
"Zero",
18-
"Fixed",
14+
Previous,
15+
Subsequent,
16+
Linear,
17+
Zero,
18+
Fixed,
1919
}
2020

2121
#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update"
@@ -29,25 +29,29 @@ enum MultivariateBatchDetectionStatus {
2929
@doc("Data schema of the input data source. The default is OneTable.")
3030
enum DataSchema {
3131
@doc("OneTable means that your input data is in one CSV file, which contains one time stamp column and several variable columns. The default DataSchema value is OneTable.")
32-
"OneTable",
32+
OneTable,
33+
3334
@doc("MultiTable means that your input data is separated in multiple CSV files. Each file contains one time stamp column and one variable column, and the CSV file name should indicate the name of the variable. The default DataSchema value is OneTable.")
34-
"MultiTable",
35+
MultiTable,
3536
}
3637

3738
#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update"
3839
enum AlignMode {
39-
"Inner",
40-
"Outer",
40+
Inner,
41+
Outer,
4142
}
4243

4344
#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update"
4445
enum ModelStatus {
4546
@doc("The model has been created. Training has been scheduled but not yet started.")
4647
Created: "CREATED",
48+
4749
@doc("The model is being trained.")
4850
Running: "RUNNING",
51+
4952
@doc("The model has been trained and is ready to be used for anomaly detection.")
5053
Ready: "READY",
54+
5155
@doc("The model training failed.")
5256
Failed: "FAILED",
5357
}
@@ -75,6 +79,7 @@ model MultivariateBatchDetectionResultSummary {
7579

7680
@doc("Error message when detection fails.")
7781
errors?: ErrorResponse[];
82+
7883
@doc("Variable status.")
7984
variableStates?: VariableState[];
8085

@@ -88,7 +93,6 @@ will need another API to get detection results.
8893
@doc("Error information that the API returned.")
8994
@error
9095
model ErrorResponse {
91-
9296
@doc("Error code.")
9397
code: string;
9498

@@ -154,6 +158,7 @@ be in ISO 8601 format.
154158
model AnomalyState {
155159
@doc("Time stamp for this anomaly.")
156160
timestamp: utcDateTime;
161+
157162
@doc("Detailed value of this anomalous time stamp.")
158163
value?: AnomalyValue;
159164

@@ -180,6 +185,7 @@ Raw anomaly score of severity, to help indicate the degree of abnormality.
180185
@minValue(0.0)
181186
@maxValue(2.0)
182187
score: float32;
188+
183189
@doc("Interpretation of this anomalous time stamp.")
184190
interpretation?: AnomalyInterpretation[];
185191
}
@@ -194,6 +200,7 @@ This score shows the percentage that contributes to the anomalous time stamp. It
194200
number between 0 and 1.
195201
""")
196202
contributionScore?: float32;
203+
197204
@doc("Correlation changes among the anomalous variables.")
198205
correlationChanges?: CorrelationChanges;
199206
}
@@ -285,6 +292,7 @@ Field that indicates how missing values will be filled.
285292
model DiagnosticsInfo {
286293
@doc("Model status.")
287294
modelState?: ModelState;
295+
288296
@doc("Variable status.")
289297
variableStates?: VariableState[];
290298
}
@@ -381,11 +389,11 @@ model VariableValues {
381389
values: float32[];
382390
}
383391

384-
385392
@doc("Results of the last detection.")
386393
model MultivariateLastDetectionResult {
387394
@doc("Variable status.")
388395
variableStates?: VariableState[];
396+
389397
@doc("Anomaly status and information.")
390398
results?: AnomalyState[];
391399
}
@@ -395,6 +403,6 @@ model MultivariateLastDetectionResult {
395403
model ResponseError {
396404
@header("x-ms-error-code")
397405
@doc("Error code.")
398-
msErrorCode?: string,
399-
...ErrorResponse
406+
msErrorCode?: string;
407+
...ErrorResponse;
400408
}

specification/cognitiveservices/AnomalyDetector/multivariate/routes.tsp

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ resultId value that the BatchDetectAnomaly API returns.
3434
op getMultivariateBatchDetectionResult(
3535
@format("uuid")
3636
@doc("ID of a batch detection result.")
37-
@path resultId: string,
37+
@path
38+
resultId: string
3839
): MultivariateDetectionResult | ResponseError;
3940

4041
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Azure core RpcOperation does not support custom error response"
@@ -57,15 +58,19 @@ op trainMultivariateModel is MultivariateServiceAction<
5758
// TParams
5859
{
5960
@doc("Model information.")
60-
@body modelInfo: ModelInfo,
61+
@body
62+
modelInfo: ModelInfo;
6163
},
6264
// TResponse
6365
{
64-
@statusCode statusCode: 201,
66+
@statusCode statusCode: 201;
67+
6568
@doc("Location and ID of the model.")
66-
@header location: string,
67-
@body result: AnomalyDetectionModel
68-
}>;
69+
@header
70+
location: string;
71+
@body result: AnomalyDetectionModel;
72+
}
73+
>;
6974

7075
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Does not fit any standard operation pattern"
7176
// This operation does not fit any standard operation pattern.
@@ -79,10 +84,9 @@ op trainMultivariateModel is MultivariateServiceAction<
7984
@doc("List models of a resource.")
8085
op listMultivariateModels(
8186
...SkipQueryParameter,
82-
...TopQueryParameter,
87+
...TopQueryParameter
8388
): ModelList | ResponseError;
8489

85-
8690
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Does not fit any standard operation pattern"
8791
// This operation does not fit any standard operation pattern.
8892
// The closest match is probably ResourceDelete, but that can't be used because
@@ -94,13 +98,12 @@ op listMultivariateModels(
9498
op deleteMultivariateModel(
9599
@doc("Model identifier.")
96100
@path
97-
modelId: string,
101+
modelId: string
98102
): {
99103
@doc("Delete model successfully.")
100104
@statusCode
101-
statusCode: 204
102-
} | ResponseError;
103-
105+
statusCode: 204;
106+
} | ResponseError;
104107

105108
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Does not fit any standard operation pattern"
106109
// This operation does not fit any standard operation pattern.
@@ -116,7 +119,7 @@ and variables used in the model.
116119
op getMultivariateModel(
117120
@doc("Model identifier.")
118121
@path
119-
modelId: string,
122+
modelId: string
120123
): AnomalyDetectionModel | ResponseError;
121124

122125
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Does not fit any standard operation pattern"
@@ -138,18 +141,23 @@ op detectMultivariateBatchAnomaly(
138141
@doc("Model identifier.")
139142
@path
140143
modelId: string,
144+
141145
@doc("Request of multivariate anomaly detection.")
142-
@body options: MultivariateBatchDetectionOptions,
146+
@body
147+
options: MultivariateBatchDetectionOptions
143148
): {
144-
@statusCode statusCode: 202,
149+
@statusCode statusCode: 202;
150+
145151
@doc("ID of the detection result.")
146-
@header("Operation-Id") operationId: string,
152+
@header("Operation-Id")
153+
operationId: string;
154+
147155
@doc("Location of the detection result.")
148-
@header("Operation-Location") operationLocation: string,
149-
@body result: MultivariateDetectionResult,
156+
@header("Operation-Location")
157+
operationLocation: string;
158+
@body result: MultivariateDetectionResult;
150159
} | ResponseError;
151160

152-
153161
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Does not fit any standard operation pattern"
154162
// This operation does not fit any standard operation pattern.
155163
// The closest match is probably ResourceAction, but that can't be used because
@@ -166,6 +174,8 @@ op detectMultivariateLastAnomaly(
166174
@doc("Model identifier.")
167175
@path
168176
modelId: string,
177+
169178
@doc("Request of the last detection.")
170-
@body options: MultivariateLastDetectionOptions,
179+
@body
180+
options: MultivariateLastDetectionOptions
171181
): MultivariateLastDetectionResult | ResponseError;

specification/cognitiveservices/AnomalyDetector/univariate/models.tsp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ enum ImputeMode {
2020

2121
#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update"
2222
enum AnomalyDetectorErrorCodes {
23-
"InvalidCustomInterval",
24-
"BadArgument",
25-
"InvalidGranularity",
26-
"InvalidPeriod",
27-
"InvalidModelArgument",
28-
"InvalidSeries",
29-
"InvalidJsonFormat",
30-
"RequiredGranularity",
31-
"RequiredSeries",
32-
"InvalidImputeMode",
33-
"InvalidImputeFixedValue",
23+
InvalidCustomInterval,
24+
BadArgument,
25+
InvalidGranularity,
26+
InvalidPeriod,
27+
InvalidModelArgument,
28+
InvalidSeries,
29+
InvalidJsonFormat,
30+
RequiredGranularity,
31+
RequiredSeries,
32+
InvalidImputeMode,
33+
InvalidImputeFixedValue,
3434
}
3535

3636
#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update"
@@ -176,7 +176,7 @@ severe the anomaly is. For normal points, the severity is always 0.
176176
model AnomalyDetectorError {
177177
@header("x-ms-error-code")
178178
@doc("Error code.")
179-
msErrorCode: string,
179+
msErrorCode: string;
180180

181181
@doc("Error code.")
182182
code: AnomalyDetectorErrorCodes;

specification/cognitiveservices/AnomalyDetector/univariate/routes.tsp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ op detectUnivariateEntireSeries is UnivariateServiceAction<
2929
// TParams
3030
{
3131
@doc("Method of univariate anomaly detection.")
32-
@body options: UnivariateDetectionOptions,
32+
@body
33+
options: UnivariateDetectionOptions;
3334
},
3435
// TResponse
35-
UnivariateEntireDetectionResult>;
36+
UnivariateEntireDetectionResult
37+
>;
3638

3739
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Azure core RpcOperation does not support custom error response"
3840
// https://github.com/Azure/typespec-azure/issues/2795
@@ -46,10 +48,12 @@ op detectUnivariateLastPoint is UnivariateServiceAction<
4648
// TParams
4749
{
4850
@doc("Method of univariate anomaly detection.")
49-
@body options: UnivariateDetectionOptions,
51+
@body
52+
options: UnivariateDetectionOptions;
5053
},
5154
// TResponse
52-
UnivariateLastDetectionResult>;
55+
UnivariateLastDetectionResult
56+
>;
5357

5458
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Azure core RpcOperation does not support custom error response"
5559
// https://github.com/Azure/typespec-azure/issues/2795
@@ -60,7 +64,9 @@ op detectUnivariateChangePoint is UnivariateServiceAction<
6064
// TParams
6165
{
6266
@doc("Method of univariate anomaly detection.")
63-
@body options: UnivariateChangePointDetectionOptions,
67+
@body
68+
options: UnivariateChangePointDetectionOptions;
6469
},
6570
// TResponse
66-
UnivariateChangePointDetectionResult>;
71+
UnivariateChangePointDetectionResult
72+
>;

specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/client.tsp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ import "../healthinsights.openapi/service.tsp";
99
using Azure.ClientGenerator.Core;
1010

1111
@TypeSpec.Versioning.useDependency(Azure.Core.Versions.v1_0_Preview_1)
12-
@TypeSpec.Versioning.useDependency(AzureHealthInsights.ApiVersion.v2023_03_01_preview)
12+
@TypeSpec.Versioning.useDependency(
13+
AzureHealthInsights.ApiVersion.v2023_03_01_preview
14+
)
1315
namespace ClientForAzureHealthInsights;
1416

1517
@client({
16-
name: "CancerProfilingClient",
17-
service: AzureHealthInsights
18+
name: "CancerProfilingClient",
19+
service: AzureHealthInsights,
1820
})
19-
interface CancerProfilingClient {
21+
interface CancerProfilingClient {
2022
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "https://github.com/microsoft/typespec/issues/2037"
2123
inferCancerProfile is AzureHealthInsights.OncoPhenotype.createJob;
2224
}

0 commit comments

Comments
 (0)