@travetto/schema
Advanced tools
Comparing version 3.1.0-rc.4 to 3.1.0-rc.5
{ | ||
"name": "@travetto/schema", | ||
"version": "3.1.0-rc.4", | ||
"version": "3.1.0-rc.5", | ||
"description": "Data type registry for runtime validation, reflection and binding.", | ||
@@ -30,6 +30,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@travetto/registry": "^3.1.0-rc.2" | ||
"@travetto/registry": "^3.1.0-rc.3" | ||
}, | ||
"peerDependencies": { | ||
"@travetto/transformer": "^3.1.0-rc.2" | ||
"@travetto/transformer": "^3.1.0-rc.3" | ||
}, | ||
@@ -36,0 +36,0 @@ "peerDependenciesMeta": { |
@@ -84,2 +84,4 @@ <!-- This file was generated by @travetto/doc and should not be modified directly --> | ||
* [@Writeonly](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L52) defines a that field should not be exported in serialization, but that it can be bound to | ||
* [@Secret](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L64) marks a field as being sensitive. This is used by certain logging activities to ensure sensitive information is not logged out. | ||
* [@Specifier](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L206) attributes additional specifiers to a field, allowing for more specification beyond just the field's type. | ||
Additionally, schemas can be nested to form more complex data structures that are able to bound and validated. | ||
@@ -86,0 +88,0 @@ |
@@ -48,8 +48,2 @@ import { ClassInstance } from '@travetto/base'; | ||
/** | ||
* Specifier for the field | ||
* @param specifier The specifier for a field | ||
* @augments `@travetto/schema:Field` | ||
*/ | ||
export function Specifier(specifier: string): PropType<unknown> { return prop({ specifier }); } | ||
/** | ||
* Mark a field as writeonly | ||
@@ -93,3 +87,3 @@ * @param active This determines if this field is readonly or not. | ||
*/ | ||
export function Text(): PropType<string | string[]> { return prop({ specifier: 'text' }); } | ||
export function Text(): PropType<string | string[]> { return prop({ specifiers: ['text'] }); } | ||
/** | ||
@@ -99,3 +93,3 @@ * Mark the field to indicate it's for long form text | ||
*/ | ||
export function LongText(): PropType<string | string[]> { return prop({ specifier: 'text-long' }); } | ||
export function LongText(): PropType<string | string[]> { return prop({ specifiers: ['text', 'long'] }); } | ||
@@ -209,1 +203,8 @@ /** | ||
} | ||
/** | ||
* Specifier for the field | ||
* @param specifiers The specifiers for a field | ||
* @augments `@travetto/schema:Field` | ||
*/ | ||
export function Specifier(...specifiers: string[]): PropType<unknown> { return prop({ specifiers }); } |
@@ -256,2 +256,10 @@ import { Class, AppError, ObjectUtil, ClassInstance, ConcreteClass } from '@travetto/base'; | ||
const params = (methods[method] ??= []); | ||
if (config.aliases) { | ||
config.aliases = [...params[idx]?.aliases ?? [], ...config.aliases]; | ||
} | ||
if (config.specifiers) { | ||
config.specifiers = [...params[idx]?.specifiers ?? [], ...config.specifiers]; | ||
} | ||
params[idx] = { | ||
@@ -283,2 +291,8 @@ // @ts-expect-error | ||
} | ||
if (config.aliases) { | ||
config.aliases = [...allViewConf.schema[prop].aliases ?? [], ...config.aliases]; | ||
} | ||
if (config.specifiers) { | ||
config.specifiers = [...allViewConf.schema[prop].specifiers ?? [], ...config.specifiers]; | ||
} | ||
@@ -285,0 +299,0 @@ Object.assign(allViewConf.schema[prop], config); |
@@ -118,3 +118,3 @@ import { Primitive, Class } from '@travetto/base'; | ||
*/ | ||
specifier?: string; | ||
specifiers?: string[]; | ||
/** | ||
@@ -121,0 +121,0 @@ * The numeric precision |
@@ -151,3 +151,3 @@ import ts from 'typescript'; | ||
} | ||
params.push(state.extendObjectLiteral(state.factory.createObjectLiteralExpression(attrs))); | ||
params.push(state.factory.createObjectLiteralExpression(attrs)); | ||
if (args.length > 1) { | ||
@@ -154,0 +154,0 @@ params.push(...args.slice(1)); |
89034
1993
374