@travetto/schema 2.0.5 → 2.1.2
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
CHANGED
|
@@ -206,7 +206,7 @@ Validation Failed {
|
|
|
206
206
|
"message": "Validation errors have occurred",
|
|
207
207
|
"category": "data",
|
|
208
208
|
"type": "ValidationResultError",
|
|
209
|
-
"at": "
|
|
209
|
+
"at": "2022-03-14T04:00:00.618Z",
|
|
210
210
|
"errors": [
|
|
211
211
|
{
|
|
212
212
|
"kind": "type",
|
|
@@ -435,7 +435,7 @@ Validation Failed {
|
|
|
435
435
|
"message": "Validation errors have occurred",
|
|
436
436
|
"category": "data",
|
|
437
437
|
"type": "ValidationResultError",
|
|
438
|
-
"at": "
|
|
438
|
+
"at": "2022-03-14T04:00:00.837Z",
|
|
439
439
|
"errors": [
|
|
440
440
|
{
|
|
441
441
|
"kind": "type",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/schema",
|
|
3
3
|
"displayName": "Schema",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.2",
|
|
5
5
|
"description": "Data type registry for runtime validation, reflection and binding. ",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"schema",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"directory": "module/schema"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@travetto/registry": "^2.
|
|
33
|
-
"@travetto/transformer": "^2.
|
|
32
|
+
"@travetto/registry": "^2.1.2",
|
|
33
|
+
"@travetto/transformer": "^2.1.2"
|
|
34
34
|
},
|
|
35
35
|
"optionalPeerDependencies": {
|
|
36
|
-
"@types/faker": "^5.5.
|
|
36
|
+
"@types/faker": "^5.5.9",
|
|
37
37
|
"faker": "^5.5.3"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
package/src/decorator/schema.ts
CHANGED
|
@@ -40,8 +40,8 @@ export function View<T>(name: string, fields: ViewFieldsConfig<Partial<T>>) {
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Register a class as a subtype, with a specific discriminator
|
|
43
|
-
* @param name
|
|
44
|
-
* @returns
|
|
43
|
+
* @param name
|
|
44
|
+
* @returns
|
|
45
45
|
*/
|
|
46
46
|
export function SubType<T>(name: string) {
|
|
47
47
|
return (target: Class<Partial<T>>) => {
|
|
@@ -73,6 +73,7 @@ export class SchemaTransformUtil {
|
|
|
73
73
|
const attrs: ts.PropertyAssignment[] = [];
|
|
74
74
|
|
|
75
75
|
if (!ts.isGetAccessorDeclaration(node) && !ts.isSetAccessorDeclaration(node)) {
|
|
76
|
+
// eslint-disable-next-line no-bitwise
|
|
76
77
|
if ((ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Readonly) > 0) {
|
|
77
78
|
attrs.push(state.factory.createPropertyAssignment('mode', state.fromLiteral('readonly')));
|
|
78
79
|
} else if (!node.questionToken && !typeExpr.undefinable && !node.initializer) {
|
|
@@ -3,8 +3,8 @@ import * as ts from 'typescript';
|
|
|
3
3
|
import {
|
|
4
4
|
TransformerState, OnProperty, OnClass, AfterClass, DecoratorMeta, DocUtil, DeclarationUtil, TransformerId, OnGetter, OnSetter
|
|
5
5
|
} from '@travetto/transformer';
|
|
6
|
+
|
|
6
7
|
import { SchemaTransformUtil } from './transform-util';
|
|
7
|
-
import { access } from 'fs';
|
|
8
8
|
|
|
9
9
|
const inSchema = Symbol.for('@trv:schema/schema');
|
|
10
10
|
const accessors = Symbol.for('@trv:schema/schema');
|