LogoLogo

Schema Benchmarks

    • home
      Home

    • download_2
      Download

    • timer
      Initialization
    • check_circle
      Validation
    • output_circle
      Parsing
    • swap_horiz
      Codec
    • schema
      Standard Schema
    • format_quote
      String

    • error
      Stack

    • article
      Blog
Code styleCode style
Normal styleNormal style
System themeSystem theme
Light themeLight theme
Dark themeDark theme
Expand sidebarExpand sidebar
@railway-ts/pipelines/SourceSource
Code styleCode style
Normal styleNormal style
System themeSystem theme
Light themeLight theme
Dark themeDark theme
github
GitHubGitHub
DiscordDiscord
schemas/libraries/@railway-ts/pipelines/download.ts
Copy to clipboardCopy to clipboard
import { object, required, chain, string, number, date, array, nullable, union, stringEnum, minLength, maxLength, min, max, url, validate, } from "@railway-ts/pipelines/schema"; const imageSchema = object({ id: required(number()), created: required(date()), title: required(chain(string(), minLength(1), maxLength(100))), type: required(stringEnum(["jpg", "png"] as const)), size: required(number()), url: required(chain(string(), url())), }); const ratingSchema = object({ id: required(number()), stars: required(chain(number(), min(0), max(5))), title: required(chain(string(), minLength(1), maxLength(100))), text: required(chain(string(), minLength(1), maxLength(1000))), images: required(array(imageSchema)), }); const productSchema = object({ id: required(number()), created: required(date()), title: required(chain(string(), minLength(1), maxLength(100))), brand: required(chain(string(), minLength(1), maxLength(30))), description: required(chain(string(), minLength(1), maxLength(500))), price: required(chain(number(), min(1), max(10000))), discount: union([chain(number(), min(1), max(100)), nullable()]), quantity: required(chain(number(), min(0), max(10))), tags: required(array(chain(string(), minLength(1), maxLength(30)))), images: required(array(imageSchema)), ratings: required(array(ratingSchema)), }); validate({}, productSchema);
Created by eskimojo for Open Circle