@travetto/schema 3.0.0-rc.0 → 3.0.0-rc.1
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/schema",
|
|
3
3
|
"displayName": "Schema",
|
|
4
|
-
"version": "3.0.0-rc.
|
|
4
|
+
"version": "3.0.0-rc.1",
|
|
5
5
|
"description": "Data type registry for runtime validation, reflection and binding. ",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"schema",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"directory": "module/schema"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@travetto/registry": "^3.0.0-rc.
|
|
32
|
-
"@travetto/transformer": "^3.0.0-rc.
|
|
31
|
+
"@travetto/registry": "^3.0.0-rc.1",
|
|
32
|
+
"@travetto/transformer": "^3.0.0-rc.1"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
@@ -140,34 +140,34 @@ export class SchemaTransformUtil {
|
|
|
140
140
|
params.push(state.factory.createObjectLiteralExpression(attrs));
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
const
|
|
144
|
-
...(node.
|
|
143
|
+
const newModifiers = [
|
|
144
|
+
...(node.modifiers ?? []).filter(x => x !== existing),
|
|
145
145
|
state.createDecorator(FIELD_MOD, 'Field', ...params)
|
|
146
146
|
];
|
|
147
147
|
|
|
148
148
|
if (ts.isPropertyDeclaration(node)) {
|
|
149
149
|
const comments = DocUtil.describeDocs(node);
|
|
150
150
|
if (comments.description) {
|
|
151
|
-
|
|
151
|
+
newModifiers.push(state.createDecorator(COMMON_MOD, 'Describe', state.fromLiteral({
|
|
152
152
|
description: comments.description
|
|
153
153
|
})));
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
157
157
|
return state.factory.updatePropertyDeclaration(node as Exclude<typeof node, T>,
|
|
158
|
-
|
|
158
|
+
newModifiers, node.name, node.questionToken, node.type, node.initializer) as T;
|
|
159
159
|
} else if (ts.isParameter(node)) {
|
|
160
160
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
161
161
|
return state.factory.updateParameterDeclaration(node as Exclude<typeof node, T>,
|
|
162
|
-
|
|
162
|
+
newModifiers, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) as T;
|
|
163
163
|
} else if (ts.isGetAccessorDeclaration(node)) {
|
|
164
164
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
165
165
|
return state.factory.updateGetAccessorDeclaration(node as Exclude<typeof node, T>,
|
|
166
|
-
|
|
166
|
+
newModifiers, node.name, node.parameters, node.type, node.body) as T;
|
|
167
167
|
} else {
|
|
168
168
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
169
169
|
return state.factory.updateSetAccessorDeclaration(node as Exclude<typeof node, T>,
|
|
170
|
-
|
|
170
|
+
newModifiers, node.name, node.parameters, node.body) as T;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -39,16 +39,16 @@ export class SchemaTransformer {
|
|
|
39
39
|
*/
|
|
40
40
|
@AfterClass('Schema')
|
|
41
41
|
static finalizeSchema(state: AutoState & TransformerState, node: ts.ClassDeclaration): ts.ClassDeclaration {
|
|
42
|
-
const
|
|
42
|
+
const modifiers = (node.modifiers ?? []).slice(0);
|
|
43
43
|
|
|
44
44
|
const comments = DocUtil.describeDocs(node);
|
|
45
45
|
|
|
46
46
|
if (!state.findDecorator(this, node, 'Schema', SCHEMA_MOD)) {
|
|
47
|
-
|
|
47
|
+
modifiers.unshift(state.createDecorator(SCHEMA_MOD, 'Schema'));
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
if (comments.description) {
|
|
51
|
-
|
|
51
|
+
modifiers.push(state.createDecorator(COMMON_MOD, 'Describe', state.fromLiteral({
|
|
52
52
|
title: comments.description
|
|
53
53
|
})));
|
|
54
54
|
}
|
|
@@ -58,8 +58,7 @@ export class SchemaTransformer {
|
|
|
58
58
|
|
|
59
59
|
return state.factory.updateClassDeclaration(
|
|
60
60
|
node,
|
|
61
|
-
|
|
62
|
-
node.modifiers,
|
|
61
|
+
modifiers,
|
|
63
62
|
node.name,
|
|
64
63
|
node.typeParameters,
|
|
65
64
|
node.heritageClauses,
|