@azure-tools/typespec-azure-core 0.31.0-dev.1 → 0.31.0-dev.3
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/dist/src/rules/no-operation-id.d.ts.map +1 -1
- package/dist/src/rules/no-operation-id.js +9 -7
- package/dist/src/rules/no-operation-id.js.map +1 -1
- package/dist/src/rules/require-docs.d.ts.map +1 -1
- package/dist/src/rules/require-docs.js +18 -0
- package/dist/src/rules/require-docs.js.map +1 -1
- package/lib/azure-core.tsp +3 -0
- package/lib/foundations.tsp +7 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-operation-id.d.ts","sourceRoot":"","sources":["../../../src/rules/no-operation-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-operation-id.d.ts","sourceRoot":"","sources":["../../../src/rules/no-operation-id.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe,mCAmB1B,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createRule } from "@typespec/lint";
|
|
2
|
-
import { getOperationId } from "@typespec/openapi";
|
|
3
2
|
import { reportDiagnostic } from "../lib.js";
|
|
4
3
|
import { isExcludedCoreType } from "./utils.js";
|
|
5
4
|
export const operationIdRule = createRule({
|
|
@@ -9,12 +8,15 @@ export const operationIdRule = createRule({
|
|
|
9
8
|
operation: (operation) => {
|
|
10
9
|
if (isExcludedCoreType(program, operation))
|
|
11
10
|
return;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
for (const dec of operation.decorators) {
|
|
12
|
+
// See issue https://github.com/microsoft/typespec/issues/1943 for more precise
|
|
13
|
+
if (dec.decorator.name === "$operationId") {
|
|
14
|
+
reportDiagnostic(program, {
|
|
15
|
+
code: "no-operation-id",
|
|
16
|
+
format: { operationId: operation.name },
|
|
17
|
+
target: operation,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
21
|
},
|
|
20
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-operation-id.js","sourceRoot":"","sources":["../../../src/rules/no-operation-id.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"no-operation-id.js","sourceRoot":"","sources":["../../../src/rules/no-operation-id.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,IAAI,EAAE,iBAAiB;IACvB,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAoB,EAAE,EAAE;gBAClC,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC;oBAAE,OAAO;gBACnD,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,UAAU,EAAE;oBACtC,+EAA+E;oBAC/E,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,cAAc,EAAE;wBACzC,gBAAgB,CAAC,OAAO,EAAE;4BACxB,IAAI,EAAE,iBAAiB;4BACvB,MAAM,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,IAAI,EAAE;4BACvC,MAAM,EAAE,SAAS;yBAClB,CAAC,CAAC;qBACJ;iBACF;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-docs.d.ts","sourceRoot":"","sources":["../../../src/rules/require-docs.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"require-docs.d.ts","sourceRoot":"","sources":["../../../src/rules/require-docs.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,oBAAoB,mCA6E/B,CAAC"}
|
|
@@ -6,6 +6,24 @@ export const requireDocumentation = createRule({
|
|
|
6
6
|
name: "documentation-required",
|
|
7
7
|
create({ program }) {
|
|
8
8
|
return {
|
|
9
|
+
enum: (enumObj) => {
|
|
10
|
+
if (!getDoc(program, enumObj) && !isExcludedCoreType(program, enumObj)) {
|
|
11
|
+
reportDiagnostic(program, {
|
|
12
|
+
code: "documentation-required",
|
|
13
|
+
target: enumObj,
|
|
14
|
+
format: { kind: enumObj.kind, name: enumObj.name },
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
for (const member of enumObj.members.values()) {
|
|
18
|
+
if (!getDoc(program, member)) {
|
|
19
|
+
reportDiagnostic(program, {
|
|
20
|
+
code: "documentation-required",
|
|
21
|
+
target: member,
|
|
22
|
+
format: { kind: member.kind, name: member.name },
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
9
27
|
operation: (operation) => {
|
|
10
28
|
// Don't pay attention to operations on templated interfaces that
|
|
11
29
|
// haven't been filled in with parameters yet
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-docs.js","sourceRoot":"","sources":["../../../src/rules/require-docs.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"require-docs.js","sourceRoot":"","sources":["../../../src/rules/require-docs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAoB,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AAEpB,MAAM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AE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;6BAC7C,CAAC,CAAC;yBACJ;qBACF;iBACF;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
package/lib/azure-core.tsp
CHANGED
package/lib/foundations.tsp
CHANGED
|
@@ -16,9 +16,16 @@ namespace Azure.Core.Foundations;
|
|
|
16
16
|
*/
|
|
17
17
|
@lroStatus
|
|
18
18
|
enum OperationState {
|
|
19
|
+
@doc("The operation is in progress.")
|
|
19
20
|
InProgress,
|
|
21
|
+
|
|
22
|
+
@doc("The operation has completed successfully.")
|
|
20
23
|
Succeeded,
|
|
24
|
+
|
|
25
|
+
@doc("The operation has failed.")
|
|
21
26
|
Failed,
|
|
27
|
+
|
|
28
|
+
@doc("The operation has been canceled by the user.")
|
|
22
29
|
Canceled,
|
|
23
30
|
}
|
|
24
31
|
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-azure-core",
|
|
3
|
-
"version": "0.31.0-dev.
|
|
3
|
+
"version": "0.31.0-dev.3",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec Azure Core library",
|
|
6
6
|
"homepage": "https://azure.github.io/typespec-azure",
|
|
7
|
-
"readme": "https://github.com/
|
|
7
|
+
"readme": "https://github.com/Azure/typespec-azure/blob/main/packages/typespec-azure-core/README.md",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/
|
|
11
|
+
"url": "git+https://github.com/Azure/typespec-azure.git"
|
|
12
12
|
},
|
|
13
13
|
"bugs": {
|
|
14
|
-
"url": "https://github.com/
|
|
14
|
+
"url": "https://github.com/Azure/typespec-azure/issues"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
17
|
"typespec"
|