From 40dfb7082763a782f27c8231ba053a039efe1c37 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Sat, 19 Oct 2024 22:25:24 +0900 Subject: [PATCH 1/3] Close #1234: completed `Sequence` implementation for Protocol Buffer. --- benchmark/package.json | 2 +- errors/package.json | 2 +- package.json | 2 +- packages/typescript-json/package.json | 4 +- src/factories/ProtobufFactory.ts | 10 +- .../protobuf/ProtobufEncodeProgrammer.ts | 1003 ++++++++--------- test-esm/package.json | 2 +- test/generate/output/generate_protobuf.ts | 36 +- test/package.json | 2 +- test/src/debug/encode.ts | 14 +- 10 files changed, 488 insertions(+), 589 deletions(-) diff --git a/benchmark/package.json b/benchmark/package.json index 1b4019a980..b0cbf61591 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -72,6 +72,6 @@ "suppress-warnings": "^1.0.2", "tstl": "^3.0.0", "uuid": "^9.0.1", - "typia": "../typia-7.0.0-dev.20241019.tgz" + "typia": "../typia-7.0.0-dev.20241019-2.tgz" } } \ No newline at end of file diff --git a/errors/package.json b/errors/package.json index 2e645bc04a..957f451c12 100644 --- a/errors/package.json +++ b/errors/package.json @@ -32,6 +32,6 @@ "typescript": "^5.3.2" }, "dependencies": { - "typia": "../typia-7.0.0-dev.20241019.tgz" + "typia": "../typia-7.0.0-dev.20241019-2.tgz" } } \ No newline at end of file diff --git a/package.json b/package.json index 8b4c12fb4b..6cf810f80e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typia", - "version": "7.0.0-dev.20241019", + "version": "7.0.0-dev.20241019-2", "description": "Superfast runtime validators with only one line", "main": "lib/index.js", "typings": "lib/index.d.ts", diff --git a/packages/typescript-json/package.json b/packages/typescript-json/package.json index 700405fb3c..abb0d5288b 100644 --- a/packages/typescript-json/package.json +++ b/packages/typescript-json/package.json @@ -1,6 +1,6 @@ { "name": "typescript-json", - "version": "7.0.0-dev.20241019", + "version": "7.0.0-dev.20241019-2", "description": "Superfast runtime validators with only one line", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -63,7 +63,7 @@ }, "homepage": "https://typia.io", "dependencies": { - "typia": "7.0.0-dev.20241019" + "typia": "7.0.0-dev.20241019-2" }, "peerDependencies": { "typescript": ">=4.8.0 <5.7.0" diff --git a/src/factories/ProtobufFactory.ts b/src/factories/ProtobufFactory.ts index 864a06d527..3d1c84b67a 100644 --- a/src/factories/ProtobufFactory.ts +++ b/src/factories/ProtobufFactory.ts @@ -250,12 +250,10 @@ export namespace ProtobufFactory { index: getSequence(atomic.tags[0] ?? [])!, }); - // SORTING IF REQUIRED - if (map.size && map.values().next().value!.index === null) - return new Map( - Array.from(map).sort((x, y) => ProtobufUtil.compare(x[0], y[0])), - ); - return map; + // SORTING FOR VALIDATION REASON + return new Map( + Array.from(map).sort((x, y) => ProtobufUtil.compare(x[0], y[0])), + ); }; const emplaceBigint = (next: { diff --git a/src/programmers/protobuf/ProtobufEncodeProgrammer.ts b/src/programmers/protobuf/ProtobufEncodeProgrammer.ts index 9aee77971a..1d24908a45 100644 --- a/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +++ b/src/programmers/protobuf/ProtobufEncodeProgrammer.ts @@ -9,11 +9,11 @@ import { StatementFactory } from "../../factories/StatementFactory"; import { TypeFactory } from "../../factories/TypeFactory"; import { Metadata } from "../../schemas/metadata/Metadata"; -import { MetadataArray } from "../../schemas/metadata/MetadataArray"; -import { MetadataAtomic } from "../../schemas/metadata/MetadataAtomic"; import { MetadataMap } from "../../schemas/metadata/MetadataMap"; import { MetadataObjectType } from "../../schemas/metadata/MetadataObjectType"; -import { MetadataProperty } from "../../schemas/metadata/MetadataProperty"; +import { IProtobufProperty } from "../../schemas/protobuf/IProtobufProperty"; +import { IProtobufPropertyType } from "../../schemas/protobuf/IProtobufPropertyType"; +import { IProtobufSchema } from "../../schemas/protobuf/IProtobufSchema"; import { IProgrammerProps } from "../../transformers/IProgrammerProps"; import { ITypiaContext } from "../../transformers/ITypiaContext"; @@ -102,13 +102,7 @@ export namespace ProtobufEncodeProgrammer { [ts.factory.createIdentifier("sizer")], ), ), - ts.factory.createReturnStatement( - ts.factory.createCallExpression( - IdentifierFactory.access(WRITER(), "buffer"), - undefined, - undefined, - ), - ), + ts.factory.createReturnStatement(callWriter("buffer")), ], true, ), @@ -157,19 +151,6 @@ export namespace ProtobufEncodeProgrammer { }), }), ); - const main: ts.Block = decode({ - context: props.context, - functor: props.functor, - index: null, - input: ts.factory.createIdentifier("input"), - metadata: props.metadata, - explore: { - source: "top", - from: "top", - tracable: false, - postfix: "", - }, - }); return ts.factory.createArrowFunction( undefined, [ @@ -196,7 +177,17 @@ export namespace ProtobufEncodeProgrammer { ...props.functor.declareUnions(), ...functors, ...IsProgrammer.write_function_statements(props), - ...main.statements, + ts.factory.createExpressionStatement( + ts.factory.createCallExpression( + ts.factory.createIdentifier( + props.functor.useLocal( + `${PREFIX}o${props.metadata.objects[0]?.type.index ?? 0}`, + ), + ), + [], + [ts.factory.createIdentifier("input")], + ), + ), ts.factory.createReturnStatement( ts.factory.createIdentifier("writer"), ), @@ -213,20 +204,20 @@ export namespace ProtobufEncodeProgrammer { object: MetadataObjectType; explore: FeatureProgrammer.IExplore; }): ts.ArrowFunction => { - let index: number = 1; const body: ts.Statement[] = props.object.properties .map((p) => { - const block = decode({ - ...props, - index, - input: IdentifierFactory.access(props.input, p.key.getSoleLiteral()!), + const block = decode_property({ + context: props.context, + functor: props.functor, + explore: props.explore, metadata: p.value, + protobuf: p.of_protobuf_!, + input: IdentifierFactory.access(props.input, p.key.getSoleLiteral()!), }); - index += ProtobufUtil.size(p.value); return [ ts.factory.createExpressionStatement( ts.factory.createIdentifier( - `// property "${p.key.getSoleLiteral()!}"`, + `// property ${JSON.stringify(p.key.getSoleLiteral())}: ${p.value.getName()}`, ), ), ...block.statements, @@ -244,16 +235,139 @@ export namespace ProtobufEncodeProgrammer { }; /* ----------------------------------------------------------- - DECODERS - ----------------------------------------------------------- */ - const decode = (props: { + DECODER STATION + ----------------------------------------------------------- */ + const decode_property = (props: { context: ITypiaContext; functor: FunctionProgrammer; - index: number | null; - input: ts.Expression; metadata: Metadata; + protobuf: IProtobufProperty; + input: ts.Expression; explore: FeatureProgrammer.IExplore; }): ts.Block => { + const union: IUnion[] = []; + for (const schema of props.protobuf.union) { + //---- + // ATOMICS + //---- + if (schema.type === "bool") + union.push({ + is: () => + ts.factory.createStrictEquality( + ts.factory.createStringLiteral("boolean"), + ts.factory.createTypeOfExpression(props.input), + ), + value: () => + decode_bool({ + input: props.input, + index: schema.index, + }), + }); + else if (schema.type === "bigint") + union.push( + decode_bigint({ + input: props.input, + type: schema.name, + candidates: props.protobuf.union + .filter((s) => s.type === "bigint") + .map((s) => s.name), + index: schema.index, + }), + ); + else if (schema.type === "number") + union.push( + decode_number({ + input: props.input, + type: schema.name, + candidates: props.protobuf.union + .filter((s) => s.type === "number") + .map((s) => s.name), + index: schema.index, + }), + ); + else if (schema.type === "string") + union.push({ + is: () => + ts.factory.createStrictEquality( + ts.factory.createStringLiteral("string"), + ts.factory.createTypeOfExpression(props.input), + ), + value: () => + decode_bytes({ + method: "string", + index: schema.index, + input: props.input, + }), + }); + //---- + // INSTANCES + //---- + else if (schema.type === "bytes") + union.push({ + is: () => ExpressionFactory.isInstanceOf("Uint8Array", props.input), + value: () => + decode_bytes({ + method: "bytes", + index: schema.index, + input: props.input, + }), + }); + else if (schema.type === "array") + union.push({ + is: () => ExpressionFactory.isArray(props.input), + value: () => + decode_array({ + context: props.context, + functor: props.functor, + input: props.input, + schema, + }), + }); + else if (schema.type === "map" && schema.map instanceof MetadataMap) { + union.push({ + is: () => ExpressionFactory.isInstanceOf("Map", props.input), + value: () => + decode_map({ + context: props.context, + functor: props.functor, + schema, + input: props.input, + }), + }); + } + const objectSchemas: Array< + IProtobufPropertyType.IObject | IProtobufPropertyType.IMap + > = props.protobuf.union + .filter((schema) => schema.type === "object" || schema.type === "map") + .filter( + (schema) => + schema.type === "object" || + (schema.type === "map" && schema.map instanceof MetadataObjectType), + ); + if (objectSchemas.length !== 0) + union.push({ + is: () => + ExpressionFactory.isObject({ + checkNull: true, + checkArray: false, + input: props.input, + }), + value: () => + explore_objects({ + context: props.context, + functor: props.functor, + level: 0, + schemas: objectSchemas, + explore: { + ...props.explore, + from: "object", + }, + input: props.input, + }), + }); + } + + // RETURNS const wrapper: (block: ts.Block) => ts.Block = props.metadata.isRequired() && props.metadata.nullable === false ? (block) => block @@ -305,387 +419,42 @@ export namespace ProtobufEncodeProgrammer { ], true, ); - - // STARTS FROM ATOMIC TYPES - // @todo - const unions: IUnion[] = []; - const numbers = Array.from(ProtobufUtil.getNumbers(props.metadata).keys()); - const bigints = Array.from(ProtobufUtil.getBigints(props.metadata).keys()); - - for (const [atom] of ProtobufUtil.getAtomics(props.metadata)) - if (atom === "bool") - unions.push({ - type: "bool", - is: () => - ts.factory.createStrictEquality( - ts.factory.createStringLiteral("boolean"), - ts.factory.createTypeOfExpression(props.input), - ), - value: (index) => - decode_bool({ - index, - input: props.input, - }), - }); - else if ( - atom === "int32" || - atom === "uint32" || - atom === "float" || - atom === "double" - ) - unions.push( - decode_number({ - candidates: numbers as ProtobufAtomic.Numeric[], - type: atom, - input: props.input, - }), - ); - else if (atom === "int64" || atom === "uint64") - if (numbers.some((n) => n === atom)) - unions.push( - decode_number({ - candidates: numbers as ProtobufAtomic.Numeric[], - type: atom, - input: props.input, - }), - ); - else - unions.push( - decode_bigint({ - candidates: bigints as ProtobufAtomic.BigNumeric[], - type: atom, - input: props.input, - }), - ); - else if (atom === "string") - unions.push({ - type: "string", - is: () => - ts.factory.createStrictEquality( - ts.factory.createStringLiteral("string"), - ts.factory.createTypeOfExpression(props.input), - ), - value: (index) => - decode_bytes({ - method: "string", - index: index!, - input: props.input, - }), - }); - - // CONSIDER BYTES - if (props.metadata.natives.length) - unions.push({ - type: "bytes", - is: () => ExpressionFactory.isInstanceOf("Uint8Array", props.input), - value: (index) => - decode_bytes({ - method: "bytes", - index: index!, - input: props.input, - }), - }); - - // CONSIDER ARRAYS - if (props.metadata.arrays.length) - unions.push({ - type: "array", - is: () => ExpressionFactory.isArray(props.input), - value: (index) => - decode_array({ - ...props, - array: props.metadata.arrays[0]!, - explore: { - ...props.explore, - from: "array", - }, - index: index!, - }), - }); - - // CONSIDER MAPS - if (props.metadata.maps.length) - unions.push({ - type: "map", - is: () => ExpressionFactory.isInstanceOf("Map", props.input), - value: (index) => - decode_map({ - ...props, - index: index!, - entry: props.metadata.maps[0]!, - explore: { - ...props.explore, - from: "array", - }, - }), - }); - - // CONSIDER OBJECTS - if (props.metadata.objects.length) - unions.push({ - type: "object", - is: () => - ExpressionFactory.isObject({ - checkNull: true, - checkArray: false, - input: props.input, - }), - value: (index) => - explore_objects({ - ...props, - level: 0, - index, - objects: props.metadata.objects.map((o) => o.type), - explore: { - ...props.explore, - from: "object", - }, - }), - }); - - // RETURNS - if (unions.length === 1) return wrapper(unions[0]!.value(props.index)); - else - return wrapper( - iterate({ - context: props.context, - functor: props.functor, - index: props.index, - unions, - expected: props.metadata.getName(), - input: props.input, - }), - ); - }; - - const iterate = (props: { - context: ITypiaContext; - functor: FunctionProgrammer; - index: number | null; - unions: IUnion[]; - expected: string; - input: ts.Expression; - }) => - ts.factory.createBlock( - [ - props.unions - .map((u, i) => - ts.factory.createIfStatement( - u.is(), - u.value(props.index ? props.index + i : null), - i === props.unions.length - 1 - ? create_throw_error(props) - : undefined, - ), - ) - .reverse() - .reduce((a, b) => - ts.factory.createIfStatement(b.expression, b.thenStatement, a), - ), - ], - true, - ); - - const decode_map = (props: { - context: ITypiaContext; - functor: FunctionProgrammer; - index: number; - input: ts.Expression; - entry: MetadataMap | MetadataProperty; - explore: FeatureProgrammer.IExplore; - }): ts.Block => { - const each: ts.Statement[] = [ - ts.factory.createExpressionStatement( - decode_tag({ - wire: ProtobufWire.LEN, - index: props.index, - }), - ), - ts.factory.createExpressionStatement( - ts.factory.createCallExpression( - IdentifierFactory.access(WRITER(), "fork"), - undefined, - undefined, - ), - ), - ...decode({ - ...props, - index: 1, - input: ts.factory.createIdentifier("key"), - metadata: props.entry.key, - }).statements, - ...decode({ - ...props, - index: 2, - input: ts.factory.createIdentifier("value"), - metadata: props.entry.value, - }).statements, - ts.factory.createExpressionStatement( - ts.factory.createCallExpression( - IdentifierFactory.access(WRITER(), "ldelim"), - undefined, - undefined, - ), - ), - ]; - return ts.factory.createBlock( - [ - ts.factory.createForOfStatement( - undefined, - StatementFactory.entry({ - key: "key", - value: "value", - }), - props.input, - ts.factory.createBlock(each), - ), - ], - true, - ); - }; - - const decode_object = (props: { - context: ITypiaContext; - functor: FunctionProgrammer; - index: number | null; - input: ts.Expression; - object: MetadataObjectType; - explore: FeatureProgrammer.IExplore; - }): ts.Block => { - const top: MetadataProperty = props.object.properties[0]!; - if (top.key.isSoleLiteral() === false) - return decode_map({ - ...props, - index: props.index!, - input: ts.factory.createCallExpression( - ts.factory.createIdentifier("Object.entries"), - [], - [props.input], - ), - entry: MetadataProperty.create({ - ...top, - key: (() => { - const key: Metadata = Metadata.initialize(); - key.atomics.push( - MetadataAtomic.create({ - type: "string", - tags: [], - }), - ); - return key; - })(), - }), - }); - return ts.factory.createBlock( - [ - ts.factory.createIdentifier( - `//${props.index !== null ? ` ${props.index} -> ` : ""}${props.object.name}`, - ), - ...(props.index !== null - ? [ - decode_tag({ - wire: ProtobufWire.LEN, - index: props.index, - }), - ts.factory.createCallExpression( - IdentifierFactory.access(WRITER(), "fork"), - undefined, - undefined, - ), - ] - : []), - ts.factory.createCallExpression( - ts.factory.createIdentifier( - props.functor.useLocal(`${PREFIX}o${props.object.index}`), - ), - [], - [props.input], - ), - ...(props.index !== null - ? [ - ts.factory.createCallExpression( - IdentifierFactory.access(WRITER(), "ldelim"), - undefined, - undefined, - ), - ] - : []), - ].map((expr) => ts.factory.createExpressionStatement(expr)), - true, - ); - }; - - const decode_array = (props: { - context: ITypiaContext; - functor: FunctionProgrammer; - index: number; - input: ts.Expression; - array: MetadataArray; - explore: FeatureProgrammer.IExplore; - }): ts.Block => { - const wire = get_standalone_wire(props.array.type.value); - const forLoop = (index: number | null) => - ts.factory.createForOfStatement( - undefined, - ts.factory.createVariableDeclarationList( - [ts.factory.createVariableDeclaration("elem")], - ts.NodeFlags.Const, - ), - props.input, - decode({ - ...props, - input: ts.factory.createIdentifier("elem"), - index, - metadata: props.array.type.value, - }), - ); - const length = (block: ts.Block) => - ts.factory.createBlock( - [ - ts.factory.createIfStatement( - ts.factory.createStrictInequality( - ExpressionFactory.number(0), - IdentifierFactory.access(props.input, "length"), - ), - block, - ), - ], - true, - ); - - if (wire === ProtobufWire.LEN) - return length(ts.factory.createBlock([forLoop(props.index)], true)); - return length( + if (union.length === 1) return wrapper(union[0]!.value()); + return wrapper( ts.factory.createBlock( [ - ts.factory.createExpressionStatement( - decode_tag({ - wire: ProtobufWire.LEN, - index: props.index, - }), - ), - ts.factory.createExpressionStatement( - ts.factory.createCallExpression( - IdentifierFactory.access(WRITER(), "fork"), - undefined, - undefined, - ), - ), - forLoop(null), - ts.factory.createExpressionStatement( - ts.factory.createCallExpression( - IdentifierFactory.access(WRITER(), "ldelim"), - undefined, - undefined, + union + .map((u, i) => + ts.factory.createIfStatement( + u.is(), + u.value(), + i === union.length - 1 + ? create_throw_error({ + context: props.context, + functor: props.functor, + input: props.input, + expected: props.metadata.getName(), + }) + : undefined, + ), + ) + .reverse() + .reduce((a, b) => + ts.factory.createIfStatement(b.expression, b.thenStatement, a), ), - ), ], true, ), ); }; - const decode_bool = (props: { index: number | null; input: ts.Expression }) => + /* ----------------------------------------------------------- + ATOMIC DECODERS + ----------------------------------------------------------- */ + const decode_bool = (props: { + input: ts.Expression; + index: number | null; + }): ts.Block => ts.factory.createBlock( [ ...(props.index !== null @@ -696,95 +465,128 @@ export namespace ProtobufEncodeProgrammer { }), ] : []), - ts.factory.createCallExpression( - IdentifierFactory.access(WRITER(), "bool"), - undefined, - [props.input], - ), + callWriter("bool", [props.input]), ].map((exp) => ts.factory.createExpressionStatement(exp)), true, ); - const decode_number = (props: { - candidates: ProtobufAtomic.Numeric[]; - type: ProtobufAtomic.Numeric; + const decode_bigint = (props: { + candidates: ProtobufAtomic.BigNumeric[]; + type: ProtobufAtomic.BigNumeric; input: ts.Expression; + index: number | null; }): IUnion => ({ - type: props.type, is: () => props.candidates.length === 1 ? ts.factory.createStrictEquality( - ts.factory.createStringLiteral("number"), + ts.factory.createStringLiteral("bigint"), ts.factory.createTypeOfExpression(props.input), ) : ts.factory.createLogicalAnd( ts.factory.createStrictEquality( - ts.factory.createStringLiteral("number"), + ts.factory.createStringLiteral("bigint"), ts.factory.createTypeOfExpression(props.input), ), - NumericRangeFactory.number(props.type, props.input), + NumericRangeFactory.bigint(props.type, props.input), ), - value: (index) => + value: () => ts.factory.createBlock( [ - ...(index !== null + ...(props.index !== null ? [ decode_tag({ - wire: get_numeric_wire(props.type), - index, + wire: ProtobufWire.VARIANT, + index: props.index, }), ] : []), - ts.factory.createCallExpression( - IdentifierFactory.access(WRITER(), props.type), - undefined, - [props.input], - ), + callWriter(props.type, [props.input]), ].map((exp) => ts.factory.createExpressionStatement(exp)), true, ), }); - const decode_bigint = (props: { - candidates: ProtobufAtomic.BigNumeric[]; - type: ProtobufAtomic.BigNumeric; + const decode_number = (props: { + candidates: ProtobufAtomic.Numeric[]; + type: ProtobufAtomic.Numeric; input: ts.Expression; + index: number | null; }): IUnion => ({ - type: props.type, is: () => props.candidates.length === 1 ? ts.factory.createStrictEquality( - ts.factory.createStringLiteral("bigint"), + ts.factory.createStringLiteral("number"), ts.factory.createTypeOfExpression(props.input), ) : ts.factory.createLogicalAnd( ts.factory.createStrictEquality( - ts.factory.createStringLiteral("bigint"), + ts.factory.createStringLiteral("number"), ts.factory.createTypeOfExpression(props.input), ), - NumericRangeFactory.bigint(props.type, props.input), + NumericRangeFactory.number(props.type, props.input), ), - value: (index) => + value: () => ts.factory.createBlock( [ - ...(index !== null + ...(props.index !== null ? [ decode_tag({ - wire: ProtobufWire.VARIANT, - index, + wire: get_numeric_wire(props.type), + index: props.index, }), ] : []), - ts.factory.createCallExpression( - IdentifierFactory.access(WRITER(), props.type), - undefined, - [props.input], - ), + callWriter(props.type, [props.input]), ].map((exp) => ts.factory.createExpressionStatement(exp)), true, ), }); + const decode_container_value = (props: { + context: ITypiaContext; + functor: FunctionProgrammer; + schema: IProtobufPropertyType.IArray["value"]; + index: number; + kind: "array" | "map"; + input: ts.Expression; + }): ts.Block => { + if (props.schema.type === "bool") + return decode_bool({ + input: props.input, + index: props.kind === "array" ? null : props.index, + }); + else if (props.schema.type === "bigint") + return decode_bigint({ + input: props.input, + type: props.schema.name, + candidates: [props.schema.name], + index: props.kind === "array" ? null : props.index, + }).value(); + else if (props.schema.type === "number") + return decode_number({ + input: props.input, + type: props.schema.name, + candidates: [props.schema.name], + index: props.kind === "array" ? null : props.index, + }).value(); + else if (props.schema.type === "string" || props.schema.type === "bytes") + return decode_bytes({ + method: props.schema.type, + input: props.input, + index: props.index, + }); + return decode_object({ + context: props.context, + functor: props.functor, + schema: props.schema, + input: props.input, + index: props.index, + }); + }; + + /* ----------------------------------------------------------- + INSTANCE DECODERS + ----------------------------------------------------------- */ const decode_bytes = (props: { method: "bytes" | "string"; index: number; @@ -796,92 +598,199 @@ export namespace ProtobufEncodeProgrammer { wire: ProtobufWire.LEN, index: props.index, }), - ts.factory.createCallExpression( - IdentifierFactory.access(WRITER(), props.method), - undefined, - [props.input], - ), + callWriter(props.method, [props.input]), ].map((expr) => ts.factory.createExpressionStatement(expr)), true, ); - const decode_tag = (props: { - wire: ProtobufWire; - index: number; - }): ts.CallExpression => - ts.factory.createCallExpression( - IdentifierFactory.access(WRITER(), "uint32"), - undefined, - [ExpressionFactory.number((props.index << 3) | props.wire)], + const decode_array = (props: { + context: ITypiaContext; + functor: FunctionProgrammer; + schema: IProtobufPropertyType.IArray; + input: ts.Expression; + }): ts.Block => { + const value: IProtobufPropertyType.IArray["value"] = props.schema.value; + const wire: ProtobufWire = (() => { + if ( + value.type === "object" || + value.type === "bytes" || + value.type === "string" + ) + return ProtobufWire.LEN; + else if (value.type === "number" && value.name === "float") + return ProtobufWire.I32; + return ProtobufWire.VARIANT; + })(); + const forLoop = () => + ts.factory.createForOfStatement( + undefined, + ts.factory.createVariableDeclarationList( + [ts.factory.createVariableDeclaration("elem")], + ts.NodeFlags.Const, + ), + props.input, + decode_container_value({ + kind: "array", + context: props.context, + functor: props.functor, + input: ts.factory.createIdentifier("elem"), + index: props.schema.index, + schema: props.schema.value, + }), + ); + const length = (block: ts.Block) => + ts.factory.createBlock( + [ + ts.factory.createIfStatement( + ts.factory.createStrictInequality( + ExpressionFactory.number(0), + IdentifierFactory.access(props.input, "length"), + ), + block, + ), + ], + true, + ); + if (wire === ProtobufWire.LEN) + return length(ts.factory.createBlock([forLoop()], true)); + return length( + ts.factory.createBlock( + [ + ts.factory.createExpressionStatement( + decode_tag({ + wire: ProtobufWire.LEN, + index: props.schema.index, + }), + ), + ts.factory.createExpressionStatement(callWriter("fork")), + forLoop(), + ts.factory.createExpressionStatement(callWriter("ldelim")), + ], + true, + ), ); + }; - const get_standalone_wire = (metadata: Metadata): ProtobufWire => { - if ( - metadata.arrays.length || - metadata.objects.length || - metadata.maps.length || - metadata.natives.length - ) - return ProtobufWire.LEN; + const decode_object = (props: { + context: ITypiaContext; + functor: FunctionProgrammer; + schema: IProtobufSchema.IObject; + index: number; + input: ts.Expression; + }): ts.Block => + ts.factory.createBlock( + [ + decode_tag({ + wire: ProtobufWire.LEN, + index: props.index, + }), + callWriter("fork"), + ts.factory.createCallExpression( + ts.factory.createIdentifier( + props.functor.useLocal(`${PREFIX}o${props.schema.object.index}`), + ), + [], + [props.input], + ), + callWriter("ldelim"), + ].map(ts.factory.createExpressionStatement), + true, + ); - // @todo - const v = ProtobufUtil.getAtomics(metadata).keys().next().value!; - if (v === "string") return ProtobufWire.LEN; - else if ( - v === "bool" || - v === "int32" || - v === "uint32" || - v === "int64" || - v === "uint64" - ) - return ProtobufWire.VARIANT; - else if (v === "float") return ProtobufWire.I32; - return ProtobufWire.I64; + const decode_map = (props: { + context: ITypiaContext; + functor: FunctionProgrammer; + schema: IProtobufPropertyType.IMap; + input: ts.Expression; + }): ts.Block => { + const each: ts.Statement[] = [ + ts.factory.createExpressionStatement( + decode_tag({ + wire: ProtobufWire.LEN, + index: props.schema.index, + }), + ), + ts.factory.createExpressionStatement(callWriter("fork")), + ...decode_container_value({ + kind: "map", + context: props.context, + functor: props.functor, + index: 1, + input: ts.factory.createIdentifier("key"), + schema: props.schema.key, + }).statements, + ...decode_container_value({ + kind: "map", + context: props.context, + functor: props.functor, + index: 2, + input: ts.factory.createIdentifier("value"), + schema: props.schema.value, + }).statements, + ts.factory.createExpressionStatement(callWriter("ldelim")), + ]; + return ts.factory.createBlock( + [ + ts.factory.createForOfStatement( + undefined, + StatementFactory.entry({ + key: "key", + value: "value", + }), + props.input, + ts.factory.createBlock(each), + ), + ], + true, + ); }; - const get_numeric_wire = (type: ProtobufAtomic.Numeric) => - type === "double" - ? ProtobufWire.I64 - : type === "float" - ? ProtobufWire.I32 - : ProtobufWire.VARIANT; - - /* ----------------------------------------------------------- - EXPLORERS - ----------------------------------------------------------- */ const explore_objects = (props: { context: ITypiaContext; functor: FunctionProgrammer; level: number; - index: number | null; input: ts.Expression; - objects: MetadataObjectType[]; + schemas: Array; explore: FeatureProgrammer.IExplore; - indexes?: Map; }): ts.Block => { - if (props.objects.length === 1) - return decode_object({ - context: props.context, - functor: props.functor, - index: props.indexes - ? props.indexes.get(props.objects[0]!)! - : props.index, - input: props.input, - object: props.objects[0]!, - explore: props.explore, - }); - - const expected: string = `(${props.objects.map((t) => t.name).join(" | ")})`; + const out = ( + schema: IProtobufPropertyType.IObject | IProtobufPropertyType.IMap, + ) => + schema.type === "object" + ? decode_object({ + context: props.context, + functor: props.functor, + schema, + index: schema.index, + input: props.input, + }) + : decode_map({ + context: props.context, + functor: props.functor, + schema, + input: ts.factory.createCallExpression( + IdentifierFactory.access( + ts.factory.createIdentifier("Object"), + "entries", + ), + undefined, + [props.input], + ), + }); + if (props.schemas.length === 1) return out(props.schemas[0]!); - // POSSIBLE TO SPECIALIZE? - const specList: UnionPredicator.ISpecialized[] = UnionPredicator.object( - props.objects, + const objects: MetadataObjectType[] = props.schemas.map((s) => + s.type === "map" ? (s.map as MetadataObjectType) : s.object, ); - const indexes: Map = - props.indexes ?? - new Map(props.objects.map((t, i) => [t, props.index! + i])); - - if (specList.length === 0) { + const expected: string = `(${objects.map((t) => t.name).join(" | ")})`; + const indexes: WeakMap< + MetadataObjectType, + IProtobufPropertyType.IObject | IProtobufPropertyType.IMap + > = new WeakMap(objects.map((o, i) => [o, props.schemas[i]!])); + const specifications: UnionPredicator.ISpecialized[] = + UnionPredicator.object(objects); + + if (specifications.length === 0) { const condition: ts.Expression = decode_union_object({ checker: (v) => IsProgrammer.decode_object({ @@ -891,17 +800,7 @@ export namespace ProtobufEncodeProgrammer { input: v.input, explore: v.explore, }), - decoder: (v) => - ExpressionFactory.selfCall( - decode_object({ - context: props.context, - functor: props.functor, - index: indexes.get(v.object)!, - input: v.input, - object: v.object, - explore: v.explore, - }), - ), + decoder: (v) => ExpressionFactory.selfCall(out(indexes.get(v.object)!)), success: (expr) => expr, escaper: (v) => create_throw_error({ @@ -911,17 +810,17 @@ export namespace ProtobufEncodeProgrammer { input: v.input, }), input: props.input, - objects: props.objects, explore: props.explore, + objects, }); return StatementFactory.block(condition); } - const remained: MetadataObjectType[] = props.objects.filter( - (t) => specList.find((s) => s.object === t) === undefined, + const remained: MetadataObjectType[] = objects.filter( + (o) => specifications.find((s) => s.object === o) === undefined, ); // DO SPECIALIZE - const condition: ts.IfStatement = specList + const condition: ts.IfStatement = specifications .filter((spec) => spec.property.key.getSoleLiteral() !== null) .map((spec, i, array) => { const key: string = spec.property.key.getSoleLiteral()!; @@ -942,19 +841,11 @@ export namespace ProtobufEncodeProgrammer { }, }) : ExpressionFactory.isRequired(accessor); + const schema = indexes.get(spec.object)!; return ts.factory.createIfStatement( pred, ts.factory.createExpressionStatement( - ExpressionFactory.selfCall( - decode_object({ - context: props.context, - functor: props.functor, - index: indexes.get(spec.object)!, - input: props.input, - object: spec.object, - explore: props.explore, - }), - ), + ExpressionFactory.selfCall(out(schema)), ), i === array.length - 1 ? remained.length @@ -964,11 +855,9 @@ export namespace ProtobufEncodeProgrammer { context: props.context, functor: props.functor, level: props.level + 1, - index: props.index, input: props.input, - objects: remained, + schemas: remained.map((r) => indexes.get(r)!), explore: props.explore, - indexes, }), ), ) @@ -991,10 +880,25 @@ export namespace ProtobufEncodeProgrammer { }; /* ----------------------------------------------------------- - CONFIGURATIONS - ----------------------------------------------------------- */ + BACKGROUND FUNCTIONS + ----------------------------------------------------------- */ const PREFIX = "$pe"; + const decode_tag = (props: { + wire: ProtobufWire; + index: number; + }): ts.CallExpression => + callWriter("uint32", [ + ExpressionFactory.number((props.index << 3) | props.wire), + ]); + + const get_numeric_wire = (type: ProtobufAtomic.Numeric) => + type === "double" + ? ProtobufWire.I64 + : type === "float" + ? ProtobufWire.I32 + : ProtobufWire.VARIANT; + const create_throw_error = (props: { context: ITypiaContext; functor: FunctionProgrammer; @@ -1025,10 +929,17 @@ export namespace ProtobufEncodeProgrammer { ); } -const WRITER = () => ts.factory.createIdentifier("writer"); +const callWriter = ( + method: string, + args?: ts.Expression[], +): ts.CallExpression => + ts.factory.createCallExpression( + IdentifierFactory.access(ts.factory.createIdentifier("writer"), method), + undefined, + args, + ); interface IUnion { - type: string; is: () => ts.Expression; - value: (index: number | null) => ts.Block; + value: () => ts.Block; } diff --git a/test-esm/package.json b/test-esm/package.json index 64dd342ffe..7691788615 100644 --- a/test-esm/package.json +++ b/test-esm/package.json @@ -36,6 +36,6 @@ "typescript": "^5.4.5" }, "dependencies": { - "typia": "../typia-7.0.0-dev.20241019.tgz" + "typia": "../typia-7.0.0-dev.20241019-2.tgz" } } \ No newline at end of file diff --git a/test/generate/output/generate_protobuf.ts b/test/generate/output/generate_protobuf.ts index 32972eef69..8ef24efa82 100644 --- a/test/generate/output/generate_protobuf.ts +++ b/test/generate/output/generate_protobuf.ts @@ -20,22 +20,21 @@ export const createEncode = (() => { input: any, ): Writer => { const $peo0 = (input: any): any => { - // property "name"; + // property "name": (string & MaxLength<8>); writer.uint32(10); writer.string(input.name); - // property "extension"; + // property "extension": ((string & MinLength<1> & MaxLength<3>) | null); if (null !== input.extension) { writer.uint32(18); writer.string(input.extension); } - // property "size"; + // property "size": (number & Type<"uint32">); writer.uint32(24); writer.uint32(input.size); - // property "data"; + // property "data": Uint8Array; writer.uint32(34); writer.bytes(input.data); }; - //IFile; $peo0(input); return writer; }; @@ -162,18 +161,18 @@ export const createAssertEncode = (() => { input: any, ): Writer => { const $peo0 = (input: any): any => { - // property "name"; + // property "name": (string & MaxLength<8>); writer.uint32(10); writer.string(input.name); - // property "extension"; + // property "extension": ((string & MinLength<1> & MaxLength<3>) | null); if (null !== input.extension) { writer.uint32(18); writer.string(input.extension); } - // property "size"; + // property "size": (number & Type<"uint32">); writer.uint32(24); writer.uint32(input.size); - // property "data"; + // property "data": Uint8Array; writer.uint32(34); writer.bytes(input.data); }; @@ -189,7 +188,6 @@ export const createAssertEncode = (() => { 0 <= input.size && input.size <= 4294967295 && input.data instanceof Uint8Array; - //IFile; $peo0(input); return writer; }; @@ -259,18 +257,18 @@ export const createIsEncode = (() => { input: any, ): Writer => { const $peo0 = (input: any): any => { - // property "name"; + // property "name": (string & MaxLength<8>); writer.uint32(10); writer.string(input.name); - // property "extension"; + // property "extension": ((string & MinLength<1> & MaxLength<3>) | null); if (null !== input.extension) { writer.uint32(18); writer.string(input.extension); } - // property "size"; + // property "size": (number & Type<"uint32">); writer.uint32(24); writer.uint32(input.size); - // property "data"; + // property "data": Uint8Array; writer.uint32(34); writer.bytes(input.data); }; @@ -286,7 +284,6 @@ export const createIsEncode = (() => { 0 <= input.size && input.size <= 4294967295 && input.data instanceof Uint8Array; - //IFile; $peo0(input); return writer; }; @@ -379,18 +376,18 @@ export const createValidateEncode = (() => { input: any, ): Writer => { const $peo0 = (input: any): any => { - // property "name"; + // property "name": (string & MaxLength<8>); writer.uint32(10); writer.string(input.name); - // property "extension"; + // property "extension": ((string & MinLength<1> & MaxLength<3>) | null); if (null !== input.extension) { writer.uint32(18); writer.string(input.extension); } - // property "size"; + // property "size": (number & Type<"uint32">); writer.uint32(24); writer.uint32(input.size); - // property "data"; + // property "data": Uint8Array; writer.uint32(34); writer.bytes(input.data); }; @@ -406,7 +403,6 @@ export const createValidateEncode = (() => { 0 <= input.size && input.size <= 4294967295 && input.data instanceof Uint8Array; - //IFile; $peo0(input); return writer; }; diff --git a/test/package.json b/test/package.json index cccc194ced..9fb2ddace4 100644 --- a/test/package.json +++ b/test/package.json @@ -53,6 +53,6 @@ "suppress-warnings": "^1.0.2", "tstl": "^3.0.0", "uuid": "^9.0.1", - "typia": "../typia-7.0.0-dev.20241019.tgz" + "typia": "../typia-7.0.0-dev.20241019-2.tgz" } } \ No newline at end of file diff --git a/test/src/debug/encode.ts b/test/src/debug/encode.ts index 515aade02f..f5c5985214 100644 --- a/test/src/debug/encode.ts +++ b/test/src/debug/encode.ts @@ -1,11 +1,5 @@ -import typia, { tags } from "typia"; +import typia from "typia"; -interface ISomething { - id: - | (string & tags.Sequence<4>) - | (number & tags.Type<"uint32"> & tags.Sequence<6>) - | (number & tags.Type<"float"> & tags.Sequence<7>); - name: string; - age: number & tags.Type<"uint32"> & tags.Sequence<8>; -} -typia.protobuf.createEncode(); +import { DynamicSimple } from "../structures/DynamicSimple"; + +typia.protobuf.createEncode(); From 67f42234fdf7258288df1978fdee9ae894866d90 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Sat, 19 Oct 2024 23:43:29 +0900 Subject: [PATCH 2/3] Add failure test cases for `Sequence` --- ...r_protobuf_sequence_property_duplicated.ts | 27 + ...rror_protobuf_sequence_union_duplicated.ts | 32 + .../error_protobuf_sequence_union_omitted.ts | 29 + package.json | 1 + .../protobuf/ObjectSequenceProtobuf.proto | 27 + .../reflect/metadata/ObjectHttpNullable.json | 6 +- .../metadata/ObjectHttpUndefindable.json | 6 +- .../metadata/ObjectSequenceProtobuf.json | 971 ++++++++++++++++++ .../test_assert_ObjectSequenceProtobuf.ts | 11 + ...est_assertCustom_ObjectSequenceProtobuf.ts | 12 + ...test_assertGuard_ObjectSequenceProtobuf.ts | 11 + ...ssertGuardCustom_ObjectSequenceProtobuf.ts | 15 + ...est_createAssert_ObjectSequenceProtobuf.ts | 11 + ...eateAssertCustom_ObjectSequenceProtobuf.ts | 11 + ...reateAssertGuard_ObjectSequenceProtobuf.ts | 11 + ...ssertGuardCustom_ObjectSequenceProtobuf.ts | 14 + .../test_createIs_ObjectSequenceProtobuf.ts | 10 + ...est_createRandom_ObjectSequenceProtobuf.ts | 13 + ...t_createValidate_ObjectSequenceProtobuf.ts | 10 + ...l_assertFunction_ObjectSequenceProtobuf.ts | 12 + ...ertFunctionAsync_ObjectSequenceProtobuf.ts | 13 + ...ctionAsyncCustom_ObjectSequenceProtobuf.ts | 13 + ...rtFunctionCustom_ObjectSequenceProtobuf.ts | 12 + ...assertParameters_ObjectSequenceProtobuf.ts | 12 + ...tParametersAsync_ObjectSequenceProtobuf.ts | 13 + ...etersAsyncCustom_ObjectSequenceProtobuf.ts | 13 + ...ParametersCustom_ObjectSequenceProtobuf.ts | 12 + ...nal_assertReturn_ObjectSequenceProtobuf.ts | 12 + ...ssertReturnAsync_ObjectSequenceProtobuf.ts | 12 + ...eturnAsyncCustom_ObjectSequenceProtobuf.ts | 13 + ...sertReturnCustom_ObjectSequenceProtobuf.ts | 12 + ...ional_isFunction_ObjectSequenceProtobuf.ts | 10 + ..._isFunctionAsync_ObjectSequenceProtobuf.ts | 11 + ...nal_isParameters_ObjectSequenceProtobuf.ts | 11 + ...sParametersAsync_ObjectSequenceProtobuf.ts | 11 + ...ctional_isReturn_ObjectSequenceProtobuf.ts | 10 + ...al_isReturnAsync_ObjectSequenceProtobuf.ts | 11 + ...validateFunction_ObjectSequenceProtobuf.ts | 11 + ...ateFunctionAsync_ObjectSequenceProtobuf.ts | 11 + ...lidateParameters_ObjectSequenceProtobuf.ts | 11 + ...eParametersAsync_ObjectSequenceProtobuf.ts | 11 + ...l_validateReturn_ObjectSequenceProtobuf.ts | 11 + ...idateReturnAsync_ObjectSequenceProtobuf.ts | 11 + .../is/test_is_ObjectSequenceProtobuf.ts | 10 + ...t_notation_camel_ObjectSequenceProtobuf.ts | 15 + ...tion_createCamel_ObjectSequenceProtobuf.ts | 14 + ...ion_createPascal_ObjectSequenceProtobuf.ts | 14 + ...tion_createSnake_ObjectSequenceProtobuf.ts | 14 + ..._notation_pascal_ObjectSequenceProtobuf.ts | 15 + ...t_notation_snake_ObjectSequenceProtobuf.ts | 15 + ...buf_assertDecode_ObjectSequenceProtobuf.ts | 14 + ...sertDecodeCustom_ObjectSequenceProtobuf.ts | 17 + ...buf_assertEncode_ObjectSequenceProtobuf.ts | 15 + ...sertEncodeCustom_ObjectSequenceProtobuf.ts | 18 + ...eateAssertDecode_ObjectSequenceProtobuf.ts | 13 + ...sertDecodeCustom_ObjectSequenceProtobuf.ts | 15 + ...eateAssertEncode_ObjectSequenceProtobuf.ts | 14 + ...sertEncodeCustom_ObjectSequenceProtobuf.ts | 16 + ...buf_createDecode_ObjectSequenceProtobuf.ts | 12 + ...buf_createEncode_ObjectSequenceProtobuf.ts | 13 + ...f_createIsDecode_ObjectSequenceProtobuf.ts | 12 + ...f_createIsEncode_ObjectSequenceProtobuf.ts | 13 + ...teValidateDecode_ObjectSequenceProtobuf.ts | 12 + ...teValidateEncode_ObjectSequenceProtobuf.ts | 13 + ..._protobuf_decode_ObjectSequenceProtobuf.ts | 12 + ..._protobuf_encode_ObjectSequenceProtobuf.ts | 13 + ...rotobuf_isDecode_ObjectSequenceProtobuf.ts | 12 + ...rotobuf_isEncode_ObjectSequenceProtobuf.ts | 13 + ...protobuf_message_ObjectSequenceProtobuf.ts | 9 + ...f_validateDecode_ObjectSequenceProtobuf.ts | 13 + ...f_validateEncode_ObjectSequenceProtobuf.ts | 14 + .../test_random_ObjectSequenceProtobuf.ts | 14 + ...reflect_metadata_ObjectSequenceProtobuf.ts | 9 + .../test_validate_ObjectSequenceProtobuf.ts | 10 + test/src/structures/ObjectSequenceProtobuf.ts | 82 ++ tsconfig.errors.json | 6 + 76 files changed, 2002 insertions(+), 6 deletions(-) create mode 100644 errors/src/protobuf/error_protobuf_sequence_property_duplicated.ts create mode 100644 errors/src/protobuf/error_protobuf_sequence_union_duplicated.ts create mode 100644 errors/src/protobuf/error_protobuf_sequence_union_omitted.ts create mode 100644 test/schemas/protobuf/ObjectSequenceProtobuf.proto create mode 100644 test/schemas/reflect/metadata/ObjectSequenceProtobuf.json create mode 100644 test/src/features/assert/test_assert_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/assertCustom/test_assertCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/assertGuard/test_assertGuard_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/assertGuardCustom/test_assertGuardCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/createAssert/test_createAssert_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/createAssertCustom/test_createAssertCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/createAssertGuard/test_createAssertGuard_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/createAssertGuardCustom/test_createAssertGuardCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/createIs/test_createIs_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/createRandom/test_createRandom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/createValidate/test_createValidate_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.assertFunction/test_functional_assertFunction_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.assertFunctionAsync/test_functional_assertFunctionAsync_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.assertFunctionAsyncCustom/test_functional_assertFunctionAsyncCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.assertFunctionCustom/test_functional_assertFunctionCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.assertParameters/test_functional_assertParameters_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.assertParametersAsync/test_functional_assertParametersAsync_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.assertParametersAsyncCustom/test_functional_assertParametersAsyncCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.assertParametersCustom/test_functional_assertParametersCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.assertReturn/test_functional_assertReturn_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.assertReturnAsync/test_functional_assertReturnAsync_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.assertReturnAsyncCustom/test_functional_assertReturnAsyncCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.assertReturnCustom/test_functional_assertReturnCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.isFunction/test_functional_isFunction_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.isFunctionAsync/test_functional_isFunctionAsync_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.isParameters/test_functional_isParameters_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.isParametersAsync/test_functional_isParametersAsync_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.isReturn/test_functional_isReturn_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.isReturnAsync/test_functional_isReturnAsync_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.validateFunction/test_functional_validateFunction_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.validateFunctionAsync/test_functional_validateFunctionAsync_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.validateParameters/test_functional_validateParameters_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.validateParametersAsync/test_functional_validateParametersAsync_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.validateReturn/test_functional_validateReturn_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/functional.validateReturnAsync/test_functional_validateReturnAsync_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/is/test_is_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/notation.camel/test_notation_camel_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/notation.createCamel/test_notation_createCamel_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/notation.createPascal/test_notation_createPascal_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/notation.createSnake/test_notation_createSnake_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/notation.pascal/test_notation_pascal_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/notation.snake/test_notation_snake_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.assertDecode/test_protobuf_assertDecode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.assertDecodeCustom/test_protobuf_assertDecodeCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.assertEncode/test_protobuf_assertEncode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.assertEncodeCustom/test_protobuf_assertEncodeCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.createAssertDecode/test_protobuf_createAssertDecode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.createAssertDecodeCustom/test_protobuf_createAssertDecodeCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.createAssertEncode/test_protobuf_createAssertEncode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.createAssertEncodeCustom/test_protobuf_createAssertEncodeCustom_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.createDecode/test_protobuf_createDecode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.createEncode/test_protobuf_createEncode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.createIsDecode/test_protobuf_createIsDecode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.createIsEncode/test_protobuf_createIsEncode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.createValidateDecode/test_protobuf_createValidateDecode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.createValidateEncode/test_protobuf_createValidateEncode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.decode/test_protobuf_decode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.encode/test_protobuf_encode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.isDecode/test_protobuf_isDecode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.isEncode/test_protobuf_isEncode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.message/test_protobuf_message_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.validateDecode/test_protobuf_validateDecode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/protobuf.validateEncode/test_protobuf_validateEncode_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/random/test_random_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/reflect.metadata/test_reflect_metadata_ObjectSequenceProtobuf.ts create mode 100644 test/src/features/validate/test_validate_ObjectSequenceProtobuf.ts create mode 100644 test/src/structures/ObjectSequenceProtobuf.ts create mode 100644 tsconfig.errors.json diff --git a/errors/src/protobuf/error_protobuf_sequence_property_duplicated.ts b/errors/src/protobuf/error_protobuf_sequence_property_duplicated.ts new file mode 100644 index 0000000000..f2638068c2 --- /dev/null +++ b/errors/src/protobuf/error_protobuf_sequence_property_duplicated.ts @@ -0,0 +1,27 @@ +import typia, { tags } from "typia"; + +interface IPointer { + value: T; +} +interface Something { + id: string & tags.Sequence<1>; + age: number & tags.Sequence<1>; +} + +// MESSAGE +typia.protobuf.message(); +typia.protobuf.message>(); +typia.protobuf.message>(); +typia.protobuf.message>>(); + +// DECODE +typia.protobuf.createDecode(); +typia.protobuf.createDecode>(); +typia.protobuf.createDecode>(); +typia.protobuf.createDecode>>(); + +// ENCODE +typia.protobuf.createEncode(); +typia.protobuf.createEncode>(); +typia.protobuf.createEncode>(); +typia.protobuf.createEncode>>(); diff --git a/errors/src/protobuf/error_protobuf_sequence_union_duplicated.ts b/errors/src/protobuf/error_protobuf_sequence_union_duplicated.ts new file mode 100644 index 0000000000..8ee4fb5b23 --- /dev/null +++ b/errors/src/protobuf/error_protobuf_sequence_union_duplicated.ts @@ -0,0 +1,32 @@ +import typia, { tags } from "typia"; + +interface IPointer { + value: T; +} +interface Something { + id: + | (number & tags.Type<"uint32"> & tags.Sequence<1>) + | (number & tags.Type<"double"> & tags.Sequence<2>) + | (string & tags.Sequence<3>); + sex: + | (number & tags.Type<"uint32"> & tags.Sequence<4>) + | (string & tags.Sequence<3>); +} + +// MESSAGE +typia.protobuf.message(); +typia.protobuf.message>(); +typia.protobuf.message>(); +typia.protobuf.message>>(); + +// DECODE +typia.protobuf.createDecode(); +typia.protobuf.createDecode>(); +typia.protobuf.createDecode>(); +typia.protobuf.createDecode>>(); + +// ENCODE +typia.protobuf.createEncode(); +typia.protobuf.createEncode>(); +typia.protobuf.createEncode>(); +typia.protobuf.createEncode>>(); diff --git a/errors/src/protobuf/error_protobuf_sequence_union_omitted.ts b/errors/src/protobuf/error_protobuf_sequence_union_omitted.ts new file mode 100644 index 0000000000..3bfac708ff --- /dev/null +++ b/errors/src/protobuf/error_protobuf_sequence_union_omitted.ts @@ -0,0 +1,29 @@ +import typia, { tags } from "typia"; + +interface IPointer { + value: T; +} +interface Something { + id: + | (number & tags.Type<"uint32"> & tags.Sequence<1>) + | (number & tags.Type<"double"> & tags.Sequence<2>) + | string; +} + +// MESSAGE +typia.protobuf.message(); +typia.protobuf.message>(); +typia.protobuf.message>(); +typia.protobuf.message>>(); + +// DECODE +typia.protobuf.createDecode(); +typia.protobuf.createDecode>(); +typia.protobuf.createDecode>(); +typia.protobuf.createDecode>>(); + +// ENCODE +typia.protobuf.createEncode(); +typia.protobuf.createEncode>(); +typia.protobuf.createEncode>(); +typia.protobuf.createEncode>>(); diff --git a/package.json b/package.json index 6cf810f80e..823304eb63 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "-------------------------------------------------": "", "build": "rimraf lib && tsc && rollup -c", "dev": "tsc --project tsconfig.test.json --watch", + "dev:errors": "tsc --project tsconfig.errors.json --watch", "eslint": "eslint ./**/*.ts", "eslint:fix": "eslint ./**/*.ts --fix", "prettier": "prettier src --write", diff --git a/test/schemas/protobuf/ObjectSequenceProtobuf.proto b/test/schemas/protobuf/ObjectSequenceProtobuf.proto new file mode 100644 index 0000000000..85b22a94d9 --- /dev/null +++ b/test/schemas/protobuf/ObjectSequenceProtobuf.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; + +message ObjectSequenceProtobuf { + repeated ObjectSequenceProtobuf.IMember value = 1; + message IMember { + oneof id { + bytes v13 = 13; + uint64 v12 = 12; + string v11 = 11; + } + optional string name = 20; + repeated ObjectSequenceProtobuf.IMember children = 30; + map keywords = 40; + oneof thumbnail { + bytes v41 = 41; + string v42 = 42; + } + required string email = 43; + repeated ObjectSequenceProtobuf.IHobby hobbies = 44; + } + + message IHobby { + required string id = 1; + required string name = 2; + required bool valid = 3; + } +} \ No newline at end of file diff --git a/test/schemas/reflect/metadata/ObjectHttpNullable.json b/test/schemas/reflect/metadata/ObjectHttpNullable.json index 0012eeffe5..e130e34592 100644 --- a/test/schemas/reflect/metadata/ObjectHttpNullable.json +++ b/test/schemas/reflect/metadata/ObjectHttpNullable.json @@ -519,15 +519,15 @@ "type": "string", "values": [ { - "value": "three", + "value": "one", "tags": [] }, { - "value": "two", + "value": "three", "tags": [] }, { - "value": "one", + "value": "two", "tags": [] } ] diff --git a/test/schemas/reflect/metadata/ObjectHttpUndefindable.json b/test/schemas/reflect/metadata/ObjectHttpUndefindable.json index c88559726b..d141306464 100644 --- a/test/schemas/reflect/metadata/ObjectHttpUndefindable.json +++ b/test/schemas/reflect/metadata/ObjectHttpUndefindable.json @@ -502,15 +502,15 @@ "type": "string", "values": [ { - "value": "three", + "value": "one", "tags": [] }, { - "value": "two", + "value": "three", "tags": [] }, { - "value": "one", + "value": "two", "tags": [] } ] diff --git a/test/schemas/reflect/metadata/ObjectSequenceProtobuf.json b/test/schemas/reflect/metadata/ObjectSequenceProtobuf.json new file mode 100644 index 0000000000..571679b167 --- /dev/null +++ b/test/schemas/reflect/metadata/ObjectSequenceProtobuf.json @@ -0,0 +1,971 @@ +{ + "metadatas": [ + { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [ + { + "name": "ObjectSequenceProtobuf", + "tags": [] + } + ], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + } + ], + "components": { + "objects": [ + { + "name": "ObjectSequenceProtobuf", + "properties": [ + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "value", + "tags": [] + } + ] + } + ], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [ + { + "name": "Array", + "tags": [] + } + ], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "description": "Reference of the value.", + "jsDocTags": [] + } + ], + "description": "Pointer referencing value.", + "jsDocTags": [], + "index": 0, + "recursive": false, + "nullables": [ + false + ] + }, + { + "name": "ObjectSequenceProtobuf.IMember", + "properties": [ + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "id", + "tags": [] + } + ] + } + ], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [ + { + "type": "string", + "tags": [ + [ + { + "target": "string", + "name": "Sequence<11>", + "kind": "sequence", + "value": 11, + "exclusive": false, + "schema": { + "x-protobuf-sequence": 11 + } + } + ] + ] + }, + { + "type": "number", + "tags": [ + [ + { + "target": "number", + "name": "Type<\"uint64\">", + "kind": "type", + "value": "uint64", + "validate": "Math.floor($input) === $input && 0 <= $input && $input <= 18446744073709551615", + "exclusive": true, + "schema": { + "type": "integer" + } + }, + { + "target": "number", + "name": "Sequence<12>", + "kind": "sequence", + "value": 12, + "exclusive": false, + "schema": { + "x-protobuf-sequence": 12 + } + } + ] + ] + } + ], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [ + { + "name": "Uint8Array", + "tags": [ + [ + { + "target": "object", + "name": "Sequence<13>", + "kind": "sequence", + "value": 13, + "exclusive": false, + "schema": { + "x-protobuf-sequence": 13 + } + } + ] + ] + } + ], + "sets": [], + "maps": [] + }, + "description": null, + "jsDocTags": [] + }, + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "name", + "tags": [] + } + ] + } + ], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": true, + "functions": [], + "atomics": [ + { + "type": "string", + "tags": [ + [ + { + "target": "string", + "name": "Sequence<20>", + "kind": "sequence", + "value": 20, + "exclusive": false, + "schema": { + "x-protobuf-sequence": 20 + } + } + ] + ] + } + ], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "description": null, + "jsDocTags": [] + }, + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "children", + "tags": [] + } + ] + } + ], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [ + { + "name": "Array", + "tags": [ + [ + { + "target": "array", + "name": "Sequence<30>", + "kind": "sequence", + "value": 30, + "exclusive": false, + "schema": { + "x-protobuf-sequence": 30 + } + } + ] + ] + } + ], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "description": null, + "jsDocTags": [] + }, + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "keywords", + "tags": [] + } + ] + } + ], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [ + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [ + { + "type": "string", + "tags": [] + } + ], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [ + { + "type": "string", + "tags": [] + } + ], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "tags": [ + [ + { + "target": "object", + "name": "Sequence<40>", + "kind": "sequence", + "value": 40, + "exclusive": false, + "schema": { + "x-protobuf-sequence": 40 + } + } + ] + ] + } + ] + }, + "description": null, + "jsDocTags": [] + }, + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "thumbnail", + "tags": [] + } + ] + } + ], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [ + { + "type": "string", + "tags": [ + [ + { + "target": "string", + "name": "Format<\"uri\">", + "kind": "format", + "value": "uri", + "validate": "/\\/|:/.test($input) && /^(?:[a-z][a-z0-9+\\-.]*:)(?:\\/?\\/(?:(?:[a-z0-9\\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\\.[a-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)|(?:[a-z0-9\\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\\d*)?(?:\\/(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\\/(?:(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\\/(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\\/(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\\?(?:[a-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i.test($input)", + "exclusive": [ + "format", + "pattern" + ], + "schema": { + "format": "uri" + } + }, + { + "target": "string", + "name": "ContentMediaType<\"image/*\">", + "kind": "contentMediaType", + "exclusive": false, + "schema": { + "contentMediaType": "image/*" + } + } + ] + ] + } + ], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [ + { + "name": "Uint8Array", + "tags": [] + } + ], + "sets": [], + "maps": [] + }, + "description": null, + "jsDocTags": [] + }, + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "email", + "tags": [] + } + ] + } + ], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [ + { + "type": "string", + "tags": [ + [ + { + "target": "string", + "name": "Format<\"email\">", + "kind": "format", + "value": "email", + "validate": "/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test($input)", + "exclusive": [ + "format", + "pattern" + ], + "schema": { + "format": "email" + } + } + ] + ] + } + ], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "description": null, + "jsDocTags": [] + }, + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "hobbies", + "tags": [] + } + ] + } + ], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [ + { + "name": "Array", + "tags": [] + } + ], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "description": null, + "jsDocTags": [] + } + ], + "jsDocTags": [], + "index": 1, + "recursive": true, + "nullables": [ + false + ] + }, + { + "name": "ObjectSequenceProtobuf.IHobby", + "properties": [ + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "id", + "tags": [] + } + ] + } + ], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [ + { + "type": "string", + "tags": [ + [ + { + "target": "string", + "name": "Format<\"uuid\">", + "kind": "format", + "value": "uuid", + "validate": "/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i.test($input)", + "exclusive": [ + "format", + "pattern" + ], + "schema": { + "format": "uuid" + } + } + ] + ] + } + ], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "description": null, + "jsDocTags": [] + }, + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "name", + "tags": [] + } + ] + } + ], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [ + { + "type": "string", + "tags": [] + } + ], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "description": null, + "jsDocTags": [] + }, + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "valid", + "tags": [] + } + ] + } + ], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [ + { + "type": "boolean", + "tags": [] + } + ], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "description": null, + "jsDocTags": [] + } + ], + "jsDocTags": [], + "index": 2, + "recursive": false, + "nullables": [ + false + ] + } + ], + "aliases": [], + "arrays": [ + { + "name": "Array", + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [ + { + "name": "ObjectSequenceProtobuf.IMember", + "tags": [] + } + ], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "nullables": [ + false + ], + "recursive": false, + "index": null + }, + { + "name": "Array", + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [ + { + "name": "ObjectSequenceProtobuf.IHobby", + "tags": [] + } + ], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "nullables": [ + false + ], + "recursive": false, + "index": null + } + ], + "tuples": [] + } +} \ No newline at end of file diff --git a/test/src/features/assert/test_assert_ObjectSequenceProtobuf.ts b/test/src/features/assert/test_assert_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..695a4f9390 --- /dev/null +++ b/test/src/features/assert/test_assert_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_assert } from "../../internal/_test_assert"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_assert_ObjectSequenceProtobuf = _test_assert(TypeGuardError)( + "ObjectSequenceProtobuf", +)(ObjectSequenceProtobuf)((input) => + typia.assert(input), +); diff --git a/test/src/features/assertCustom/test_assertCustom_ObjectSequenceProtobuf.ts b/test/src/features/assertCustom/test_assertCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..794fe24430 --- /dev/null +++ b/test/src/features/assertCustom/test_assertCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_assert } from "../../internal/_test_assert"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_assertCustom_ObjectSequenceProtobuf = _test_assert( + CustomGuardError, +)("ObjectSequenceProtobuf")(ObjectSequenceProtobuf)( + (input) => + typia.assert(input, (p) => new CustomGuardError(p)), +); diff --git a/test/src/features/assertGuard/test_assertGuard_ObjectSequenceProtobuf.ts b/test/src/features/assertGuard/test_assertGuard_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..0ed022f3c8 --- /dev/null +++ b/test/src/features/assertGuard/test_assertGuard_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_assertGuard } from "../../internal/_test_assertGuard"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_assertGuard_ObjectSequenceProtobuf = _test_assertGuard( + TypeGuardError, +)("ObjectSequenceProtobuf")(ObjectSequenceProtobuf)( + (input) => typia.assertGuard(input), +); diff --git a/test/src/features/assertGuardCustom/test_assertGuardCustom_ObjectSequenceProtobuf.ts b/test/src/features/assertGuardCustom/test_assertGuardCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..904bd93c5a --- /dev/null +++ b/test/src/features/assertGuardCustom/test_assertGuardCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,15 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_assertGuard } from "../../internal/_test_assertGuard"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_assertGuardCustom_ObjectSequenceProtobuf = _test_assertGuard( + CustomGuardError, +)("ObjectSequenceProtobuf")(ObjectSequenceProtobuf)( + (input) => + typia.assertGuard( + input, + (p) => new CustomGuardError(p), + ), +); diff --git a/test/src/features/createAssert/test_createAssert_ObjectSequenceProtobuf.ts b/test/src/features/createAssert/test_createAssert_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..5a8af2d8f2 --- /dev/null +++ b/test/src/features/createAssert/test_createAssert_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_assert } from "../../internal/_test_assert"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_createAssert_ObjectSequenceProtobuf = _test_assert( + TypeGuardError, +)("ObjectSequenceProtobuf")(ObjectSequenceProtobuf)( + typia.createAssert(), +); diff --git a/test/src/features/createAssertCustom/test_createAssertCustom_ObjectSequenceProtobuf.ts b/test/src/features/createAssertCustom/test_createAssertCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..4f2fd82fae --- /dev/null +++ b/test/src/features/createAssertCustom/test_createAssertCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_assert } from "../../internal/_test_assert"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_createAssertCustom_ObjectSequenceProtobuf = _test_assert( + CustomGuardError, +)("ObjectSequenceProtobuf")(ObjectSequenceProtobuf)( + typia.createAssert((p) => new CustomGuardError(p)), +); diff --git a/test/src/features/createAssertGuard/test_createAssertGuard_ObjectSequenceProtobuf.ts b/test/src/features/createAssertGuard/test_createAssertGuard_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..7efc981b15 --- /dev/null +++ b/test/src/features/createAssertGuard/test_createAssertGuard_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_assertGuard } from "../../internal/_test_assertGuard"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_createAssertGuard_ObjectSequenceProtobuf = _test_assertGuard( + TypeGuardError, +)("ObjectSequenceProtobuf")(ObjectSequenceProtobuf)( + typia.createAssertGuard(), +); diff --git a/test/src/features/createAssertGuardCustom/test_createAssertGuardCustom_ObjectSequenceProtobuf.ts b/test/src/features/createAssertGuardCustom/test_createAssertGuardCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..5e9ecc7e09 --- /dev/null +++ b/test/src/features/createAssertGuardCustom/test_createAssertGuardCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,14 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_assertGuard } from "../../internal/_test_assertGuard"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_createAssertGuardCustom_ObjectSequenceProtobuf = + _test_assertGuard(CustomGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)( + typia.createAssertGuard( + (p) => new CustomGuardError(p), + ), + ); diff --git a/test/src/features/createIs/test_createIs_ObjectSequenceProtobuf.ts b/test/src/features/createIs/test_createIs_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..e40a2212c8 --- /dev/null +++ b/test/src/features/createIs/test_createIs_ObjectSequenceProtobuf.ts @@ -0,0 +1,10 @@ +import typia from "typia"; + +import { _test_is } from "../../internal/_test_is"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_createIs_ObjectSequenceProtobuf = _test_is( + "ObjectSequenceProtobuf", +)(ObjectSequenceProtobuf)( + typia.createIs(), +); diff --git a/test/src/features/createRandom/test_createRandom_ObjectSequenceProtobuf.ts b/test/src/features/createRandom/test_createRandom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..e53e5a0bf2 --- /dev/null +++ b/test/src/features/createRandom/test_createRandom_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; + +import { _test_random } from "../../internal/_test_random"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_createRandom_ObjectSequenceProtobuf = _test_random( + "ObjectSequenceProtobuf", +)(ObjectSequenceProtobuf)({ + random: typia.createRandom( + (ObjectSequenceProtobuf as any).RANDOM, + ), + assert: typia.createAssert(), +}); diff --git a/test/src/features/createValidate/test_createValidate_ObjectSequenceProtobuf.ts b/test/src/features/createValidate/test_createValidate_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..5541f6be80 --- /dev/null +++ b/test/src/features/createValidate/test_createValidate_ObjectSequenceProtobuf.ts @@ -0,0 +1,10 @@ +import typia from "typia"; + +import { _test_validate } from "../../internal/_test_validate"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_createValidate_ObjectSequenceProtobuf = _test_validate( + "ObjectSequenceProtobuf", +)(ObjectSequenceProtobuf)( + typia.createValidate(), +); diff --git a/test/src/features/functional.assertFunction/test_functional_assertFunction_ObjectSequenceProtobuf.ts b/test/src/features/functional.assertFunction/test_functional_assertFunction_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..b13dfea2e6 --- /dev/null +++ b/test/src/features/functional.assertFunction/test_functional_assertFunction_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_functional_assertFunction } from "../../internal/_test_functional_assertFunction"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_assertFunction_ObjectSequenceProtobuf = + _test_functional_assertFunction(TypeGuardError)("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => ObjectSequenceProtobuf) => + typia.functional.assertFunction(p), + ); diff --git a/test/src/features/functional.assertFunctionAsync/test_functional_assertFunctionAsync_ObjectSequenceProtobuf.ts b/test/src/features/functional.assertFunctionAsync/test_functional_assertFunctionAsync_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..d75091cb2d --- /dev/null +++ b/test/src/features/functional.assertFunctionAsync/test_functional_assertFunctionAsync_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_functional_assertFunctionAsync } from "../../internal/_test_functional_assertFunctionAsync"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_assertFunctionAsync_ObjectSequenceProtobuf = + _test_functional_assertFunctionAsync(TypeGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)( + (p: (input: ObjectSequenceProtobuf) => Promise) => + typia.functional.assertFunction(p), + ); diff --git a/test/src/features/functional.assertFunctionAsyncCustom/test_functional_assertFunctionAsyncCustom_ObjectSequenceProtobuf.ts b/test/src/features/functional.assertFunctionAsyncCustom/test_functional_assertFunctionAsyncCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..6d3de70849 --- /dev/null +++ b/test/src/features/functional.assertFunctionAsyncCustom/test_functional_assertFunctionAsyncCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_functional_assertFunctionAsync } from "../../internal/_test_functional_assertFunctionAsync"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_assertFunctionAsyncCustom_ObjectSequenceProtobuf = + _test_functional_assertFunctionAsync(CustomGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)( + (p: (input: ObjectSequenceProtobuf) => Promise) => + typia.functional.assertFunction(p, (p) => new CustomGuardError(p)), + ); diff --git a/test/src/features/functional.assertFunctionCustom/test_functional_assertFunctionCustom_ObjectSequenceProtobuf.ts b/test/src/features/functional.assertFunctionCustom/test_functional_assertFunctionCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..c2f2e0e4ec --- /dev/null +++ b/test/src/features/functional.assertFunctionCustom/test_functional_assertFunctionCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_functional_assertFunction } from "../../internal/_test_functional_assertFunction"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_assertFunctionCustom_ObjectSequenceProtobuf = + _test_functional_assertFunction(CustomGuardError)("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => ObjectSequenceProtobuf) => + typia.functional.assertFunction(p, (p) => new CustomGuardError(p)), + ); diff --git a/test/src/features/functional.assertParameters/test_functional_assertParameters_ObjectSequenceProtobuf.ts b/test/src/features/functional.assertParameters/test_functional_assertParameters_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..b16c51be7d --- /dev/null +++ b/test/src/features/functional.assertParameters/test_functional_assertParameters_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_functional_assertParameters } from "../../internal/_test_functional_assertParameters"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_assertParameters_ObjectSequenceProtobuf = + _test_functional_assertParameters(TypeGuardError)("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => ObjectSequenceProtobuf) => + typia.functional.assertParameters(p), + ); diff --git a/test/src/features/functional.assertParametersAsync/test_functional_assertParametersAsync_ObjectSequenceProtobuf.ts b/test/src/features/functional.assertParametersAsync/test_functional_assertParametersAsync_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..a11e7824a4 --- /dev/null +++ b/test/src/features/functional.assertParametersAsync/test_functional_assertParametersAsync_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_functional_assertParametersAsync } from "../../internal/_test_functional_assertParametersAsync"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_assertParametersAsync_ObjectSequenceProtobuf = + _test_functional_assertParametersAsync(TypeGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)( + (p: (input: ObjectSequenceProtobuf) => Promise) => + typia.functional.assertParameters(p), + ); diff --git a/test/src/features/functional.assertParametersAsyncCustom/test_functional_assertParametersAsyncCustom_ObjectSequenceProtobuf.ts b/test/src/features/functional.assertParametersAsyncCustom/test_functional_assertParametersAsyncCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..f81f70ba49 --- /dev/null +++ b/test/src/features/functional.assertParametersAsyncCustom/test_functional_assertParametersAsyncCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_functional_assertParametersAsync } from "../../internal/_test_functional_assertParametersAsync"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_assertParametersAsyncCustom_ObjectSequenceProtobuf = + _test_functional_assertParametersAsync(CustomGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)( + (p: (input: ObjectSequenceProtobuf) => Promise) => + typia.functional.assertParameters(p, (p) => new CustomGuardError(p)), + ); diff --git a/test/src/features/functional.assertParametersCustom/test_functional_assertParametersCustom_ObjectSequenceProtobuf.ts b/test/src/features/functional.assertParametersCustom/test_functional_assertParametersCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..e3e8e2981e --- /dev/null +++ b/test/src/features/functional.assertParametersCustom/test_functional_assertParametersCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_functional_assertParameters } from "../../internal/_test_functional_assertParameters"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_assertParametersCustom_ObjectSequenceProtobuf = + _test_functional_assertParameters(CustomGuardError)("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => ObjectSequenceProtobuf) => + typia.functional.assertParameters(p, (p) => new CustomGuardError(p)), + ); diff --git a/test/src/features/functional.assertReturn/test_functional_assertReturn_ObjectSequenceProtobuf.ts b/test/src/features/functional.assertReturn/test_functional_assertReturn_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..8579e99a13 --- /dev/null +++ b/test/src/features/functional.assertReturn/test_functional_assertReturn_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_functional_assertReturn } from "../../internal/_test_functional_assertReturn"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_assertReturn_ObjectSequenceProtobuf = + _test_functional_assertReturn(TypeGuardError)("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => ObjectSequenceProtobuf) => + typia.functional.assertReturn(p), + ); diff --git a/test/src/features/functional.assertReturnAsync/test_functional_assertReturnAsync_ObjectSequenceProtobuf.ts b/test/src/features/functional.assertReturnAsync/test_functional_assertReturnAsync_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..275a90bc0c --- /dev/null +++ b/test/src/features/functional.assertReturnAsync/test_functional_assertReturnAsync_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_functional_assertReturnAsync } from "../../internal/_test_functional_assertReturnAsync"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_assertReturnAsync_ObjectSequenceProtobuf = + _test_functional_assertReturnAsync(TypeGuardError)("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => Promise) => + typia.functional.assertReturn(p), + ); diff --git a/test/src/features/functional.assertReturnAsyncCustom/test_functional_assertReturnAsyncCustom_ObjectSequenceProtobuf.ts b/test/src/features/functional.assertReturnAsyncCustom/test_functional_assertReturnAsyncCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..3dae039ba3 --- /dev/null +++ b/test/src/features/functional.assertReturnAsyncCustom/test_functional_assertReturnAsyncCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_functional_assertReturnAsync } from "../../internal/_test_functional_assertReturnAsync"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_assertReturnAsyncCustom_ObjectSequenceProtobuf = + _test_functional_assertReturnAsync(CustomGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)( + (p: (input: ObjectSequenceProtobuf) => Promise) => + typia.functional.assertReturn(p, (p) => new CustomGuardError(p)), + ); diff --git a/test/src/features/functional.assertReturnCustom/test_functional_assertReturnCustom_ObjectSequenceProtobuf.ts b/test/src/features/functional.assertReturnCustom/test_functional_assertReturnCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..8e09769500 --- /dev/null +++ b/test/src/features/functional.assertReturnCustom/test_functional_assertReturnCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_functional_assertReturn } from "../../internal/_test_functional_assertReturn"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_assertReturnCustom_ObjectSequenceProtobuf = + _test_functional_assertReturn(CustomGuardError)("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => ObjectSequenceProtobuf) => + typia.functional.assertReturn(p, (p) => new CustomGuardError(p)), + ); diff --git a/test/src/features/functional.isFunction/test_functional_isFunction_ObjectSequenceProtobuf.ts b/test/src/features/functional.isFunction/test_functional_isFunction_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..3e37418aef --- /dev/null +++ b/test/src/features/functional.isFunction/test_functional_isFunction_ObjectSequenceProtobuf.ts @@ -0,0 +1,10 @@ +import typia from "typia"; + +import { _test_functional_isFunction } from "../../internal/_test_functional_isFunction"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_isFunction_ObjectSequenceProtobuf = + _test_functional_isFunction("ObjectSequenceProtobuf")(ObjectSequenceProtobuf)( + (p: (input: ObjectSequenceProtobuf) => ObjectSequenceProtobuf) => + typia.functional.isFunction(p), + ); diff --git a/test/src/features/functional.isFunctionAsync/test_functional_isFunctionAsync_ObjectSequenceProtobuf.ts b/test/src/features/functional.isFunctionAsync/test_functional_isFunctionAsync_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..076311b746 --- /dev/null +++ b/test/src/features/functional.isFunctionAsync/test_functional_isFunctionAsync_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; + +import { _test_functional_isFunctionAsync } from "../../internal/_test_functional_isFunctionAsync"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_isFunctionAsync_ObjectSequenceProtobuf = + _test_functional_isFunctionAsync("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => Promise) => + typia.functional.isFunction(p), + ); diff --git a/test/src/features/functional.isParameters/test_functional_isParameters_ObjectSequenceProtobuf.ts b/test/src/features/functional.isParameters/test_functional_isParameters_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..3935428e70 --- /dev/null +++ b/test/src/features/functional.isParameters/test_functional_isParameters_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; + +import { _test_functional_isParameters } from "../../internal/_test_functional_isParameters"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_isParameters_ObjectSequenceProtobuf = + _test_functional_isParameters("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => ObjectSequenceProtobuf) => + typia.functional.isParameters(p), + ); diff --git a/test/src/features/functional.isParametersAsync/test_functional_isParametersAsync_ObjectSequenceProtobuf.ts b/test/src/features/functional.isParametersAsync/test_functional_isParametersAsync_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..6716624e93 --- /dev/null +++ b/test/src/features/functional.isParametersAsync/test_functional_isParametersAsync_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; + +import { _test_functional_isParametersAsync } from "../../internal/_test_functional_isParametersAsync"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_isParametersAsync_ObjectSequenceProtobuf = + _test_functional_isParametersAsync("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => Promise) => + typia.functional.isParameters(p), + ); diff --git a/test/src/features/functional.isReturn/test_functional_isReturn_ObjectSequenceProtobuf.ts b/test/src/features/functional.isReturn/test_functional_isReturn_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..12743f0db2 --- /dev/null +++ b/test/src/features/functional.isReturn/test_functional_isReturn_ObjectSequenceProtobuf.ts @@ -0,0 +1,10 @@ +import typia from "typia"; + +import { _test_functional_isReturn } from "../../internal/_test_functional_isReturn"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_isReturn_ObjectSequenceProtobuf = + _test_functional_isReturn("ObjectSequenceProtobuf")(ObjectSequenceProtobuf)( + (p: (input: ObjectSequenceProtobuf) => ObjectSequenceProtobuf) => + typia.functional.isReturn(p), + ); diff --git a/test/src/features/functional.isReturnAsync/test_functional_isReturnAsync_ObjectSequenceProtobuf.ts b/test/src/features/functional.isReturnAsync/test_functional_isReturnAsync_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..9f109e594c --- /dev/null +++ b/test/src/features/functional.isReturnAsync/test_functional_isReturnAsync_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; + +import { _test_functional_isReturnAsync } from "../../internal/_test_functional_isReturnAsync"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_isReturnAsync_ObjectSequenceProtobuf = + _test_functional_isReturnAsync("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => Promise) => + typia.functional.isReturn(p), + ); diff --git a/test/src/features/functional.validateFunction/test_functional_validateFunction_ObjectSequenceProtobuf.ts b/test/src/features/functional.validateFunction/test_functional_validateFunction_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..0ee9dbf596 --- /dev/null +++ b/test/src/features/functional.validateFunction/test_functional_validateFunction_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; + +import { _test_functional_validateFunction } from "../../internal/_test_functional_validateFunction"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_validateFunction_ObjectSequenceProtobuf = + _test_functional_validateFunction("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => ObjectSequenceProtobuf) => + typia.functional.validateFunction(p), + ); diff --git a/test/src/features/functional.validateFunctionAsync/test_functional_validateFunctionAsync_ObjectSequenceProtobuf.ts b/test/src/features/functional.validateFunctionAsync/test_functional_validateFunctionAsync_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..a9b61e2908 --- /dev/null +++ b/test/src/features/functional.validateFunctionAsync/test_functional_validateFunctionAsync_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; + +import { _test_functional_validateFunctionAsync } from "../../internal/_test_functional_validateFunctionAsync"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_validateFunctionAsync_ObjectSequenceProtobuf = + _test_functional_validateFunctionAsync("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => Promise) => + typia.functional.validateFunction(p), + ); diff --git a/test/src/features/functional.validateParameters/test_functional_validateParameters_ObjectSequenceProtobuf.ts b/test/src/features/functional.validateParameters/test_functional_validateParameters_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..8162dc9c20 --- /dev/null +++ b/test/src/features/functional.validateParameters/test_functional_validateParameters_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; + +import { _test_functional_validateParameters } from "../../internal/_test_functional_validateParameters"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_validateParameters_ObjectSequenceProtobuf = + _test_functional_validateParameters("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => ObjectSequenceProtobuf) => + typia.functional.validateParameters(p), + ); diff --git a/test/src/features/functional.validateParametersAsync/test_functional_validateParametersAsync_ObjectSequenceProtobuf.ts b/test/src/features/functional.validateParametersAsync/test_functional_validateParametersAsync_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..e4eab77a15 --- /dev/null +++ b/test/src/features/functional.validateParametersAsync/test_functional_validateParametersAsync_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; + +import { _test_functional_validateParametersAsync } from "../../internal/_test_functional_validateParametersAsync"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_validateParametersAsync_ObjectSequenceProtobuf = + _test_functional_validateParametersAsync("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => Promise) => + typia.functional.validateParameters(p), + ); diff --git a/test/src/features/functional.validateReturn/test_functional_validateReturn_ObjectSequenceProtobuf.ts b/test/src/features/functional.validateReturn/test_functional_validateReturn_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..4d5e5c1667 --- /dev/null +++ b/test/src/features/functional.validateReturn/test_functional_validateReturn_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; + +import { _test_functional_validateReturn } from "../../internal/_test_functional_validateReturn"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_validateReturn_ObjectSequenceProtobuf = + _test_functional_validateReturn("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => ObjectSequenceProtobuf) => + typia.functional.validateReturn(p), + ); diff --git a/test/src/features/functional.validateReturnAsync/test_functional_validateReturnAsync_ObjectSequenceProtobuf.ts b/test/src/features/functional.validateReturnAsync/test_functional_validateReturnAsync_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..b7f16acfcb --- /dev/null +++ b/test/src/features/functional.validateReturnAsync/test_functional_validateReturnAsync_ObjectSequenceProtobuf.ts @@ -0,0 +1,11 @@ +import typia from "typia"; + +import { _test_functional_validateReturnAsync } from "../../internal/_test_functional_validateReturnAsync"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_functional_validateReturnAsync_ObjectSequenceProtobuf = + _test_functional_validateReturnAsync("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )((p: (input: ObjectSequenceProtobuf) => Promise) => + typia.functional.validateReturn(p), + ); diff --git a/test/src/features/is/test_is_ObjectSequenceProtobuf.ts b/test/src/features/is/test_is_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..9b1a5b1062 --- /dev/null +++ b/test/src/features/is/test_is_ObjectSequenceProtobuf.ts @@ -0,0 +1,10 @@ +import typia from "typia"; + +import { _test_is } from "../../internal/_test_is"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_is_ObjectSequenceProtobuf = _test_is( + "ObjectSequenceProtobuf", +)(ObjectSequenceProtobuf)((input) => + typia.is(input), +); diff --git a/test/src/features/notation.camel/test_notation_camel_ObjectSequenceProtobuf.ts b/test/src/features/notation.camel/test_notation_camel_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..7910bac8d1 --- /dev/null +++ b/test/src/features/notation.camel/test_notation_camel_ObjectSequenceProtobuf.ts @@ -0,0 +1,15 @@ +import typia from "typia"; + +import { _test_notation_validateGeneral } from "../../internal/_test_notation_validateGeneral"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_notation_validateCamel_ObjectSequenceProtobuf = + _test_notation_validateGeneral( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)< + typia.CamelCase + >({ + convert: (input) => + typia.notations.validateCamel(input), + assert: typia.createAssert>(), + }); diff --git a/test/src/features/notation.createCamel/test_notation_createCamel_ObjectSequenceProtobuf.ts b/test/src/features/notation.createCamel/test_notation_createCamel_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..3af3db9188 --- /dev/null +++ b/test/src/features/notation.createCamel/test_notation_createCamel_ObjectSequenceProtobuf.ts @@ -0,0 +1,14 @@ +import typia from "typia"; + +import { _test_notation_validateGeneral } from "../../internal/_test_notation_validateGeneral"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_notation_createValidateCamel_ObjectSequenceProtobuf = + _test_notation_validateGeneral( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)< + typia.CamelCase + >({ + convert: typia.notations.createValidateCamel(), + assert: typia.createAssert>(), + }); diff --git a/test/src/features/notation.createPascal/test_notation_createPascal_ObjectSequenceProtobuf.ts b/test/src/features/notation.createPascal/test_notation_createPascal_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..11b76e4ab0 --- /dev/null +++ b/test/src/features/notation.createPascal/test_notation_createPascal_ObjectSequenceProtobuf.ts @@ -0,0 +1,14 @@ +import typia from "typia"; + +import { _test_notation_validateGeneral } from "../../internal/_test_notation_validateGeneral"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_notation_createValidatePascal_ObjectSequenceProtobuf = + _test_notation_validateGeneral( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)< + typia.PascalCase + >({ + convert: typia.notations.createValidatePascal(), + assert: typia.createAssert>(), + }); diff --git a/test/src/features/notation.createSnake/test_notation_createSnake_ObjectSequenceProtobuf.ts b/test/src/features/notation.createSnake/test_notation_createSnake_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..f0728206da --- /dev/null +++ b/test/src/features/notation.createSnake/test_notation_createSnake_ObjectSequenceProtobuf.ts @@ -0,0 +1,14 @@ +import typia from "typia"; + +import { _test_notation_validateGeneral } from "../../internal/_test_notation_validateGeneral"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_notation_createValidateSnake_ObjectSequenceProtobuf = + _test_notation_validateGeneral( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)< + typia.SnakeCase + >({ + convert: typia.notations.createValidateSnake(), + assert: typia.createAssert>(), + }); diff --git a/test/src/features/notation.pascal/test_notation_pascal_ObjectSequenceProtobuf.ts b/test/src/features/notation.pascal/test_notation_pascal_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..499c89e9fd --- /dev/null +++ b/test/src/features/notation.pascal/test_notation_pascal_ObjectSequenceProtobuf.ts @@ -0,0 +1,15 @@ +import typia from "typia"; + +import { _test_notation_validateGeneral } from "../../internal/_test_notation_validateGeneral"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_notation_validatePascal_ObjectSequenceProtobuf = + _test_notation_validateGeneral( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)< + typia.PascalCase + >({ + convert: (input) => + typia.notations.validatePascal(input), + assert: typia.createAssert>(), + }); diff --git a/test/src/features/notation.snake/test_notation_snake_ObjectSequenceProtobuf.ts b/test/src/features/notation.snake/test_notation_snake_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..f7640a66c4 --- /dev/null +++ b/test/src/features/notation.snake/test_notation_snake_ObjectSequenceProtobuf.ts @@ -0,0 +1,15 @@ +import typia from "typia"; + +import { _test_notation_validateGeneral } from "../../internal/_test_notation_validateGeneral"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_notation_validateSnake_ObjectSequenceProtobuf = + _test_notation_validateGeneral( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)< + typia.SnakeCase + >({ + convert: (input) => + typia.notations.validateSnake(input), + assert: typia.createAssert>(), + }); diff --git a/test/src/features/protobuf.assertDecode/test_protobuf_assertDecode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.assertDecode/test_protobuf_assertDecode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..6b92bf2a8e --- /dev/null +++ b/test/src/features/protobuf.assertDecode/test_protobuf_assertDecode_ObjectSequenceProtobuf.ts @@ -0,0 +1,14 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_protobuf_assertDecode } from "../../internal/_test_protobuf_assertDecode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_assertDecode_ObjectSequenceProtobuf = + _test_protobuf_assertDecode(TypeGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)({ + decode: (input) => + typia.protobuf.assertDecode(input), + encode: typia.protobuf.createEncode(), + }); diff --git a/test/src/features/protobuf.assertDecodeCustom/test_protobuf_assertDecodeCustom_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.assertDecodeCustom/test_protobuf_assertDecodeCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..e9373264bf --- /dev/null +++ b/test/src/features/protobuf.assertDecodeCustom/test_protobuf_assertDecodeCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,17 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_protobuf_assertDecode } from "../../internal/_test_protobuf_assertDecode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_assertDecodeCustom_ObjectSequenceProtobuf = + _test_protobuf_assertDecode(CustomGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)({ + decode: (input) => + typia.protobuf.assertDecode( + input, + (p) => new CustomGuardError(p), + ), + encode: typia.protobuf.createEncode(), + }); diff --git a/test/src/features/protobuf.assertEncode/test_protobuf_assertEncode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.assertEncode/test_protobuf_assertEncode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..895bf06802 --- /dev/null +++ b/test/src/features/protobuf.assertEncode/test_protobuf_assertEncode_ObjectSequenceProtobuf.ts @@ -0,0 +1,15 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_protobuf_assertEncode } from "../../internal/_test_protobuf_assertEncode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_assertEncode_ObjectSequenceProtobuf = + _test_protobuf_assertEncode(TypeGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)({ + encode: (input) => + typia.protobuf.assertEncode(input), + decode: typia.protobuf.createDecode(), + message: typia.protobuf.message(), + }); diff --git a/test/src/features/protobuf.assertEncodeCustom/test_protobuf_assertEncodeCustom_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.assertEncodeCustom/test_protobuf_assertEncodeCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..1fdcb9ba72 --- /dev/null +++ b/test/src/features/protobuf.assertEncodeCustom/test_protobuf_assertEncodeCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,18 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_protobuf_assertEncode } from "../../internal/_test_protobuf_assertEncode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_assertEncodeCustom_ObjectSequenceProtobuf = + _test_protobuf_assertEncode(CustomGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)({ + encode: (input) => + typia.protobuf.assertEncode( + input, + (p) => new CustomGuardError(p), + ), + decode: typia.protobuf.createDecode(), + message: typia.protobuf.message(), + }); diff --git a/test/src/features/protobuf.createAssertDecode/test_protobuf_createAssertDecode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.createAssertDecode/test_protobuf_createAssertDecode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..c13f61a386 --- /dev/null +++ b/test/src/features/protobuf.createAssertDecode/test_protobuf_createAssertDecode_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_protobuf_assertDecode } from "../../internal/_test_protobuf_assertDecode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_createAssertDecode_ObjectSequenceProtobuf = + _test_protobuf_assertDecode(TypeGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)({ + decode: typia.protobuf.createAssertDecode(), + encode: typia.protobuf.createEncode(), + }); diff --git a/test/src/features/protobuf.createAssertDecodeCustom/test_protobuf_createAssertDecodeCustom_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.createAssertDecodeCustom/test_protobuf_createAssertDecodeCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..d3a3ac3018 --- /dev/null +++ b/test/src/features/protobuf.createAssertDecodeCustom/test_protobuf_createAssertDecodeCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,15 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_protobuf_assertDecode } from "../../internal/_test_protobuf_assertDecode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_createAssertDecodeCustom_ObjectSequenceProtobuf = + _test_protobuf_assertDecode(CustomGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)({ + decode: typia.protobuf.createAssertDecode( + (p) => new CustomGuardError(p), + ), + encode: typia.protobuf.createEncode(), + }); diff --git a/test/src/features/protobuf.createAssertEncode/test_protobuf_createAssertEncode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.createAssertEncode/test_protobuf_createAssertEncode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..f3263822de --- /dev/null +++ b/test/src/features/protobuf.createAssertEncode/test_protobuf_createAssertEncode_ObjectSequenceProtobuf.ts @@ -0,0 +1,14 @@ +import typia from "typia"; +import { TypeGuardError } from "typia"; + +import { _test_protobuf_assertEncode } from "../../internal/_test_protobuf_assertEncode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_createAssertEncode_ObjectSequenceProtobuf = + _test_protobuf_assertEncode(TypeGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)({ + encode: typia.protobuf.createAssertEncode(), + decode: typia.protobuf.createDecode(), + message: typia.protobuf.message(), + }); diff --git a/test/src/features/protobuf.createAssertEncodeCustom/test_protobuf_createAssertEncodeCustom_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.createAssertEncodeCustom/test_protobuf_createAssertEncodeCustom_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..67f73fe9a1 --- /dev/null +++ b/test/src/features/protobuf.createAssertEncodeCustom/test_protobuf_createAssertEncodeCustom_ObjectSequenceProtobuf.ts @@ -0,0 +1,16 @@ +import typia from "typia"; + +import { CustomGuardError } from "../../internal/CustomGuardError"; +import { _test_protobuf_assertEncode } from "../../internal/_test_protobuf_assertEncode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_createAssertEncodeCustom_ObjectSequenceProtobuf = + _test_protobuf_assertEncode(CustomGuardError)( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)({ + encode: typia.protobuf.createAssertEncode( + (p) => new CustomGuardError(p), + ), + decode: typia.protobuf.createDecode(), + message: typia.protobuf.message(), + }); diff --git a/test/src/features/protobuf.createDecode/test_protobuf_createDecode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.createDecode/test_protobuf_createDecode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..16f9201732 --- /dev/null +++ b/test/src/features/protobuf.createDecode/test_protobuf_createDecode_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; + +import { _test_protobuf_decode } from "../../internal/_test_protobuf_decode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_createDecode_ObjectSequenceProtobuf = + _test_protobuf_decode("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )({ + decode: typia.protobuf.createDecode(), + encode: typia.protobuf.createEncode(), + }); diff --git a/test/src/features/protobuf.createEncode/test_protobuf_createEncode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.createEncode/test_protobuf_createEncode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..ad23001806 --- /dev/null +++ b/test/src/features/protobuf.createEncode/test_protobuf_createEncode_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; + +import { _test_protobuf_encode } from "../../internal/_test_protobuf_encode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_createEncode_ObjectSequenceProtobuf = + _test_protobuf_encode("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )({ + encode: typia.protobuf.createEncode(), + decode: typia.protobuf.createDecode(), + message: typia.protobuf.message(), + }); diff --git a/test/src/features/protobuf.createIsDecode/test_protobuf_createIsDecode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.createIsDecode/test_protobuf_createIsDecode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..ce63ab688a --- /dev/null +++ b/test/src/features/protobuf.createIsDecode/test_protobuf_createIsDecode_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; + +import { _test_protobuf_isDecode } from "../../internal/_test_protobuf_isDecode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_createIsDecode_ObjectSequenceProtobuf = + _test_protobuf_isDecode("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )({ + decode: typia.protobuf.createIsDecode(), + encode: typia.protobuf.createEncode(), + }); diff --git a/test/src/features/protobuf.createIsEncode/test_protobuf_createIsEncode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.createIsEncode/test_protobuf_createIsEncode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..02731d6528 --- /dev/null +++ b/test/src/features/protobuf.createIsEncode/test_protobuf_createIsEncode_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; + +import { _test_protobuf_isEncode } from "../../internal/_test_protobuf_isEncode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_createIsEncode_ObjectSequenceProtobuf = + _test_protobuf_isEncode("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )({ + encode: typia.protobuf.createIsEncode(), + decode: typia.protobuf.createDecode(), + message: typia.protobuf.message(), + }); diff --git a/test/src/features/protobuf.createValidateDecode/test_protobuf_createValidateDecode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.createValidateDecode/test_protobuf_createValidateDecode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..f08281fbcc --- /dev/null +++ b/test/src/features/protobuf.createValidateDecode/test_protobuf_createValidateDecode_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; + +import { _test_protobuf_validateDecode } from "../../internal/_test_protobuf_validateDecode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_createValidateDecode_ObjectSequenceProtobuf = + _test_protobuf_validateDecode( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)({ + decode: typia.protobuf.createValidateDecode(), + encode: typia.protobuf.createEncode(), + }); diff --git a/test/src/features/protobuf.createValidateEncode/test_protobuf_createValidateEncode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.createValidateEncode/test_protobuf_createValidateEncode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..625670ffae --- /dev/null +++ b/test/src/features/protobuf.createValidateEncode/test_protobuf_createValidateEncode_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; + +import { _test_protobuf_validateEncode } from "../../internal/_test_protobuf_validateEncode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_createValidateEncode_ObjectSequenceProtobuf = + _test_protobuf_validateEncode( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)({ + encode: typia.protobuf.createValidateEncode(), + decode: typia.protobuf.createDecode(), + message: typia.protobuf.message(), + }); diff --git a/test/src/features/protobuf.decode/test_protobuf_decode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.decode/test_protobuf_decode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..c5694bffc3 --- /dev/null +++ b/test/src/features/protobuf.decode/test_protobuf_decode_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; + +import { _test_protobuf_decode } from "../../internal/_test_protobuf_decode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_decode_ObjectSequenceProtobuf = + _test_protobuf_decode("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )({ + decode: (input) => typia.protobuf.decode(input), + encode: typia.protobuf.createEncode(), + }); diff --git a/test/src/features/protobuf.encode/test_protobuf_encode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.encode/test_protobuf_encode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..96eea5de9e --- /dev/null +++ b/test/src/features/protobuf.encode/test_protobuf_encode_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; + +import { _test_protobuf_encode } from "../../internal/_test_protobuf_encode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_encode_ObjectSequenceProtobuf = + _test_protobuf_encode("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )({ + encode: (input) => typia.protobuf.encode(input), + decode: typia.protobuf.createDecode(), + message: typia.protobuf.message(), + }); diff --git a/test/src/features/protobuf.isDecode/test_protobuf_isDecode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.isDecode/test_protobuf_isDecode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..833d002481 --- /dev/null +++ b/test/src/features/protobuf.isDecode/test_protobuf_isDecode_ObjectSequenceProtobuf.ts @@ -0,0 +1,12 @@ +import typia from "typia"; + +import { _test_protobuf_isDecode } from "../../internal/_test_protobuf_isDecode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_isDecode_ObjectSequenceProtobuf = + _test_protobuf_isDecode("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )({ + decode: (input) => typia.protobuf.isDecode(input), + encode: typia.protobuf.createEncode(), + }); diff --git a/test/src/features/protobuf.isEncode/test_protobuf_isEncode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.isEncode/test_protobuf_isEncode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..09244a547f --- /dev/null +++ b/test/src/features/protobuf.isEncode/test_protobuf_isEncode_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; + +import { _test_protobuf_isEncode } from "../../internal/_test_protobuf_isEncode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_isEncode_ObjectSequenceProtobuf = + _test_protobuf_isEncode("ObjectSequenceProtobuf")( + ObjectSequenceProtobuf, + )({ + encode: (input) => typia.protobuf.isEncode(input), + decode: typia.protobuf.createDecode(), + message: typia.protobuf.message(), + }); diff --git a/test/src/features/protobuf.message/test_protobuf_message_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.message/test_protobuf_message_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..a7dc620cf2 --- /dev/null +++ b/test/src/features/protobuf.message/test_protobuf_message_ObjectSequenceProtobuf.ts @@ -0,0 +1,9 @@ +import typia from "typia"; + +import { _test_protobuf_message } from "../../internal/_test_protobuf_message"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_message_ObjectSequenceProtobuf = + _test_protobuf_message("ObjectSequenceProtobuf")( + typia.protobuf.message(), + ); diff --git a/test/src/features/protobuf.validateDecode/test_protobuf_validateDecode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.validateDecode/test_protobuf_validateDecode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..d57809afa4 --- /dev/null +++ b/test/src/features/protobuf.validateDecode/test_protobuf_validateDecode_ObjectSequenceProtobuf.ts @@ -0,0 +1,13 @@ +import typia from "typia"; + +import { _test_protobuf_validateDecode } from "../../internal/_test_protobuf_validateDecode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_validateDecode_ObjectSequenceProtobuf = + _test_protobuf_validateDecode( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)({ + decode: (input) => + typia.protobuf.validateDecode(input), + encode: typia.protobuf.createEncode(), + }); diff --git a/test/src/features/protobuf.validateEncode/test_protobuf_validateEncode_ObjectSequenceProtobuf.ts b/test/src/features/protobuf.validateEncode/test_protobuf_validateEncode_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..f158739e6b --- /dev/null +++ b/test/src/features/protobuf.validateEncode/test_protobuf_validateEncode_ObjectSequenceProtobuf.ts @@ -0,0 +1,14 @@ +import typia from "typia"; + +import { _test_protobuf_validateEncode } from "../../internal/_test_protobuf_validateEncode"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_protobuf_validateEncode_ObjectSequenceProtobuf = + _test_protobuf_validateEncode( + "ObjectSequenceProtobuf", + )(ObjectSequenceProtobuf)({ + encode: (input) => + typia.protobuf.validateEncode(input), + decode: typia.protobuf.createDecode(), + message: typia.protobuf.message(), + }); diff --git a/test/src/features/random/test_random_ObjectSequenceProtobuf.ts b/test/src/features/random/test_random_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..1988ccae0b --- /dev/null +++ b/test/src/features/random/test_random_ObjectSequenceProtobuf.ts @@ -0,0 +1,14 @@ +import typia from "typia"; + +import { _test_random } from "../../internal/_test_random"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_random_ObjectSequenceProtobuf = _test_random( + "ObjectSequenceProtobuf", +)(ObjectSequenceProtobuf)({ + random: () => + typia.random( + (ObjectSequenceProtobuf as any).RANDOM, + ), + assert: typia.createAssert(), +}); diff --git a/test/src/features/reflect.metadata/test_reflect_metadata_ObjectSequenceProtobuf.ts b/test/src/features/reflect.metadata/test_reflect_metadata_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..d6f825e7f4 --- /dev/null +++ b/test/src/features/reflect.metadata/test_reflect_metadata_ObjectSequenceProtobuf.ts @@ -0,0 +1,9 @@ +import typia from "typia"; + +import { _test_reflect_metadata } from "../../internal/_test_reflect_metadata"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_reflect_metadata_ObjectSequenceProtobuf = + _test_reflect_metadata("ObjectSequenceProtobuf")( + typia.reflect.metadata<[ObjectSequenceProtobuf]>(), + ); diff --git a/test/src/features/validate/test_validate_ObjectSequenceProtobuf.ts b/test/src/features/validate/test_validate_ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..bc65f82d4d --- /dev/null +++ b/test/src/features/validate/test_validate_ObjectSequenceProtobuf.ts @@ -0,0 +1,10 @@ +import typia from "typia"; + +import { _test_validate } from "../../internal/_test_validate"; +import { ObjectSequenceProtobuf } from "../../structures/ObjectSequenceProtobuf"; + +export const test_validate_ObjectSequenceProtobuf = _test_validate( + "ObjectSequenceProtobuf", +)(ObjectSequenceProtobuf)((input) => + typia.validate(input), +); diff --git a/test/src/structures/ObjectSequenceProtobuf.ts b/test/src/structures/ObjectSequenceProtobuf.ts new file mode 100644 index 0000000000..7d145caeec --- /dev/null +++ b/test/src/structures/ObjectSequenceProtobuf.ts @@ -0,0 +1,82 @@ +import { IPointer, randint } from "tstl"; +import { tags } from "typia"; +import { v4 } from "uuid"; + +import { Spoiler } from "../helpers/Spoiler"; +import { TestRandomGenerator } from "../helpers/TestRandomGenerator"; + +export type ObjectSequenceProtobuf = IPointer; +export namespace ObjectSequenceProtobuf { + export interface IMember { + id: + | (string & tags.Sequence<11>) + | (number & tags.Type<"uint64"> & tags.Sequence<12>) + | (Uint8Array & tags.Sequence<13>); + name: (string & tags.Sequence<20>) | null; + children: Array & tags.Sequence<30>; + keywords: Map & tags.Sequence<40>; + thumbnail: + | (string & tags.Format<"uri"> & tags.ContentMediaType<"image/*">) + | Uint8Array; + email: string & tags.Format<"email">; + hobbies: Array; + } + export interface IHobby { + id: string & tags.Format<"uuid">; + name: string; + valid: boolean; + } + + export const ADDABLE = false; + export const JSONABLE = false; + export const PRIMITIVE = false; + + export function generate(level: number = 0): ObjectSequenceProtobuf { + const members: IMember[] = []; + for (const id of [v4(), randint(0, 1_000_000), new Uint8Array()]) + for (const thumbnail of ["https://typia.io/logo.png", new Uint8Array()]) + members.push({ + id, + name: TestRandomGenerator.string(10), + children: level < 2 ? generate(level + 1).value : [], + keywords: new Map( + new Array(randint(1, 4)) + .fill(null) + .map(() => [ + TestRandomGenerator.string(10), + TestRandomGenerator.string(10), + ]), + ), + thumbnail, + email: TestRandomGenerator.email(), + hobbies: new Array(randint(1, 4)).fill(null).map(() => ({ + id: v4(), + name: TestRandomGenerator.string(10), + valid: TestRandomGenerator.boolean(), + })), + }); + return { + value: members, + }; + } + + export const SPOILERS: Spoiler[] = [ + (input) => { + input.value[0]!.id = 3.141592; + return ["$input.value[0].id"]; + }, + (input) => { + input.value[1]!.name = undefined!; + return ["$input.value[1].name"]; + }, + (input) => { + input.value[2]!.children[3]!.thumbnail = "thumbnail URL"; + return ["$input.value[2].children[3].thumbnail"]; + }, + (input) => { + const map = input.value[0]!.keywords; + map.set("key", 3 as any); + return [`$input.value[0].keywords[${map.size - 1}][1]`]; + }, + ]; +} diff --git a/tsconfig.errors.json b/tsconfig.errors.json new file mode 100644 index 0000000000..836307ebac --- /dev/null +++ b/tsconfig.errors.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./errors/node_modules/typia/lib", + }, +} \ No newline at end of file From aa6655550ab3fc11c19acdbf32e11bdb6b7c0cd4 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Sun, 20 Oct 2024 00:54:02 +0900 Subject: [PATCH 3/3] Fix `RandomJoiner.array()` when non-variable key name comes. --- benchmark/package.json | 2 +- errors/package.json | 2 +- package.json | 2 +- packages/typescript-json/package.json | 5 +++-- src/programmers/helpers/RandomJoiner.ts | 2 +- test-esm/package.json | 2 +- test/package.json | 2 +- test/src/debug/random.ts | 8 ++------ 8 files changed, 11 insertions(+), 14 deletions(-) diff --git a/benchmark/package.json b/benchmark/package.json index b0cbf61591..4d7ec3edb9 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -72,6 +72,6 @@ "suppress-warnings": "^1.0.2", "tstl": "^3.0.0", "uuid": "^9.0.1", - "typia": "../typia-7.0.0-dev.20241019-2.tgz" + "typia": "../typia-7.0.0-dev.20241020.tgz" } } \ No newline at end of file diff --git a/errors/package.json b/errors/package.json index 957f451c12..e11097158c 100644 --- a/errors/package.json +++ b/errors/package.json @@ -32,6 +32,6 @@ "typescript": "^5.3.2" }, "dependencies": { - "typia": "../typia-7.0.0-dev.20241019-2.tgz" + "typia": "../typia-7.0.0-dev.20241020.tgz" } } \ No newline at end of file diff --git a/package.json b/package.json index 823304eb63..53b399b762 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typia", - "version": "7.0.0-dev.20241019-2", + "version": "7.0.0-dev.20241020", "description": "Superfast runtime validators with only one line", "main": "lib/index.js", "typings": "lib/index.d.ts", diff --git a/packages/typescript-json/package.json b/packages/typescript-json/package.json index abb0d5288b..88eb2b92b2 100644 --- a/packages/typescript-json/package.json +++ b/packages/typescript-json/package.json @@ -1,6 +1,6 @@ { "name": "typescript-json", - "version": "7.0.0-dev.20241019-2", + "version": "7.0.0-dev.20241020", "description": "Superfast runtime validators with only one line", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -16,6 +16,7 @@ "-------------------------------------------------": "", "build": "rimraf lib && tsc && rollup -c", "dev": "tsc --project tsconfig.test.json --watch", + "dev:errors": "tsc --project tsconfig.errors.json --watch", "eslint": "eslint ./**/*.ts", "eslint:fix": "eslint ./**/*.ts --fix", "prettier": "prettier src --write", @@ -63,7 +64,7 @@ }, "homepage": "https://typia.io", "dependencies": { - "typia": "7.0.0-dev.20241019-2" + "typia": "7.0.0-dev.20241020" }, "peerDependencies": { "typescript": ">=4.8.0 <5.7.0" diff --git a/src/programmers/helpers/RandomJoiner.ts b/src/programmers/helpers/RandomJoiner.ts index 2f3fc0ba5e..e0eb35e055 100644 --- a/src/programmers/helpers/RandomJoiner.ts +++ b/src/programmers/helpers/RandomJoiner.ts @@ -36,7 +36,7 @@ export namespace RandomJoiner { .filter(([key]) => key !== "items") .map(([key, value]) => ts.factory.createPropertyAssignment( - key, + IdentifierFactory.identifier(key), LiteralFactory.write(value), ), ) diff --git a/test-esm/package.json b/test-esm/package.json index 7691788615..04f48ee042 100644 --- a/test-esm/package.json +++ b/test-esm/package.json @@ -36,6 +36,6 @@ "typescript": "^5.4.5" }, "dependencies": { - "typia": "../typia-7.0.0-dev.20241019-2.tgz" + "typia": "../typia-7.0.0-dev.20241020.tgz" } } \ No newline at end of file diff --git a/test/package.json b/test/package.json index 9fb2ddace4..fff700d63d 100644 --- a/test/package.json +++ b/test/package.json @@ -53,6 +53,6 @@ "suppress-warnings": "^1.0.2", "tstl": "^3.0.0", "uuid": "^9.0.1", - "typia": "../typia-7.0.0-dev.20241019-2.tgz" + "typia": "../typia-7.0.0-dev.20241020.tgz" } } \ No newline at end of file diff --git a/test/src/debug/random.ts b/test/src/debug/random.ts index 54e373d91b..09a4606191 100644 --- a/test/src/debug/random.ts +++ b/test/src/debug/random.ts @@ -1,9 +1,5 @@ import typia from "typia"; -import { NativeSimple } from "../structures/NativeSimple"; +import { ObjectSequenceProtobuf } from "../structures/ObjectSequenceProtobuf"; -const results: boolean[] = new Array(100).fill(0).map(() => { - const simple = typia.random(); - return typia.is(simple); -}); -console.log(results.filter((r) => r).length); +typia.createRandom();