@azure-tools/typespec-autorest 0.27.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare function comparePaths(leftPath: string, rightPath: string): number;
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAiC/D"}
@@ -0,0 +1,31 @@
1
+ export function comparePaths(leftPath, rightPath) {
2
+ const leftParts = leftPath.split("/").slice(1);
3
+ const rightParts = rightPath.split("/").slice(1);
4
+ for (let i = 0; i < Math.max(leftParts.length, rightParts.length); i++) {
5
+ // Have we exhausted the path parts of one of them?
6
+ if (i === leftParts.length)
7
+ return -1;
8
+ if (i === rightParts.length)
9
+ return 1;
10
+ // Does this segment represent a path parameter (field) on either side?
11
+ const leftIsField = leftParts[i][0] === "{";
12
+ const rightIsField = rightParts[i][0] === "{";
13
+ // If both are fields, try the next part regardless of the field name
14
+ // since the field ordering is all that really matters
15
+ if (leftIsField && rightIsField) {
16
+ continue;
17
+ }
18
+ // If only one is a field, it automatically wins
19
+ if (leftIsField || rightIsField) {
20
+ return leftIsField ? -1 : 1;
21
+ }
22
+ // Sort lexicographically
23
+ const result = leftParts[i].localeCompare(rightParts[i]);
24
+ if (result !== 0) {
25
+ return result;
26
+ }
27
+ }
28
+ // Must be the same
29
+ return 0;
30
+ }
31
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAAC,QAAgB,EAAE,SAAiB;IAC9D,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;
2
+
3
+ namespace Autorest;
4
+
5
+ /**
6
+ * `@example` - attaches example files to an operation. Multiple examples can be specified.
7
+ *
8
+ * `@example` can be specified on Operations.
9
+ *
10
+ * @param pathOrUri - path or Uri to the example file.
11
+ * @param title - name or description of the example file.
12
+ */
13
+ extern dec example(target: Operation, pathOrUri: string, title: string);
14
+
15
+ /**
16
+ * `@useRef` - is used to replace the TypeSpec model type in emitter output with a pre-existing named OpenAPI schema such as ARM common types.
17
+ *
18
+ * `@useRef` can be specified on Models and ModelProperty.
19
+ *
20
+ * @param jsonRef - path or Uri to an OpenAPI schema.
21
+ */
22
+ extern dec useRef(entity: object | ModelProperty, jsonRef: string);
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@azure-tools/typespec-autorest",
3
+ "version": "0.27.0",
4
+ "author": "Microsoft Corporation",
5
+ "description": "TypeSpec library for emitting openapi from the TypeSpec REST protocol binding",
6
+ "homepage": "https://azure.github.io/typespec-azure",
7
+ "readme": "https://github.com/Azure/typespec-azure/blob/master/README.md",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Azure/typespec-azure.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/Azure/typespec-azure/issues"
15
+ },
16
+ "keywords": [
17
+ "typespec",
18
+ "autorest"
19
+ ],
20
+ "type": "module",
21
+ "main": "dist/src/index.js",
22
+ "tspMain": "lib/autorest.tsp",
23
+ "exports": {
24
+ ".": "./dist/src/index.js",
25
+ "./testing": "./dist/src/testing/index.js"
26
+ },
27
+ "typesVersions": {
28
+ "*": {
29
+ "*": [
30
+ "./dist/src/index.d.ts"
31
+ ],
32
+ "testing": [
33
+ "./dist/src/testing/index.d.ts"
34
+ ]
35
+ }
36
+ },
37
+ "engines": {
38
+ "node": ">=16.0.0"
39
+ },
40
+ "files": [
41
+ "lib/*.tsp",
42
+ "dist/**",
43
+ "!dist/test/**"
44
+ ],
45
+ "peerDependencies": {
46
+ "@typespec/compiler": "~0.41.0",
47
+ "@azure-tools/typespec-azure-core": "~0.27.0",
48
+ "@typespec/http": "~0.41.0",
49
+ "@typespec/rest": "~0.41.0",
50
+ "@typespec/openapi": "~0.41.0",
51
+ "@typespec/versioning": "~0.41.0"
52
+ },
53
+ "devDependencies": {
54
+ "@typespec/compiler": "~0.41.0",
55
+ "@azure-tools/typespec-azure-core": "~0.27.0",
56
+ "@typespec/http": "~0.41.0",
57
+ "@typespec/rest": "~0.41.0",
58
+ "@typespec/openapi": "~0.41.0",
59
+ "@types/mocha": "~10.0.0",
60
+ "@types/node": "~18.11.9",
61
+ "@typespec/versioning": "~0.41.0",
62
+ "@typespec/eslint-config-typespec": "~0.6.0",
63
+ "@typespec/library-linter": "~0.41.0",
64
+ "@typespec/eslint-plugin": "~0.41.0",
65
+ "eslint": "^8.12.0",
66
+ "mocha": "~10.1.0",
67
+ "c8": "~7.12.0",
68
+ "rimraf": "~3.0.2",
69
+ "typescript": "~4.9.3",
70
+ "change-case": "~4.1.2"
71
+ },
72
+ "scripts": {
73
+ "clean": "rimraf ./dist ./temp",
74
+ "build": "tsc -p . && npm run lint-typespec-library",
75
+ "watch": "tsc -p . --watch",
76
+ "lint-typespec-library": "tsp compile . --warn-as-error --import @typespec/library-linter --no-emit",
77
+ "test": "mocha",
78
+ "test-official": "c8 mocha --forbid-only",
79
+ "lint": "eslint . --ext .ts --max-warnings=0",
80
+ "lint:fix": "eslint . --fix --ext .ts"
81
+ }
82
+ }