Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Comment thread
msyyc marked this conversation as resolved.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "violation": true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import "../../lib/imports.tsp";
using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.ResourceManager;

@armProviderNamespace
@service(#{ title: "Test Service" })
@versioned(Versions)
@armCommonTypesVersion(CommonTypes.Versions.v6)
namespace Microsoft.TestService;

enum Versions {
@useDependency(Azure.ResourceManager.CommonTypes.Versions.v6)
v2024_01_01: "2024-01-01",
}

@route("/subscriptions/{subscriptionId}/providers/Microsoft.TestService")
interface Operations {
@get
@route("/locations/{location}/widgets")
listByLocation(
...SubscriptionIdParameter,
...LocationParameter,
): {
@body body: WidgetListResult;
};
}

model WidgetListResult {
value: Widget[];
}

model Widget {
name: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"swagger": "2.0",
"info": {
"title": "Test Service",
"version": "2024-01-01",
"x-typespec-generated": [
{
"emitter": "@azure-tools/typespec-autorest"
}
]
},
"schemes": [
"https"
],
"host": "management.azure.com",
"produces": [
"application/json"
],
"consumes": [
"application/json"
],
"security": [
{
"azure_auth": [
"user_impersonation"
]
}
],
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"description": "Azure Active Directory OAuth2 Flow.",
"flow": "implicit",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"scopes": {
"user_impersonation": "impersonate your user account"
}
}
},
"tags": [],
"paths": {
"/subscriptions/{subscriptionId}/providers/Microsoft.TestService/locations/{location}/widgets": {
"get": {
"operationId": "Operations_ListByLocation",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v6/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/LocationParameter"
}
],
"responses": {
"200": {
"description": "The request has succeeded.",
"schema": {
"$ref": "#/definitions/WidgetListResult"
}
}
}
}
}
},
"definitions": {
"Widget": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"required": [
"name"
]
},
"WidgetListResult": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Widget"
}
}
},
"required": [
"value"
]
}
},
"parameters": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[
{
"code": "tsp-lintdiff-local-linter/latest-version-of-common-types-must-be-used",
"severity": "warning",
"message": "This API version already selects the latest ARM common-types version 'v6', but the common-type parameter 'LocationParameter' resolves to 'types.json' version 'v5'. Replace the TypeSpec usage that produces this legacy reference with a common type supported in 'v6'."
},
{
"code": "@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint",
"severity": "warning",
"message": "Arm namespace TestService is missing the Operations interface. Add \"interface Operations extends Azure.ResourceManager.Operations {}\"."
},
{
"code": "@azure-tools/typespec-azure-core/documentation-required",
"severity": "warning",
"message": "The Model named 'WidgetListResult' should have a documentation or description, use doc comment /** */ to provide it."
},
{
"code": "@azure-tools/typespec-azure-core/documentation-required",
"severity": "warning",
"message": "The ModelProperty named 'value' should have a documentation or description, use doc comment /** */ to provide it."
},
{
"code": "@azure-tools/typespec-azure-core/documentation-required",
"severity": "warning",
"message": "The Model named 'Widget' should have a documentation or description, use doc comment /** */ to provide it."
},
{
"code": "@azure-tools/typespec-azure-core/documentation-required",
"severity": "warning",
"message": "The ModelProperty named 'name' should have a documentation or description, use doc comment /** */ to provide it."
},
{
"code": "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator",
"severity": "warning",
"message": "Each resource interface must have an @armResourceOperations decorator."
},
{
"code": "@azure-tools/typespec-azure-core/operation-missing-api-version",
"severity": "warning",
"message": "Operation is missing an api version parameter."
},
{
"code": "@azure-tools/typespec-azure-core/documentation-required",
"severity": "warning",
"message": "The Operation named 'listByLocation' should have a documentation or description, use doc comment /** */ to provide it."
},
{
"code": "@azure-tools/typespec-azure-resource-manager/arm-resource-operation",
"severity": "warning",
"message": "All Resource operations must use an api-version parameter. Please include Azure.ResourceManager.ApiVersionParameter in the operation parameter list using the spread (...ApiVersionParameter) operator, or using one of the common resource parameter models."
},
{
"code": "@azure-tools/typespec-azure-resource-manager/arm-resource-operation",
"severity": "warning",
"message": "Resource GET operation must be decorated with @armResourceRead or @armResourceList."
},
{
"code": "tsp-lintdiff-local-linter/get-collection-only-has-value-and-next-link",
"severity": "warning",
"message": "Get endpoints for collections of resources must only have the `value` and `nextLink` properties in their model."
},
{
"code": "tsp-lintdiff-local-linter/xms-examples-required",
"severity": "warning",
"message": "Please provide x-ms-examples describing minimum/maximum property set for response/request payloads for operations."
},
{
"code": "tsp-lintdiff-local-linter/xms-pageable-for-list-calls",
"severity": "warning",
"message": "ARM GET operations on list paths that return collection payloads should define x-ms-pageable metadata."
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"code": "LatestVersionOfCommonTypesMustBeUsed",
"message": "Use the latest version v6 of types.json.",
"path": [
"paths",
"/subscriptions/{subscriptionId}/providers/Microsoft.TestService/locations/{location}/widgets",
"get",
"parameters",
"1",
"$ref"
],
"severity": 0
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "violation": true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import "../../lib/imports.tsp";
using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.ResourceManager;

@armProviderNamespace
@service(#{ title: "Test Service" })
@versioned(Versions)
@armCommonTypesVersion(CommonTypes.Versions.v6)
namespace Microsoft.TestService;

enum Versions {
@useDependency(Azure.ResourceManager.CommonTypes.Versions.v6)
v2024_01_01: "2024-01-01",
}

model Widget is TrackedResource<WidgetProperties> {
...Azure.ResourceManager.Legacy.ManagedServiceIdentityV4Property;

@key("widgetName")
@segment("widgets")
@doc("The name of the widget")
@path
@pattern("^[a-zA-Z0-9_-]+$")
name: string;
}

@doc("Widget resource properties.")
model WidgetProperties {
@doc("Widget description.")
description?: string;
}

interface Operations extends Azure.ResourceManager.Operations {}

@armResourceOperations
interface Widgets {
get is ArmResourceRead<Widget>;
createOrUpdate is ArmResourceCreateOrReplaceAsync<Widget>;
}
Loading