@tsed/schema
Version:
JsonSchema module for Ts.ED Framework
50 lines (49 loc) • 868 B
JavaScript
import { from } from "./from.js";
/**
* Declare a new object model with `additionalProperties: true`.
*
* ```json
* {
* "type": "array"
* }
* ```
*
* * See @@JsonSchema@@ to discover available methods.
*
* @schemaFunctional
*/
export function array() {
return from(Array);
}
/**
* Declare a new object model with `additionalProperties: true`.
*
* ```json
* {
* "type": "object",
* "additionalProperties": true
* }
* ```
*
* * See @@JsonSchema@@ to discover available methods.
*
* @schemaFunctional
*/
export function map() {
return from(Map).unknown(true);
}
/**
* Declare a new array model with `uniqueItems: true`.
*
* ```json
* {
* "type": "array",
* "uniqueItems": true
* }
* ```
*
* * See @@JsonSchema@@ to discover available methods.
*/
export function set() {
return from(Array).uniqueItems(true);
}