When rest typed tuple like [string, number, ...boolean]
comes, there's no way to express it through JSON schema. Also, when using swagger
mode, even expressing tuple type is not possible. Furthermore, the swagger
mode can't express IJsonComponents.patternProperties
, either.
However, as I am preparing a new library reactia
which can automatically generate frontend application just by analyzing NestJS developed backend server code, through swagger.json
file generated by nestia
SDK generator, I have to find detour way to express those unsupported types.
Therefore, enhance IJsonSchema
and IJsonComponent
types to be possible to express unsupported types in the oridnary JSON schema, through plug-in properties. The new properties would be IJsonSchema.IAttribute.x-typia-rest
, IJsonSchema.IArray.x-typia-tuple
, IJsonComponents.x-typia-patternProperties
and IJsonComponents.x-typia-additionalProperties
.
export namespace IJsonSchema {
export interface IArray extends ISignificant<"array"> {
items: IJsonSchema;
minItems?: number;
maxItems?: number;
"x-typia-tuple"?: ITuple;
}
export interface ISignificant<Literal extends string> extends IAttribute {
type: Literal;
nullable: boolean;
}
export interface IAttribute {
deprecated?: boolean;
title?: string;
description?: string;
"x-typia-metaTags"?: IMetadataTag[];
"x-typia-jsDocTags"?: IJsDocTagInfo[];
"x-typia-required"?: boolean;
"x-typia-rest"?: boolean;
}
}
export namespace IJsonComponents {
export interface IObject {
$id?: string;
$recursiveAnchor?: boolean;
type: "object";
nullable: boolean;
properties: Record<string, IJsonSchema>;
patternProperties?: Record<string, IJsonSchema>;
additionalProperties?: IJsonSchema;
required?: string[];
description?: string;
"x-typia-jsDocTags"?: IJsDocTagInfo[];
"x-typia-patternProperties"?: Record<string, IJsonSchema>;
"x-typia-additionalProperties": IJsonSchema;
}
}
What's Changed
- Add 12th Gen Intel(R) Core(TM) i7-12700H results by @omizha in #463
- Close #464 - enhance JSON schema for unspported types by @samchon in #465
- Complement #464 - special JSON schema expression for rest tuple type by @samchon in #466
New Contributors
Full Changelog: v3.4.20...v3.4.22