Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[typespec-next] Add linter rules to tspconfig.yaml #25675

Merged
merged 15 commits into from
Sep 7, 2023
3 changes: 3 additions & 0 deletions specification/codesigning/CodeSigning/tspconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ parameters:
default: "sdk/codesigning"
emit:
- "@azure-tools/typespec-autorest"
linter:
extends:
- "@azure-tools/typespec-azure-core/all"
options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
Expand Down
1 change: 1 addition & 0 deletions specification/cognitiveservices/AnomalyDetector/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ model AnomalyDetectorApiKeyAuth

#suppress "@azure-tools/typespec-azure-core/documentation-required" "https://github.com/Azure/typespec-azure/issues/3107"
enum APIVersion {
@TypeSpec.Versioning.useDependency(Azure.Core.Versions.v1_0_Preview_2)
v1_1: "v1.1",
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ model MultivariateDetectionResult {
#suppress "@azure-tools/typespec-azure-core/key-visibility-required" "Properties in response-only schemas should not be marked readOnly"
@doc("Result identifier that's used to fetch the results of an inference call.")
@key
@format("uuid")
resultId: string;
resultId: uuid;

@doc("Multivariate anomaly detection status.")
summary: MultivariateBatchDetectionResultSummary;
Expand Down Expand Up @@ -327,8 +326,7 @@ model AnomalyDetectionModel {
#suppress "@azure-tools/typespec-azure-core/key-visibility-required" "Properties in response-only schemas should not be marked readOnly"
@doc("Model identifier.")
@key
@format("uuid")
modelId: string;
modelId: uuid;

@doc("Date and time (UTC) when the model was created.")
createdTime: utcDateTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ For asynchronous inference, get a multivariate anomaly detection result based on
resultId value that the BatchDetectAnomaly API returns.
""")
op getMultivariateBatchDetectionResult(
@format("uuid")
@doc("ID of a batch detection result.")
@path
resultId: string,
resultId: uuid,
): MultivariateDetectionResult | ResponseError;

#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Azure core RpcOperation does not support custom error response"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ parameters:
emit: [
"@azure-tools/typespec-autorest",
]
linter:
extends:
- "@azure-tools/typespec-azure-core/all"
options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ parameters:
default: "sdk/contentsafety"
emit:
- "@azure-tools/typespec-autorest"
linter:
extends:
- "@azure-tools/typespec-azure-core/all"
options:
"@azure-tools/typespec-autorest":
emitter-output-dir: "{project-root}/../"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ alias Response = {
@doc("A processing job identifier.")
@visibility("read")
@key
@format("uuid")
jobId: string;
jobId: Azure.Core.uuid;

@doc("The date and time when the processing job was created.")
@visibility("read")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
emit: []
linter:
extends:
- "@azure-tools/typespec-azure-core/all"
options:
"@azure-tools/typespec-csharp":
namespace : "Azure.Health.Insights.CancerProfiling"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
emit: [
"@azure-tools/typespec-autorest",
]
linter:
extends:
- "@azure-tools/typespec-azure-core/all"
options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
emit: []
linter:
extends:
- "@azure-tools/typespec-azure-core/all"
options:
"@azure-tools/typespec-csharp":
namespace : "Azure.Health.Insights.ClinicalMatching"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ parameters:
default: ""
emit:
- "@azure-tools/typespec-autorest"
linter:
extends:
- "@azure-tools/typespec-azure-core/all"
options:
"@azure-tools/typespec-autorest":
emitter-output-dir: "{project-root}/../"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,11 @@
}
},
"definitions": {
"Azure.Core.uuid": {
"type": "string",
"format": "uuid",
"description": "Universally Unique Identifier"
},
"Multivariate.AlignMode": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -552,8 +557,7 @@
"description": "Response of getting a model.",
"properties": {
"modelId": {
"type": "string",
"format": "uuid",
"$ref": "#/definitions/Azure.Core.uuid",
"description": "Model identifier."
},
"createdTime": {
Expand Down Expand Up @@ -1018,8 +1022,7 @@
"description": "Detection results for the resultId value.",
"properties": {
"resultId": {
"type": "string",
"format": "uuid",
"$ref": "#/definitions/Azure.Core.uuid",
"description": "Result identifier that's used to fetch the results of an inference call."
},
"summary": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,11 @@
}
}
},
"Azure.Core.uuid": {
"type": "string",
"format": "uuid",
"description": "Universally Unique Identifier"
},
"ClinicalCodedElement": {
"type": "object",
"description": "A piece of clinical information, expressed as a code in a clinical coding system.",
Expand Down Expand Up @@ -1526,8 +1531,7 @@
"description": "The response for the Onco Phenotype request.",
"properties": {
"jobId": {
"type": "string",
"format": "uuid",
"$ref": "#/definitions/Azure.Core.uuid",
"description": "A processing job identifier.",
"readOnly": true
},
Expand Down Expand Up @@ -1875,8 +1879,7 @@
"description": "The response for the Trial Matcher request.",
"properties": {
"jobId": {
"type": "string",
"format": "uuid",
"$ref": "#/definitions/Azure.Core.uuid",
"description": "A processing job identifier.",
"readOnly": true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ model Action {
@doc("The name of the action to perform. This should match an action defined in the service's constitution, so that it can be invoked by the `apply` function of the constitution if the proposal is accepted.")
name: string;

#suppress "@azure-tools/typespec-azure-core/no-unknown" "Type can be anything."
@doc("Arguments to modify the behavior of this action. The schema is determined by the action implementation, and should be validated by a `validate` call in the constitution.")
args?: unknown;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
emit:
- "@azure-tools/typespec-autorest"

linter:
extends:
- "@azure-tools/typespec-azure-core/all"

options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "./data-plane"
Expand Down
6 changes: 3 additions & 3 deletions specification/containerservice/Fleet.Management/helpers.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ alias ArmAcceptedResponseWithLocationHeader = ArmAcceptedResponse &
LocationHeader;

#suppress "@azure-tools/typespec-azure-core/documentation-required" "this is a template"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" "this is a template"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "this is a template"
@armResourceAction(TResource)
@post
op ArmResourceNoRequestBodyActionSync<
Expand All @@ -46,7 +46,7 @@ op ArmResourceNoRequestBodyActionSync<
): ArmResponse<TResponse> | ErrorResponse;

#suppress "@azure-tools/typespec-azure-core/documentation-required" "this is a template"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" "this is a template"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "this is a template"
@armResourceAction(TResource)
@extension("x-ms-long-running-operation", true)
@extension(
Expand Down Expand Up @@ -105,7 +105,7 @@ op FleetArmResourceCreateOrUpdateAsync<
): ArmResponse<TResource> | ArmCreatedResponse<TResource> | ErrorResponse;

// this is a copy of ArmResourceDeleteAsync that adds the location header to comply with arm linter.
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" "this is a template"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "this is a template"
#suppress "@azure-tools/typespec-providerhub/no-inline-model" "inlining the response with a header does not present a risk"
@autoRoute
@doc("Delete a {name}", TResource)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
emit:
- '@azure-tools/typespec-autorest'
linter:
extends:
- "@azure-tools/typespec-azure-resource-manager/all"
options:
'@azure-tools/typespec-autorest':
azure-resource-provider-folder: "resource-manager"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ interface Snapshots {
* @template TResource the resource being patched
* @template TBaseParameters Optional. Allows overriding the operation parameters
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" "This is a valid template"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "This is a valid template"
@autoRoute
@doc("Create a {name}", TResource)
@extension("x-ms-long-running-operation", true)
Expand Down Expand Up @@ -472,7 +472,7 @@ model ArmUpdatedResponse<TResource extends Azure.ResourceManager.Foundations.Arm
* @template TResource The resource being deleted
* @template TBaseParameters Optional. Allows overriding the parameters for the operation
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" "This is a valid template"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "This is a valid template"
op ArmResourceDelete2Async<
TResource extends ArmResource,
TBaseParameters = BaseParameters<TResource>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
emit:
- '@azure-tools/typespec-autorest'
linter:
extends:
- "@azure-tools/typespec-azure-resource-manager/all"
options:
'@azure-tools/typespec-autorest':
azure-resource-provider-folder: "resource-manager"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ parameters:
default: ""
emit:
- "@azure-tools/typespec-autorest"
linter:
extends:
- "@azure-tools/typespec-azure-core/all"
options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ parameters:
emit: [
"@azure-tools/typespec-autorest",
]
linter:
extends:
- "@azure-tools/typespec-azure-core/all"
options:
"@azure-tools/typespec-autorest":
examples-directory: examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ model NetworkFunctionResourceProperties {
* @template TResource the resource being patched
* @template TBaseParameters Optional. Allows overriding the operation parameters
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" "This is a valid template"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "This is a valid template"
@autoRoute
@doc("Create a {name}", TResource)
@OpenAPI.extension("x-ms-long-running-operation", true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
emit:
- "@azure-tools/typespec-autorest"
linter:
extends:
- "@azure-tools/typespec-azure-resource-manager/all"
options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "resource-manager"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
emit:
- "@azure-tools/typespec-autorest"
linter:
extends:
- "@azure-tools/typespec-azure-core/all"
parameters:
"service-directory-name":
default: "playwrighttesting"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
emit:
- "@azure-tools/typespec-autorest"
linter:
extends:
- "@azure-tools/typespec-azure-resource-manager/all"
options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "resource-manager"
Expand Down
3 changes: 3 additions & 0 deletions specification/sphere/Sphere.Management/tspconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
emit:
- '@azure-tools/typespec-autorest'
linter:
extends:
- "@azure-tools/typespec-azure-resource-manager/all"
options:
'@azure-tools/typespec-autorest':
emitter-output-dir: "{project-root}/.."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ parameters:
default: "translation"
emit:
- "@azure-tools/typespec-autorest"
linter:
extends:
- "@azure-tools/typespec-azure-core/all"
options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
Expand Down