@azure-tools/typespec-azure-resource-manager 0.74.0-dev.0 → 0.74.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/generated-defs/Azure.ResourceManager.BaseTypes.d.ts +11 -0
- package/dist/generated-defs/Azure.ResourceManager.BaseTypes.d.ts.map +1 -1
- package/dist/generated-defs/Azure.ResourceManager.Legacy.d.ts +33 -0
- package/dist/generated-defs/Azure.ResourceManager.Legacy.d.ts.map +1 -1
- package/dist/generated-defs/Azure.ResourceManager.d.ts +33 -0
- package/dist/generated-defs/Azure.ResourceManager.d.ts.map +1 -1
- package/dist/src/codefixes/delete-property.d.ts +4 -0
- package/dist/src/codefixes/delete-property.d.ts.map +1 -0
- package/dist/src/codefixes/delete-property.js +17 -0
- package/dist/src/codefixes/delete-property.js.map +1 -0
- package/dist/src/lib.d.ts +167 -2
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +66 -0
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +24 -0
- package/dist/src/linter.js.map +1 -1
- package/dist/src/operations.d.ts +1 -2
- package/dist/src/operations.d.ts.map +1 -1
- package/dist/src/operations.js +19 -43
- package/dist/src/operations.js.map +1 -1
- package/dist/src/private.decorators.d.ts +2 -1
- package/dist/src/private.decorators.d.ts.map +1 -1
- package/dist/src/private.decorators.js +40 -10
- package/dist/src/private.decorators.js.map +1 -1
- package/dist/src/resource-name.d.ts +27 -0
- package/dist/src/resource-name.d.ts.map +1 -0
- package/dist/src/resource-name.js +82 -0
- package/dist/src/resource-name.js.map +1 -0
- package/dist/src/resource.d.ts +128 -11
- package/dist/src/resource.d.ts.map +1 -1
- package/dist/src/resource.js +378 -31
- package/dist/src/resource.js.map +1 -1
- package/dist/src/rules/http-response-utils.d.ts +16 -0
- package/dist/src/rules/http-response-utils.d.ts.map +1 -0
- package/dist/src/rules/http-response-utils.js +31 -0
- package/dist/src/rules/http-response-utils.js.map +1 -0
- package/dist/src/rules/list-response-envelope.d.ts +1 -0
- package/dist/src/rules/list-response-envelope.d.ts.map +1 -1
- package/dist/src/rules/list-response-envelope.js +58 -7
- package/dist/src/rules/list-response-envelope.js.map +1 -1
- package/dist/src/rules/model-utils.d.ts +4 -0
- package/dist/src/rules/model-utils.d.ts.map +1 -0
- package/dist/src/rules/model-utils.js +18 -0
- package/dist/src/rules/model-utils.js.map +1 -0
- package/dist/src/rules/no-empty-post-response.d.ts +4 -0
- package/dist/src/rules/no-empty-post-response.d.ts.map +1 -0
- package/dist/src/rules/no-empty-post-response.js +38 -0
- package/dist/src/rules/no-empty-post-response.js.map +1 -0
- package/dist/src/rules/no-tags-on-proxy-resource.d.ts +4 -0
- package/dist/src/rules/no-tags-on-proxy-resource.d.ts.map +1 -0
- package/dist/src/rules/no-tags-on-proxy-resource.js +58 -0
- package/dist/src/rules/no-tags-on-proxy-resource.js.map +1 -0
- package/dist/src/rules/resource-missing-read.d.ts +4 -0
- package/dist/src/rules/resource-missing-read.d.ts.map +1 -0
- package/dist/src/rules/resource-missing-read.js +55 -0
- package/dist/src/rules/resource-missing-read.js.map +1 -0
- package/dist/src/rules/scope-path-segment-casing.d.ts +4 -0
- package/dist/src/rules/scope-path-segment-casing.d.ts.map +1 -0
- package/dist/src/rules/scope-path-segment-casing.js +37 -0
- package/dist/src/rules/scope-path-segment-casing.js.map +1 -0
- package/dist/src/rules/use-resource-path-for-put.d.ts +4 -0
- package/dist/src/rules/use-resource-path-for-put.d.ts.map +1 -0
- package/dist/src/rules/use-resource-path-for-put.js +35 -0
- package/dist/src/rules/use-resource-path-for-put.js.map +1 -0
- package/dist/src/rules/use-scope-for-extension-routing.d.ts +4 -0
- package/dist/src/rules/use-scope-for-extension-routing.d.ts.map +1 -0
- package/dist/src/rules/use-scope-for-extension-routing.js +37 -0
- package/dist/src/rules/use-scope-for-extension-routing.js.map +1 -0
- package/dist/src/rules/use-standard-error.d.ts +5 -0
- package/dist/src/rules/use-standard-error.d.ts.map +1 -0
- package/dist/src/rules/use-standard-error.js +66 -0
- package/dist/src/rules/use-standard-error.js.map +1 -0
- package/dist/src/rules/use-standard-response-codes.d.ts +6 -0
- package/dist/src/rules/use-standard-response-codes.d.ts.map +1 -0
- package/dist/src/rules/use-standard-response-codes.js +67 -0
- package/dist/src/rules/use-standard-response-codes.js.map +1 -0
- package/dist/src/state.d.ts +1 -0
- package/dist/src/state.d.ts.map +1 -1
- package/dist/src/state.js +1 -0
- package/dist/src/state.js.map +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const resourceMissingReadRule: import("@typespec/compiler").LinterRuleDefinition<"resource-missing-read", {
|
|
2
|
+
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
3
|
+
}, Record<string, never>>;
|
|
4
|
+
//# sourceMappingURL=resource-missing-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-missing-read.d.ts","sourceRoot":"","sources":["../../../src/rules/resource-missing-read.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,uBAAuB;;yBA6BlC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createRule, fileRef, getDiscriminator, paramMessage, } from "@typespec/compiler";
|
|
2
|
+
import { getArmResources } from "../resource.js";
|
|
3
|
+
import { getInterface } from "./utils.js";
|
|
4
|
+
export const resourceMissingReadRule = createRule({
|
|
5
|
+
name: "resource-missing-read",
|
|
6
|
+
description: "ARM resources with create or update operations must define a read operation.",
|
|
7
|
+
docs: fileRef.fromPackageRoot("src/rules/resource-missing-read.md"),
|
|
8
|
+
url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/resource-missing-read",
|
|
9
|
+
severity: "warning",
|
|
10
|
+
messages: {
|
|
11
|
+
default: paramMessage `Resource '${"name"}' must have a get/read operation.`,
|
|
12
|
+
},
|
|
13
|
+
create(context) {
|
|
14
|
+
return {
|
|
15
|
+
root: (program) => {
|
|
16
|
+
for (const resource of getArmResources(program)) {
|
|
17
|
+
if (!requiresRead(resource) ||
|
|
18
|
+
resource.operations.lifecycle.read !== undefined ||
|
|
19
|
+
hasDiscriminatorAncestor(program, resource.typespecType)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
context.reportDiagnostic({
|
|
23
|
+
target: getDiagnosticTarget(resource),
|
|
24
|
+
format: { name: resource.name },
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
function requiresRead(resource) {
|
|
32
|
+
return (resource.operations.lifecycle.createOrUpdate !== undefined ||
|
|
33
|
+
resource.operations.lifecycle.update !== undefined);
|
|
34
|
+
}
|
|
35
|
+
function hasDiscriminatorAncestor(program, model) {
|
|
36
|
+
for (let current = model.baseModel; current !== undefined; current = current.baseModel) {
|
|
37
|
+
if (getDiscriminator(program, current) !== undefined) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
function getDiagnosticTarget(resource) {
|
|
44
|
+
return (resource.operations.lifecycle.createOrUpdate?.operation.interface ??
|
|
45
|
+
resource.operations.lifecycle.update?.operation.interface ??
|
|
46
|
+
getInterface(resource) ??
|
|
47
|
+
getOperationInterface(Object.values(resource.operations.lists)) ??
|
|
48
|
+
getOperationInterface(Object.values(resource.operations.actions)) ??
|
|
49
|
+
resource.typespecType);
|
|
50
|
+
}
|
|
51
|
+
function getOperationInterface(operations) {
|
|
52
|
+
return operations.find((operation) => operation?.operation.interface !== undefined)?.operation
|
|
53
|
+
.interface;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=resource-missing-read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-missing-read.js","sourceRoot":"","sources":["../../../src/rules/resource-missing-read.ts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ACnD,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAgB,EAAE,KAAY;IAC9D,KAAK,IAAI,OAAO,GAAG,KAAK,CAAC,SAAS,EAAE,OAAO,KAAK,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;QACvF,IAAI,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,SAAS,EAAE,CAAC;YACrD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,mBAAmB,CAAC,QAA4B;IACvD,OAAO,CACL,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,cAAc,EAAE,SAAS,CAAC,SAAS;QACjE,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS;QACzD,YAAY,CAAC,QAAQ,CAAC;QACtB,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC/D,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACjE,QAAQ,CAAC,YAAY,CACtB,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAC5B,UAAmD;IAEnD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,SAAS,KAAK,SAAS,CAAC,EAAE,SAAS;SAC3F,SAAS,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const scopePathSegmentCasingRule: import("@typespec/compiler").LinterRuleDefinition<"scope-path-segment-casing", {
|
|
2
|
+
readonly default: import("@typespec/compiler").CallableMessage<["actual", "expected"]>;
|
|
3
|
+
}, Record<string, never>>;
|
|
4
|
+
//# sourceMappingURL=scope-path-segment-casing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-path-segment-casing.d.ts","sourceRoot":"","sources":["../../../src/rules/scope-path-segment-casing.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,0BAA0B;;yBAsBrC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createRule, fileRef, paramMessage } from "@typespec/compiler";
|
|
2
|
+
import { getHttpOperation } from "@typespec/http";
|
|
3
|
+
const canonicalSegments = ["resourceGroups", "subscriptions"];
|
|
4
|
+
export const scopePathSegmentCasingRule = createRule({
|
|
5
|
+
name: "scope-path-segment-casing",
|
|
6
|
+
docs: fileRef.fromPackageRoot("src/rules/scope-path-segment-casing.md"),
|
|
7
|
+
severity: "warning",
|
|
8
|
+
description: "ARM paths must use the canonical subscriptions and resourceGroups segment casing.",
|
|
9
|
+
url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/scope-path-segment-casing",
|
|
10
|
+
messages: {
|
|
11
|
+
default: paramMessage `The path segment ${"actual"} should be ${"expected"}.`,
|
|
12
|
+
},
|
|
13
|
+
create(context) {
|
|
14
|
+
return {
|
|
15
|
+
operation: (operation) => {
|
|
16
|
+
const [httpOperation] = getHttpOperation(context.program, operation);
|
|
17
|
+
for (const mismatch of getSegmentCasingMismatches(httpOperation.path)) {
|
|
18
|
+
context.reportDiagnostic({
|
|
19
|
+
target: operation,
|
|
20
|
+
format: mismatch,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
function getSegmentCasingMismatches(path) {
|
|
28
|
+
const mismatches = [];
|
|
29
|
+
for (const actual of path.split("/")) {
|
|
30
|
+
const expected = canonicalSegments.find((segment) => segment.toLowerCase() === actual.toLowerCase());
|
|
31
|
+
if (expected && actual !== expected) {
|
|
32
|
+
mismatches.push({ actual, expected });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return mismatches;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=scope-path-segment-casing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-path-segment-casing.js","sourceRoot":"","sources":["../../../src/rules/scope-path-segment-casing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,iBAAiB,GAAG,CAAC,gBAAgB,EAAE,eAAe,CAAU,CAAC;AAEvE,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;IACnD,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,wCAAwC,CAAC;IACvE,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,mFAAmF;IAChG,GAAG,EAAE,8GAA8G;IACnH,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY,CAAA,oBAAoB,QAAQ,cAAc,UAAU,GAAG;KAC7E;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,MAAM,CAAC,aAAa,CAAC,GAAG,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBACrE,KAAK,MAAM,QAAQ,IAAI,0BAA0B,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;oBACtE,OAAO,CAAC,gBAAgB,CAAC;wBACvB,MAAM,EAAE,SAAS;wBACjB,MAAM,EAAE,QAAQ;qBACjB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,0BAA0B,CAAC,IAAY;IAC9C,MAAM,UAAU,GAA2C,EAAE,CAAC;IAE9D,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CACrC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,WAAW,EAAE,CAC5D,CAAC;QACF,IAAI,QAAQ,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;YACpC,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const useResourcePathForPutRule: import("@typespec/compiler").LinterRuleDefinition<"use-resource-path-for-put", {
|
|
2
|
+
readonly default: import("@typespec/compiler").CallableMessage<["path"]>;
|
|
3
|
+
}, Record<string, never>>;
|
|
4
|
+
//# sourceMappingURL=use-resource-path-for-put.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-resource-path-for-put.d.ts","sourceRoot":"","sources":["../../../src/rules/use-resource-path-for-put.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,yBAAyB;;yBAmCpC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRule, fileRef, getLocationContext, isTemplateInstance, paramMessage, } from "@typespec/compiler";
|
|
2
|
+
import { getHttpOperation } from "@typespec/http";
|
|
3
|
+
import { isTemplatedInterfaceOperation } from "./utils.js";
|
|
4
|
+
const evenSegmentedArmPutPathPattern = /.*\/providers\/\w+\.\w+(\/\w+\/(default|\{\w+\}))+$/;
|
|
5
|
+
export const useResourcePathForPutRule = createRule({
|
|
6
|
+
name: "use-resource-path-for-put",
|
|
7
|
+
description: "ARM PUT paths must end in resource type and resource name pairs.",
|
|
8
|
+
severity: "warning",
|
|
9
|
+
url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/use-resource-path-for-put",
|
|
10
|
+
docs: fileRef.fromPackageRoot("src/rules/use-resource-path-for-put.md"),
|
|
11
|
+
messages: {
|
|
12
|
+
default: paramMessage `ARM PUT path '${"path"}' must end in repeated /{resourceType}/{resourceName} or /{resourceType}/default pairs after the provider namespace.`,
|
|
13
|
+
},
|
|
14
|
+
create(context) {
|
|
15
|
+
return {
|
|
16
|
+
operation: (operation) => {
|
|
17
|
+
if (isTemplateInstance(operation) ||
|
|
18
|
+
isTemplatedInterfaceOperation(operation) ||
|
|
19
|
+
getLocationContext(context.program, operation).type !== "project") {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const [httpOperation] = getHttpOperation(context.program, operation);
|
|
23
|
+
if (httpOperation.verb !== "put" ||
|
|
24
|
+
evenSegmentedArmPutPathPattern.test(httpOperation.path)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
context.reportDiagnostic({
|
|
28
|
+
target: operation,
|
|
29
|
+
format: { path: httpOperation.path },
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=use-resource-path-for-put.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-resource-path-for-put.js","sourceRoot":"","sources":["../../../src/rules/use-resource-path-for-put.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAE3D,MAAM,8BAA8B,GAAG,qDAAqD,CAAC;AAE7F,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC;IAClD,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,kEAAkE;IAC/E,QAAQ,EAAE,SAAS;IACnB,GAAG,EAAE,8GAA8G;IACnH,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,wCAAwC,CAAC;IACvE,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY,CAAA,iBAAiB,MAAM,sHAAsH;KACnK;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IACE,kBAAkB,CAAC,SAAS,CAAC;oBAC7B,6BAA6B,CAAC,SAAS,CAAC;oBACxC,kBAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,IAAI,KAAK,SAAS,EACjE,CAAC;oBACD,OAAO;gBACT,CAAC;gBAED,MAAM,CAAC,aAAa,CAAC,GAAG,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBACrE,IACE,aAAa,CAAC,IAAI,KAAK,KAAK;oBAC5B,8BAA8B,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EACvD,CAAC;oBACD,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,gBAAgB,CAAC;oBACvB,MAAM,EAAE,SAAS;oBACjB,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE;iBACrC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const useScopeForExtensionRoutingRule: import("@typespec/compiler").LinterRuleDefinition<"use-scope-for-extension-routing", {
|
|
2
|
+
readonly default: import("@typespec/compiler").CallableMessage<["path"]>;
|
|
3
|
+
}, Record<string, never>>;
|
|
4
|
+
//# sourceMappingURL=use-scope-for-extension-routing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-scope-for-extension-routing.d.ts","sourceRoot":"","sources":["../../../src/rules/use-scope-for-extension-routing.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,+BAA+B;;yBAiC1C,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createRule, fileRef, isTemplateDeclarationOrInstance, paramMessage, } from "@typespec/compiler";
|
|
2
|
+
import { getHttpOperation } from "@typespec/http";
|
|
3
|
+
import { isTemplatedInterfaceOperation } from "./utils.js";
|
|
4
|
+
export const useScopeForExtensionRoutingRule = createRule({
|
|
5
|
+
name: "use-scope-for-extension-routing",
|
|
6
|
+
docs: fileRef.fromPackageRoot("src/rules/use-scope-for-extension-routing.md"),
|
|
7
|
+
description: "Require scope-based paths when explicitly enabled for RPaaS extension routing.",
|
|
8
|
+
severity: "warning",
|
|
9
|
+
url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/use-scope-for-extension-routing/",
|
|
10
|
+
messages: {
|
|
11
|
+
default: paramMessage `RPaaS extension resource path '${"path"}' must use {scope}/providers/... instead of hardcoding the parent scope.`,
|
|
12
|
+
},
|
|
13
|
+
create(context) {
|
|
14
|
+
return {
|
|
15
|
+
operation: (operation) => {
|
|
16
|
+
if (isTemplateDeclarationOrInstance(operation) ||
|
|
17
|
+
isTemplatedInterfaceOperation(operation)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const [httpOperation] = getHttpOperation(context.program, operation);
|
|
21
|
+
if (countProviderSegments(httpOperation.path) <= 1) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
context.reportDiagnostic({
|
|
25
|
+
target: operation,
|
|
26
|
+
format: {
|
|
27
|
+
path: httpOperation.path,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
function countProviderSegments(path) {
|
|
35
|
+
return path.split("/providers/").length - 1;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=use-scope-for-extension-routing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-scope-for-extension-routing.js","sourceRoot":"","sources":["../../../src/rules/use-scope-for-extension-routing.ts"],"names":[],"mappings":"AAAA,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espec/compiler").LinterRuleDefinition<"use-standard-error", {
|
|
2
|
+
readonly default: "Error responses must have a body using `Azure.ResourceManager.CommonTypes.ErrorResponse` instead of a custom error payload.";
|
|
3
|
+
readonly missingErrorResponse: "Operations must define at least one response marked with `@error`.";
|
|
4
|
+
}, Record<string, never>>;
|
|
5
|
+
//# sourceMappingURL=use-standard-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-standard-error.d.ts","sourceRoot":"","sources":["../../../src/rules/use-standard-error.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,oBAAoB;;;yBAsD/B,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createRule, fileRef, getDiscriminatedUnion, getNamespaceFullName, isErrorModel, isTemplateDeclarationOrInstance, } from "@typespec/compiler";
|
|
2
|
+
import { getOperationVerb, getResponsesForOperation } from "@typespec/http";
|
|
3
|
+
import { getSingleNonNullMember } from "./model-utils.js";
|
|
4
|
+
import { isTemplatedInterfaceOperation } from "./utils.js";
|
|
5
|
+
export const useStandardErrorRule = createRule({
|
|
6
|
+
name: "use-standard-error",
|
|
7
|
+
docs: fileRef.fromPackageRoot("src/rules/use-standard-error.md"),
|
|
8
|
+
url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/use-standard-error",
|
|
9
|
+
description: "Non-HEAD operations must define a response marked with @error and use ErrorResponse from ARM common types for marked error payloads.",
|
|
10
|
+
severity: "warning",
|
|
11
|
+
messages: {
|
|
12
|
+
default: "Error responses must have a body using `Azure.ResourceManager.CommonTypes.ErrorResponse` instead of a custom error payload.",
|
|
13
|
+
missingErrorResponse: "Operations must define at least one response marked with `@error`.",
|
|
14
|
+
},
|
|
15
|
+
create(context) {
|
|
16
|
+
const program = context.program;
|
|
17
|
+
const reported = new Set();
|
|
18
|
+
return {
|
|
19
|
+
operation(operation) {
|
|
20
|
+
const source = operation.node ?? operation;
|
|
21
|
+
if (reported.has(source) ||
|
|
22
|
+
isTemplateDeclarationOrInstance(operation) ||
|
|
23
|
+
isTemplatedInterfaceOperation(operation) ||
|
|
24
|
+
getOperationVerb(program, operation) === "head") {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const errorTypes = [...getResponseTypes(program, operation.returnType)].filter((type) => isErrorModel(program, type));
|
|
28
|
+
if (errorTypes.length === 0) {
|
|
29
|
+
context.reportDiagnostic({ target: operation, messageId: "missingErrorResponse" });
|
|
30
|
+
reported.add(source);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const invalidBody = errorTypes.some((type) => {
|
|
34
|
+
// Resolve each marked variant separately: status groups retain only their first type.
|
|
35
|
+
const [responses] = getResponsesForOperation(program, { ...operation, returnType: type });
|
|
36
|
+
return responses.some((response) => response.responses.some(({ body }) => body === undefined || body.bodyKind !== "single" || !isStandardError(body.type)));
|
|
37
|
+
});
|
|
38
|
+
if (invalidBody) {
|
|
39
|
+
context.reportDiagnostic({ target: operation });
|
|
40
|
+
reported.add(source);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
function isStandardError(type) {
|
|
47
|
+
if (type.kind === "Union") {
|
|
48
|
+
const member = getSingleNonNullMember(type);
|
|
49
|
+
return member !== undefined && isStandardError(member);
|
|
50
|
+
}
|
|
51
|
+
return (type.kind === "Model" &&
|
|
52
|
+
type.name === "ErrorResponse" &&
|
|
53
|
+
type.namespace !== undefined &&
|
|
54
|
+
getNamespaceFullName(type.namespace) === "Azure.ResourceManager.CommonTypes");
|
|
55
|
+
}
|
|
56
|
+
function* getResponseTypes(program, type) {
|
|
57
|
+
if (type.kind === "Union" && getDiscriminatedUnion(program, type)[0] === undefined) {
|
|
58
|
+
for (const variant of type.variants.values()) {
|
|
59
|
+
yield* getResponseTypes(program, variant.type);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
yield type;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=use-standard-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-standard-error.js","sourceRoot":"","sources":["../../../src/rules/use-standard-error.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,+BAA+B,GAIhC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;IAC7C,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,iCAAiC,CAAC;IAChE,GAAG,EAAE,uGAAuG;IAC5G,WAAW,EACT,sIAAsI;IACxI,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE;QACR,OAAO,EACL,6HAA6H;QAC/H,oBAAoB,EAAE,oEAAoE;KAC3F;IACD,MAAM,CAAC,OAAO;QACZ,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAChC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAiC,CAAC;QAE1D,OAAO;YACL,SAAS,CAAC,SAAS;gBACjB,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC;gBAC3C,IACE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;oBACpB,+BAA+B,CAAC,SAAS,CAAC;oBAC1C,6BAA6B,CAAC,SAAS,CAAC;oBACxC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,MAAM,EAC/C,CAAC;oBACD,OAAO;gBACT,CAAC;gBAED,MAAM,UAAU,GAAG,CAAC,GAAG,gBAAgB,CAAC,OAAO,EAA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;QAC5C,OAAO,MAAM,KAAK,SAAS,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,CACL,IAAI,CAAC,IAAI,KAAK,OAAO;QACrB,IAAI,CAAC,IAAI,KAAK,eAAe;QAC7B,IAAI,CAAC,SAAS,KAAK,SAAS;QAC5B,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,mCAAmC,CAC7E,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,CAAC,gBAAgB,CAAC,OAAgB,EAAE,IAAU;IACrD,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,qBAAqB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QACnF,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YAC7C,KAAK,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const useStandardResponseCodesRule: import("@typespec/compiler").LinterRuleDefinition<"use-standard-response-codes", {
|
|
2
|
+
readonly default: import("@typespec/compiler").CallableMessage<["operationName", "statusCode"]>;
|
|
3
|
+
readonly get: "GET operations must include a 200 response and may only use 202 and default as additional response codes.";
|
|
4
|
+
readonly emptyGet: "GET operations must declare at least one response and include a 200 response.";
|
|
5
|
+
}, Record<string, never>>;
|
|
6
|
+
//# sourceMappingURL=use-standard-response-codes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-standard-response-codes.d.ts","sourceRoot":"","sources":["../../../src/rules/use-standard-response-codes.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,4BAA4B;;;;yBAyDvC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createRule, fileRef, getService, isTemplateDeclarationOrInstance, paramMessage, } from "@typespec/compiler";
|
|
2
|
+
import { getHttpOperation } from "@typespec/http";
|
|
3
|
+
import { isStatusCodeAllowed, matchesStatusCode } from "./http-response-utils.js";
|
|
4
|
+
import { isTemplatedInterfaceOperation } from "./utils.js";
|
|
5
|
+
const allowedStatusCodes = new Set([200, 201, 202, 204, "*"]);
|
|
6
|
+
const allowedGetStatusCodes = new Set([200, 202, "*"]);
|
|
7
|
+
export const useStandardResponseCodesRule = createRule({
|
|
8
|
+
name: "use-standard-response-codes",
|
|
9
|
+
docs: fileRef.fromPackageRoot("src/rules/use-standard-response-codes.md"),
|
|
10
|
+
description: "Use standard ARM response codes; GET operations in services must include 200 and may only add 202 or default.",
|
|
11
|
+
severity: "warning",
|
|
12
|
+
url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/use-standard-response-codes",
|
|
13
|
+
messages: {
|
|
14
|
+
default: paramMessage `Operation '${"operationName"}' defines disallowed response status '${"statusCode"}'. Use only 200, 201, 202, 204, or default responses.`,
|
|
15
|
+
get: "GET operations must include a 200 response and may only use 202 and default as additional response codes.",
|
|
16
|
+
emptyGet: "GET operations must declare at least one response and include a 200 response.",
|
|
17
|
+
},
|
|
18
|
+
create(context) {
|
|
19
|
+
return {
|
|
20
|
+
operation: (operation) => {
|
|
21
|
+
if (isTemplateDeclarationOrInstance(operation) ||
|
|
22
|
+
isTemplatedInterfaceOperation(operation)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const [httpOperation] = getHttpOperation(context.program, operation);
|
|
26
|
+
let namespace = operation.namespace;
|
|
27
|
+
while (namespace && !getService(context.program, namespace)) {
|
|
28
|
+
namespace = namespace.namespace;
|
|
29
|
+
}
|
|
30
|
+
if (httpOperation.verb === "get" && namespace) {
|
|
31
|
+
const has200 = httpOperation.responses.some(({ statusCodes }) => matchesStatusCode(statusCodes, 200));
|
|
32
|
+
const hasOnlyAllowedCodes = httpOperation.responses.every(({ statusCodes }) => isStatusCodeAllowed(statusCodes, allowedGetStatusCodes));
|
|
33
|
+
if (!has200 || !hasOnlyAllowedCodes) {
|
|
34
|
+
context.reportDiagnostic({
|
|
35
|
+
target: operation,
|
|
36
|
+
messageId: httpOperation.responses.length === 0 ? "emptyGet" : "get",
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
for (const response of httpOperation.responses) {
|
|
42
|
+
if (!isStatusCodeAllowed(response.statusCodes, allowedStatusCodes)) {
|
|
43
|
+
context.reportDiagnostic({
|
|
44
|
+
target: operation,
|
|
45
|
+
format: {
|
|
46
|
+
operationName: operation.name,
|
|
47
|
+
statusCode: formatStatusCode(response.statusCodes),
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
function formatStatusCode(statusCode) {
|
|
57
|
+
if (statusCode === "*") {
|
|
58
|
+
return "default";
|
|
59
|
+
}
|
|
60
|
+
if (typeof statusCode === "number") {
|
|
61
|
+
return String(statusCode);
|
|
62
|
+
}
|
|
63
|
+
return statusCode.start === statusCode.end
|
|
64
|
+
? String(statusCode.start)
|
|
65
|
+
: `${statusCode.start}-${statusCode.end}`;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=use-standard-response-codes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-standard-response-codes.js","sourceRoot":"","sources":["../../../src/rules/use-standard-response-codes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,+BAA+B,EAC/B,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAA4B,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MA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,CAAC,GAAG;QACxC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;QAC1B,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,IAAI,UAAU,CAAC,GAAG,EAAE,CAAC;AAC9C,CAAC"}
|
package/dist/src/state.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const ArmStateKeys: {
|
|
|
12
12
|
externalTypeRef: symbol;
|
|
13
13
|
armResourceOperationData: symbol;
|
|
14
14
|
resourceOperationList: symbol;
|
|
15
|
+
armResourceNameExpression: symbol;
|
|
15
16
|
armResolvedResources: symbol;
|
|
16
17
|
armResourcesCached: symbol;
|
|
17
18
|
armSingletonResources: symbol;
|
package/dist/src/state.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,YAAY;IACvB,gBAAgB;IAChB,qBAAqB;IACrB,qBAAqB;IACrB,2BAA2B;IAC3B,qBAAqB;IACrB,YAAY;IACZ,oBAAoB;IACpB,wBAAwB;IACxB,qBAAqB;IACrB,cAAc;IACd,eAAe;IACf,wBAAwB;IACxB,qBAAqB;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,YAAY;IACvB,gBAAgB;IAChB,qBAAqB;IACrB,qBAAqB;IACrB,2BAA2B;IAC3B,qBAAqB;IACrB,YAAY;IACZ,oBAAoB;IACpB,wBAAwB;IACxB,qBAAqB;IACrB,cAAc;IACd,eAAe;IACf,wBAAwB;IACxB,qBAAqB;IACrB,yBAAyB;IAGzB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,gBAAgB;IAChB,kBAAkB;IAClB,mBAAmB;IACnB,UAAU;IACV,aAAa;IACb,iBAAiB;IACjB,iBAAiB;IAGjB,iBAAiB;IACjB,oBAAoB;IAGpB,oBAAoB;IACpB,mBAAmB;IACnB,sBAAsB;IACtB,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,eAAe;IAGf,cAAc;CACf,CAAC"}
|
package/dist/src/state.js
CHANGED
|
@@ -18,6 +18,7 @@ export const ArmStateKeys = {
|
|
|
18
18
|
externalTypeRef: azureResourceManagerCreateStateSymbol("externalTypeRef"),
|
|
19
19
|
armResourceOperationData: azureResourceManagerCreateStateSymbol("armResourceOperationData"),
|
|
20
20
|
resourceOperationList: azureResourceManagerCreateStateSymbol("resourceOperationList"),
|
|
21
|
+
armResourceNameExpression: azureResourceManagerCreateStateSymbol("armResourceNameExpression"),
|
|
21
22
|
// resource.ts
|
|
22
23
|
armResolvedResources: azureResourceManagerCreateStateSymbol("armResolvedResources"),
|
|
23
24
|
armResourcesCached: azureResourceManagerCreateStateSymbol("armResourcesCached"),
|
package/dist/src/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/state.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,qBAAqB;AACrB,2DAA2D;AAC3D,SAAS,qCAAqC,CAAC,IAAY;IACzD,OAAO,MAAM,CAAC,GAAG,CAAC,gDAAgD,IAAI,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,gBAAgB,EAAE,qCAAqC,CAAC,kBAAkB,CAAC;IAC3E,qBAAqB,EAAE,qCAAqC,CAAC,uBAAuB,CAAC;IACrF,qBAAqB,EAAE,qCAAqC,CAAC,uBAAuB,CAAC;IACrF,2BAA2B,EAAE,qCAAqC,CAAC,6BAA6B,CAAC;IACjG,qBAAqB,EAAE,qCAAqC,CAAC,oBAAoB,CAAC;IAClF,YAAY,EAAE,qCAAqC,CAAC,cAAc,CAAC;IACnE,oBAAoB,EAAE,qCAAqC,CAAC,sBAAsB,CAAC;IACnF,wBAAwB,EAAE,qCAAqC,CAAC,0BAA0B,CAAC;IAC3F,q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C,sBAAsB,CAAC;IACnF,kBAAkB,EAAE,qCAAqC,CAAC,oBAAoB,CAAC;IAC/E,qBAAqB,EAAE,qCAAqC,CAAC,uBAAuB,CAAC;IACrF,gBAAgB,EAAE,qCAAqC,CAAC,qBAAqB,CAAC;IAC9E,kBAAkB,EAAE,qCAAqC,CAAC,qBAAqB,CAAC;IAChF,mBAAmB,EAAE,qCAAqC,CAAC,qBAAqB,CAAC;IACjF,UAAU,EAAE,qCAAqC,CAAC,YAAY,CAAC;IAC/D,aAAa,EAAE,qCAAqC,CAAC,eAAe,CAAC;IACrE,iBAAiB,EAAE,qCAAqC,CAAC,mBAAmB,CAAC;IAC7E,iBAAiB,EAAE,qCAAqC,CAAC,mBAAmB,CAAC;IAE7E,uBAAuB;IACvB,iBAAiB,EAAE,qCAAqC,CAAC,mBAAmB,CAAC;IAC7E,oBAAoB,EAAE,qCAAqC,CAAC,sBAAsB,CAAC;IAEnF,oCAAoC;IACpC,oBAAoB,EAAE,qCAAqC,CAAC,sBAAsB,CAAC;IACnF,mBAAmB,EAAE,qCAAqC,CAAC,qBAAqB,CAAC;IACjF,sBAAsB,EAAE,qCAAqC,CAAC,wBAAwB,CAAC;IACvF,gBAAgB,EAAE,qCAAqC,CAAC,kBAAkB,CAAC;IAC3E,eAAe,EAAE,qCAAqC,CAAC,iBAAiB,CAAC;IACzE,eAAe,EAAE,qCAAqC,CAAC,iBAAiB,CAAC;IACzE,eAAe,EAAE,qCAAqC,CAAC,iBAAiB,CAAC;IAEzE,gBAAgB;IAChB,cAAc,EAAE,qCAAqC,CAAC,gBAAgB,CAAC;CACxE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-azure-resource-manager",
|
|
3
|
-
"version": "0.74.0-dev.
|
|
3
|
+
"version": "0.74.0-dev.10",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec Azure Resource Manager library",
|
|
6
6
|
"homepage": "https://azure.github.io/typespec-azure",
|
|
@@ -47,28 +47,28 @@
|
|
|
47
47
|
"pluralize": "^8.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@azure-tools/typespec-azure-core": "^0.73.0 || >= 0.74.0-dev.
|
|
50
|
+
"@azure-tools/typespec-azure-core": "^0.73.0 || >= 0.74.0-dev.4",
|
|
51
51
|
"@typespec/compiler": "^1.17.0",
|
|
52
|
-
"@typespec/http": "^1.17.0",
|
|
53
52
|
"@typespec/rest": "^0.87.0",
|
|
53
|
+
"@typespec/openapi": "^1.17.0",
|
|
54
54
|
"@typespec/versioning": "^0.87.0",
|
|
55
|
-
"@typespec/
|
|
55
|
+
"@typespec/http": "^1.17.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@azure-tools/typespec-azure-core": "^0.73.0 || >= 0.74.0-dev.
|
|
59
|
-
"@types/node": "^26.
|
|
58
|
+
"@azure-tools/typespec-azure-core": "^0.73.0 || >= 0.74.0-dev.4",
|
|
59
|
+
"@types/node": "^26.6.4",
|
|
60
60
|
"@types/pluralize": "^0.0.33",
|
|
61
|
-
"@vitest/coverage-v8": "^5.0.
|
|
62
|
-
"@vitest/ui": "^5.0.
|
|
61
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
62
|
+
"@vitest/ui": "^5.0.5",
|
|
63
63
|
"rimraf": "^6.1.3",
|
|
64
64
|
"typescript": "npm:@typescript/typescript6@~6.0.2",
|
|
65
|
-
"vitest": "^5.0.
|
|
65
|
+
"vitest": "^5.0.5",
|
|
66
66
|
"@typespec/compiler": "^1.17.0",
|
|
67
|
-
"@typespec/library-linter": "^0.87.0",
|
|
68
67
|
"@typespec/http": "^1.17.0",
|
|
69
|
-
"@typespec/
|
|
68
|
+
"@typespec/library-linter": "^0.87.0",
|
|
70
69
|
"@typespec/rest": "^0.87.0",
|
|
71
70
|
"@typespec/tspd": "^0.77.1",
|
|
71
|
+
"@typespec/versioning": "^0.87.0",
|
|
72
72
|
"@typespec/openapi": "^1.17.0"
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|