@typespec/versioning 0.41.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.
- package/LICENSE +21 -0
- package/README.md +233 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib.d.ts +82 -0
- package/dist/src/lib.d.ts.map +1 -0
- package/dist/src/lib.js +80 -0
- package/dist/src/lib.js.map +1 -0
- package/dist/src/testing/index.d.ts +3 -0
- package/dist/src/testing/index.d.ts.map +1 -0
- package/dist/src/testing/index.js +8 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/validate.d.ts +3 -0
- package/dist/src/validate.d.ts.map +1 -0
- package/dist/src/validate.js +408 -0
- package/dist/src/validate.js.map +1 -0
- package/dist/src/versioning.d.ts +159 -0
- package/dist/src/versioning.d.ts.map +1 -0
- package/dist/src/versioning.js +782 -0
- package/dist/src/versioning.js.map +1 -0
- package/lib/decorators.tsp +20 -0
- package/lib/versioning.tsp +200 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
package/README.md
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# `@typespec/versioning` library
|
|
2
|
+
|
|
3
|
+
This package provide [TypeSpec](https://github.com/microsoft/typespec) decorators and projections to define versioning in a service.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Run the following command in your typespec project root directory.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @typespec/versioning
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```typespec
|
|
16
|
+
import "@typespec/versioning";
|
|
17
|
+
|
|
18
|
+
using Versioning;
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Enable versioning for Service or Library
|
|
22
|
+
|
|
23
|
+
Use [`@versioned`](#versioned) decorator to mark a namespace as versioned.
|
|
24
|
+
|
|
25
|
+
```typespec
|
|
26
|
+
@versioned(Versions)
|
|
27
|
+
namespace MyService;
|
|
28
|
+
|
|
29
|
+
enum Versions {
|
|
30
|
+
v1,
|
|
31
|
+
v2,
|
|
32
|
+
v3,
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The following decorators can then be used to provide version evolution of a service.
|
|
37
|
+
|
|
38
|
+
- [`@added`](#added)
|
|
39
|
+
- [`@removed`](#removed)
|
|
40
|
+
- [`@renamedFrom`](#renamedfrom)
|
|
41
|
+
- [`@madeOptional`](#madeoptional)
|
|
42
|
+
|
|
43
|
+
### Consume a versioned library
|
|
44
|
+
|
|
45
|
+
When consuming a versioned library, it is required to indicate which version of the library to use.
|
|
46
|
+
See [`@versionedDependency`](#versioneddependency) decorator for information about this.
|
|
47
|
+
|
|
48
|
+
## References
|
|
49
|
+
|
|
50
|
+
Decorators:
|
|
51
|
+
|
|
52
|
+
- [`@versioned`](#versioned) <!-- no toc -->
|
|
53
|
+
- [`@useDependency`](#usedependency)
|
|
54
|
+
- [`@added`](#added)
|
|
55
|
+
- [`@removed`](#removed)
|
|
56
|
+
- [`@renamedFrom`](#renamedfrom)
|
|
57
|
+
- [`@madeOptional`](#madeoptional)
|
|
58
|
+
|
|
59
|
+
### `@versioned`
|
|
60
|
+
|
|
61
|
+
Mark a namespace as being versioned. It takes as an argument an `enum` of versions for that namespace.
|
|
62
|
+
|
|
63
|
+
```typespec
|
|
64
|
+
@versioned(Versions)
|
|
65
|
+
namespace MyService;
|
|
66
|
+
|
|
67
|
+
enum Versions {
|
|
68
|
+
v1,
|
|
69
|
+
v2,
|
|
70
|
+
v3,
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### `@useDependency`
|
|
75
|
+
|
|
76
|
+
When using elements from another versioned namespace, the consuming namespace **MUST** specify which version of the consumed namespace to use even if the consuming namespace is not versioned itself.
|
|
77
|
+
|
|
78
|
+
The decorator can either target:
|
|
79
|
+
|
|
80
|
+
- an unversioned namespace.
|
|
81
|
+
- individual enum members of a versioned namespace's version enum.
|
|
82
|
+
|
|
83
|
+
If we have a library with the following definition:
|
|
84
|
+
|
|
85
|
+
```typespec
|
|
86
|
+
@versioned(Versions)
|
|
87
|
+
namespace MyLib;
|
|
88
|
+
|
|
89
|
+
enum Versions {
|
|
90
|
+
v1,
|
|
91
|
+
v1_1,
|
|
92
|
+
v2,
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Pick a specific version to be used for all version of the service.
|
|
97
|
+
|
|
98
|
+
```typespec
|
|
99
|
+
@versioned(Versions)
|
|
100
|
+
@useDependency(MyLib.Versions.v1_1)
|
|
101
|
+
namespace MyService1;
|
|
102
|
+
|
|
103
|
+
enum Version {
|
|
104
|
+
v1,
|
|
105
|
+
v2,
|
|
106
|
+
v3,
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Service is not versioned, pick which version of `MyLib` should be used.
|
|
111
|
+
|
|
112
|
+
```typespec
|
|
113
|
+
@useDependency(MyLib.Versions.v1_1)
|
|
114
|
+
namespace NonVersionedService;
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Select mapping of version to use
|
|
118
|
+
|
|
119
|
+
```typespec
|
|
120
|
+
@versioned(Versions)
|
|
121
|
+
namespace MyService1;
|
|
122
|
+
|
|
123
|
+
enum Version {
|
|
124
|
+
@useDependency(MyLib.Versions.v1_1) // V1 use lib v1_1
|
|
125
|
+
v1,
|
|
126
|
+
@useDependency(MyLib.Versions.v1_1) // V2 use lib v1_1
|
|
127
|
+
v2,
|
|
128
|
+
@useDependency(MyLib.Versions.v2) // V3 use lib v2
|
|
129
|
+
v3,
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### `@added`
|
|
134
|
+
|
|
135
|
+
Specify which version an entity was added. Take the enum version member.
|
|
136
|
+
|
|
137
|
+
Version enum member **MUST** be from the version enum for the containing namespace.
|
|
138
|
+
|
|
139
|
+
```typespec
|
|
140
|
+
@added(Versions.v2)
|
|
141
|
+
op addedInV2(): void;
|
|
142
|
+
|
|
143
|
+
@added(Versions.v2)
|
|
144
|
+
model AlsoAddedInV2 {}
|
|
145
|
+
|
|
146
|
+
model Foo {
|
|
147
|
+
name: string;
|
|
148
|
+
|
|
149
|
+
@added(Versions.v3)
|
|
150
|
+
addedInV3: string;
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### `@removed`
|
|
155
|
+
|
|
156
|
+
Specify which version an entity was removed. Take the enum version member.
|
|
157
|
+
|
|
158
|
+
Version enum member **MUST** be from the version enum for the containing namespace.
|
|
159
|
+
|
|
160
|
+
```typespec
|
|
161
|
+
@removed(Versions.v2)
|
|
162
|
+
op removedInV2(): void;
|
|
163
|
+
|
|
164
|
+
@removed(Versions.v2)
|
|
165
|
+
model AlsoRemovedInV2 {}
|
|
166
|
+
|
|
167
|
+
model Foo {
|
|
168
|
+
name: string;
|
|
169
|
+
|
|
170
|
+
@removed(Versions.v3)
|
|
171
|
+
removedInV3: string;
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### `@renamedFrom`
|
|
176
|
+
|
|
177
|
+
Specify which version an entity was renamed and what is is old name.
|
|
178
|
+
|
|
179
|
+
Version enum member **MUST** be from the version enum for the containing namespace.
|
|
180
|
+
|
|
181
|
+
```typespec
|
|
182
|
+
@renamedFrom(Versions.v2, "oldName")
|
|
183
|
+
op newName(): void;
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### `@madeOptional`
|
|
187
|
+
|
|
188
|
+
Specify which version a property was made optional
|
|
189
|
+
|
|
190
|
+
Version enum member **MUST** be from the version enum for the containing namespace.
|
|
191
|
+
|
|
192
|
+
```typespec
|
|
193
|
+
model Foo {
|
|
194
|
+
name: string;
|
|
195
|
+
|
|
196
|
+
@madeOptional(Versions.v2)
|
|
197
|
+
nickname: string;
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Consuming versioning library from an emitter
|
|
202
|
+
|
|
203
|
+
### Get the service representation at a given version
|
|
204
|
+
|
|
205
|
+
Versioning library works with projection to project the service at a given version.
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
// Get a list of all the different version of the service and the projections
|
|
209
|
+
const projections = buildVersionProjections(program, serviceNamespace);
|
|
210
|
+
|
|
211
|
+
for (const projection of projections) {
|
|
212
|
+
const projectedProgram = projectProgram(program, projection.projections);
|
|
213
|
+
// projectedProgram now contains the representation of the service at the given version.
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Get list of versions and version dependency across namespaces
|
|
218
|
+
|
|
219
|
+
Versioning library works with projection to project the service at a given version.
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
const versions = resolveVersions(program, serviceNamespace);
|
|
223
|
+
// versions now contain a list of all the version of the service namespace and what version should all the other dependencies namespace use.
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Consume versioning manually
|
|
227
|
+
|
|
228
|
+
If the emitter needs to have the whole picture of the service evolution across the version then using the decorator accessor will provide the metadata for each type:
|
|
229
|
+
|
|
230
|
+
- `getAddedOn`
|
|
231
|
+
- `getRemovedOn`
|
|
232
|
+
- `getRenamedFromVersion`
|
|
233
|
+
- `getMadeOptionalOn`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare const reportDiagnostic: <C extends "versioned-dependency-tuple" | "versioned-dependency-tuple-enum-member" | "versioned-dependency-same-namespace" | "versioned-dependency-record-not-mapping" | "versioned-dependency-not-picked" | "version-not-found" | "using-versioned-library" | "invalid-renamed-from-value" | "incompatible-versioned-reference" | "incompatible-versioned-namespace-use-dependency" | "made-optional-not-optional", M extends keyof {
|
|
2
|
+
"versioned-dependency-tuple": {
|
|
3
|
+
readonly default: "Versioned dependency mapping must be a tuple [SourceVersion, TargetVersion].";
|
|
4
|
+
};
|
|
5
|
+
"versioned-dependency-tuple-enum-member": {
|
|
6
|
+
readonly default: "Versioned dependency mapping must be between enum members.";
|
|
7
|
+
};
|
|
8
|
+
"versioned-dependency-same-namespace": {
|
|
9
|
+
readonly default: "Versioned dependency mapping must all point to the same namespace but 2 versions have different namespaces 'namespace1' and 'namespace2'.";
|
|
10
|
+
};
|
|
11
|
+
"versioned-dependency-record-not-mapping": {
|
|
12
|
+
readonly default: import("@typespec/compiler").CallableMessage<["dependency"]>;
|
|
13
|
+
};
|
|
14
|
+
"versioned-dependency-not-picked": {
|
|
15
|
+
readonly default: import("@typespec/compiler").CallableMessage<["dependency"]>;
|
|
16
|
+
};
|
|
17
|
+
"version-not-found": {
|
|
18
|
+
readonly default: import("@typespec/compiler").CallableMessage<["version", "enumName", "enumName"]>;
|
|
19
|
+
};
|
|
20
|
+
"using-versioned-library": {
|
|
21
|
+
readonly default: import("@typespec/compiler").CallableMessage<["sourceNs", "targetNs"]>;
|
|
22
|
+
};
|
|
23
|
+
"invalid-renamed-from-value": {
|
|
24
|
+
readonly default: "@renamedFrom.oldName cannot be empty string.";
|
|
25
|
+
};
|
|
26
|
+
"incompatible-versioned-reference": {
|
|
27
|
+
readonly default: import("@typespec/compiler").CallableMessage<["sourceName", "targetName"]>;
|
|
28
|
+
readonly addedAfter: import("@typespec/compiler").CallableMessage<["sourceName", "sourceAddedOn", "targetName", "targetAddedOn"]>;
|
|
29
|
+
readonly dependentAddedAfter: import("@typespec/compiler").CallableMessage<["sourceName", "sourceAddedOn", "targetName", "targetAddedOn"]>;
|
|
30
|
+
readonly removedBefore: import("@typespec/compiler").CallableMessage<["sourceName", "sourceRemovedOn", "targetName", "targetRemovedOn"]>;
|
|
31
|
+
readonly dependentRemovedBefore: import("@typespec/compiler").CallableMessage<["sourceName", "sourceRemovedOn", "targetName", "targetRemovedOn"]>;
|
|
32
|
+
readonly versionedDependencyAddedAfter: import("@typespec/compiler").CallableMessage<["sourceName", "targetName", "targetAddedOn", "dependencyVersion"]>;
|
|
33
|
+
readonly versionedDependencyRemovedBefore: import("@typespec/compiler").CallableMessage<["sourceName", "targetName", "targetAddedOn", "dependencyVersion"]>;
|
|
34
|
+
};
|
|
35
|
+
"incompatible-versioned-namespace-use-dependency": {
|
|
36
|
+
readonly default: "The useDependency decorator can only be used on a Namespace if the namespace is unversioned. For versioned namespaces, put the useDependency decorator on the version enum members.";
|
|
37
|
+
};
|
|
38
|
+
"made-optional-not-optional": {
|
|
39
|
+
readonly default: import("@typespec/compiler").CallableMessage<["name", "name"]>;
|
|
40
|
+
};
|
|
41
|
+
}[C]>(program: import("@typespec/compiler").Program, diag: import("@typespec/compiler").DiagnosticReport<{
|
|
42
|
+
"versioned-dependency-tuple": {
|
|
43
|
+
readonly default: "Versioned dependency mapping must be a tuple [SourceVersion, TargetVersion].";
|
|
44
|
+
};
|
|
45
|
+
"versioned-dependency-tuple-enum-member": {
|
|
46
|
+
readonly default: "Versioned dependency mapping must be between enum members.";
|
|
47
|
+
};
|
|
48
|
+
"versioned-dependency-same-namespace": {
|
|
49
|
+
readonly default: "Versioned dependency mapping must all point to the same namespace but 2 versions have different namespaces 'namespace1' and 'namespace2'.";
|
|
50
|
+
};
|
|
51
|
+
"versioned-dependency-record-not-mapping": {
|
|
52
|
+
readonly default: import("@typespec/compiler").CallableMessage<["dependency"]>;
|
|
53
|
+
};
|
|
54
|
+
"versioned-dependency-not-picked": {
|
|
55
|
+
readonly default: import("@typespec/compiler").CallableMessage<["dependency"]>;
|
|
56
|
+
};
|
|
57
|
+
"version-not-found": {
|
|
58
|
+
readonly default: import("@typespec/compiler").CallableMessage<["version", "enumName", "enumName"]>;
|
|
59
|
+
};
|
|
60
|
+
"using-versioned-library": {
|
|
61
|
+
readonly default: import("@typespec/compiler").CallableMessage<["sourceNs", "targetNs"]>;
|
|
62
|
+
};
|
|
63
|
+
"invalid-renamed-from-value": {
|
|
64
|
+
readonly default: "@renamedFrom.oldName cannot be empty string.";
|
|
65
|
+
};
|
|
66
|
+
"incompatible-versioned-reference": {
|
|
67
|
+
readonly default: import("@typespec/compiler").CallableMessage<["sourceName", "targetName"]>;
|
|
68
|
+
readonly addedAfter: import("@typespec/compiler").CallableMessage<["sourceName", "sourceAddedOn", "targetName", "targetAddedOn"]>;
|
|
69
|
+
readonly dependentAddedAfter: import("@typespec/compiler").CallableMessage<["sourceName", "sourceAddedOn", "targetName", "targetAddedOn"]>;
|
|
70
|
+
readonly removedBefore: import("@typespec/compiler").CallableMessage<["sourceName", "sourceRemovedOn", "targetName", "targetRemovedOn"]>;
|
|
71
|
+
readonly dependentRemovedBefore: import("@typespec/compiler").CallableMessage<["sourceName", "sourceRemovedOn", "targetName", "targetRemovedOn"]>;
|
|
72
|
+
readonly versionedDependencyAddedAfter: import("@typespec/compiler").CallableMessage<["sourceName", "targetName", "targetAddedOn", "dependencyVersion"]>;
|
|
73
|
+
readonly versionedDependencyRemovedBefore: import("@typespec/compiler").CallableMessage<["sourceName", "targetName", "targetAddedOn", "dependencyVersion"]>;
|
|
74
|
+
};
|
|
75
|
+
"incompatible-versioned-namespace-use-dependency": {
|
|
76
|
+
readonly default: "The useDependency decorator can only be used on a Namespace if the namespace is unversioned. For versioned namespaces, put the useDependency decorator on the version enum members.";
|
|
77
|
+
};
|
|
78
|
+
"made-optional-not-optional": {
|
|
79
|
+
readonly default: import("@typespec/compiler").CallableMessage<["name", "name"]>;
|
|
80
|
+
};
|
|
81
|
+
}, C, M>) => void, createStateSymbol: (name: string) => symbol;
|
|
82
|
+
//# sourceMappingURL=lib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAgFA,eAAO,MAAQ,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAE,iBAAiB,0BAAkC,CAAC"}
|
package/dist/src/lib.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createTypeSpecLibrary, paramMessage } from "@typespec/compiler";
|
|
2
|
+
const libDef = {
|
|
3
|
+
name: "@typespec/versioning",
|
|
4
|
+
diagnostics: {
|
|
5
|
+
"versioned-dependency-tuple": {
|
|
6
|
+
severity: "error",
|
|
7
|
+
messages: {
|
|
8
|
+
default: `Versioned dependency mapping must be a tuple [SourceVersion, TargetVersion].`,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
"versioned-dependency-tuple-enum-member": {
|
|
12
|
+
severity: "error",
|
|
13
|
+
messages: {
|
|
14
|
+
default: `Versioned dependency mapping must be between enum members.`,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
"versioned-dependency-same-namespace": {
|
|
18
|
+
severity: "error",
|
|
19
|
+
messages: {
|
|
20
|
+
default: `Versioned dependency mapping must all point to the same namespace but 2 versions have different namespaces '${"namespace1"}' and '${"namespace2"}'.`,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
"versioned-dependency-record-not-mapping": {
|
|
24
|
+
severity: "error",
|
|
25
|
+
messages: {
|
|
26
|
+
default: paramMessage `The versionedDependency decorator must provide a model mapping local versions to dependency '${"dependency"}' versions`,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
"versioned-dependency-not-picked": {
|
|
30
|
+
severity: "error",
|
|
31
|
+
messages: {
|
|
32
|
+
default: paramMessage `The versionedDependency decorator must provide a version of the dependency '${"dependency"}'.`,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
"version-not-found": {
|
|
36
|
+
severity: "error",
|
|
37
|
+
messages: {
|
|
38
|
+
default: paramMessage `The provided version '${"version"}' from '${"enumName"}' is not declared as a version enum. Use '@versioned(${"enumName"})' on the containing namespace.`,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
"using-versioned-library": {
|
|
42
|
+
severity: "error",
|
|
43
|
+
messages: {
|
|
44
|
+
default: paramMessage `Namespace '${"sourceNs"}' is referencing types from versioned namespace '${"targetNs"}' but didn't specify which versions with @useDependency.`,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
"invalid-renamed-from-value": {
|
|
48
|
+
severity: "error",
|
|
49
|
+
messages: {
|
|
50
|
+
default: "@renamedFrom.oldName cannot be empty string.",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
"incompatible-versioned-reference": {
|
|
54
|
+
severity: "error",
|
|
55
|
+
messages: {
|
|
56
|
+
default: paramMessage `'${"sourceName"}' is referencing versioned type '${"targetName"}' but is not versioned itself.`,
|
|
57
|
+
addedAfter: paramMessage `'${"sourceName"}' was added on version '${"sourceAddedOn"}' but referencing type '${"targetName"}' added in version '${"targetAddedOn"}'.`,
|
|
58
|
+
dependentAddedAfter: paramMessage `'${"sourceName"}' was added on version '${"sourceAddedOn"}' but contains type '${"targetName"}' added in version '${"targetAddedOn"}'.`,
|
|
59
|
+
removedBefore: paramMessage `'${"sourceName"}' was removed on version '${"sourceRemovedOn"}' but referencing type '${"targetName"}' removed in version '${"targetRemovedOn"}'.`,
|
|
60
|
+
dependentRemovedBefore: paramMessage `'${"sourceName"}' was removed on version '${"sourceRemovedOn"}' but contains type '${"targetName"}' removed in version '${"targetRemovedOn"}'.`,
|
|
61
|
+
versionedDependencyAddedAfter: paramMessage `'${"sourceName"}' is referencing type '${"targetName"}' added in version '${"targetAddedOn"}' but version used is ${"dependencyVersion"}.`,
|
|
62
|
+
versionedDependencyRemovedBefore: paramMessage `'${"sourceName"}' is referencing type '${"targetName"}' removed in version '${"targetAddedOn"}' but version used is ${"dependencyVersion"}.`,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
"incompatible-versioned-namespace-use-dependency": {
|
|
66
|
+
severity: "error",
|
|
67
|
+
messages: {
|
|
68
|
+
default: "The useDependency decorator can only be used on a Namespace if the namespace is unversioned. For versioned namespaces, put the useDependency decorator on the version enum members.",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
"made-optional-not-optional": {
|
|
72
|
+
severity: "error",
|
|
73
|
+
messages: {
|
|
74
|
+
default: paramMessage `Property '${"name"}' marked with @madeOptional but is required. Should be '${"name"}?'`,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
export const { reportDiagnostic, createStateSymbol } = createTypeSpecLibrary(libDef);
|
|
80
|
+
//# sourceMappingURL=lib.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEzE,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE;QACX,4BAA4B,EAAE;YAC5B,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,8EAA8E;aACxF;SACF;QACD,wCAAwC,EAAE;YACxC,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,4DAA4D;aACtE;SACF;QACD,qCAAqC,EAAE;YACrC,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,+GAA+G,YAAY,UAAU,YAAY,IAAI;aAC/J;SACF;QACD,yCAAyC,EAAE;YACzC,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,gGAAgG,YAAY,YAAY;aAC9I;SACF;QACD,iCAAiC,EAAE;YACjC,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,+EAA+E,YAAY,IAAI;aACrH;SACF;QACD,mBAAmB,EAAE;YACnB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,yBAAyB,SAAS,WAAW,UAAU,wDAAwD,UAAU,iCAAiC;aAChL;SACF;QACD,yBAAyB,EAAE;YACzB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,cAAc,UAAU,oDAAoD,UAAU,0DAA0D;aACtK;SACF;QACD,4BAA4B,EAAE;YAC5B,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,8CAA8C;aACxD;SACF;QACD,kCAAkC,EAAE;YAClC,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,IAAI,YAAY,oCAAoC,YAAY,gCAAgC;gBACrH,UAAU,EAAE,YAAY,CAAA,IAAI,YAAY,2BAA2B,eAAe,2BAA2B,YAAY,uBAAuB,eAAe,IAAI;gBACnK,mBAAmB,EAAE,YAAY,CAAA,IAAI,YAAY,2BAA2B,eAAe,wBAAwB,YAAY,uBAAuB,eAAe,IAAI;gBACzK,aAAa,EAAE,YAAY,CAAA,IAAI,YAAY,6BAA6B,iBAAiB,2BAA2B,YAAY,yBAAyB,iBAAiB,IAAI;gBAC9K,sBAAsB,EAAE,YAAY,CAAA,IAAI,YAAY,6BAA6B,iBAAiB,wBAAwB,YAAY,yBAAyB,iBAAiB,IAAI;gBACpL,6BAA6B,EAAE,YAAY,CAAA,IAAI,YAAY,0BAA0B,YAAY,uBAAuB,eAAe,yBAAyB,mBAAmB,GAAG;gBACtL,gCAAgC,EAAE,YAAY,CAAA,IAAI,YAAY,0BAA0B,YAAY,yBAAyB,eAAe,yBAAyB,mBAAmB,GAAG;aAC5L;SACF;QACD,iDAAiD,EAAE;YACjD,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EACL,qLAAqL;aACxL;SACF;QACD,4BAA4B,EAAE;YAC5B,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,aAAa,MAAM,2DAA2D,MAAM,IAAI;aAC9G;SACF;KACF;CACO,CAAC;AACX,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGpF,eAAO,MAAM,qBAAqB,EAAE,mBAGlC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { resolvePath } from "@typespec/compiler";
|
|
2
|
+
import { createTestLibrary } from "@typespec/compiler/testing";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
export const VersioningTestLibrary = createTestLibrary({
|
|
5
|
+
name: "@typespec/versioning",
|
|
6
|
+
packageRoot: resolvePath(fileURLToPath(import.meta.url), "../../../../"),
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAuB,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,CAAC,MAAM,qBAAqB,GAAwB,iBAAiB,CAAC;IAC1E,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC;CACzE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,OAAO,EAER,MAAM,oBAAoB,CAAC;AAa5B,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,QA+G3C"}
|