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

  • JSON Schema

    • data_object
      Schema to JSON
    • code
      JSON to Schema
    • verified
      Compliance

    • deployed_code
      Libraries

    • article
      Blog
Expand sidebarExpand sidebar
@remix-run/data-schema/SourceSource
github
GitHubGitHub
DiscordDiscord
PreferencesPreferences
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures
schemas/libraries/@remix-run/data-schema/download/index.ts
Copy to clipboardCopy to clipboard
schemas/libraries/@remix-run/data-schema/download/index.ts
Copy to clipboardCopy to clipboard
schemas/libraries/@remix-run/data-schema/download/index.ts
Copy to clipboardCopy to clipboard
import { array, enum_, instanceof_, nullable, number, object, parse, string, type Schema, } from "@remix-run/data-schema"; import { max, maxLength, min, minLength, url, } from "@remix-run/data-schema/checks"; import type { ProductData } from "#src"; const imageSchema = object({ id: number(), created: instanceof_(Date), title: string().pipe( minLength(1), maxLength(100), ), type: enum_(["jpg", "png"]), size: number(), url: string().pipe(url()), }); const ratingSchema = object({ id: number(), stars: number().pipe(min(1), max(5)), title: string().pipe( minLength(1), maxLength(100), ), text: string().pipe( minLength(1), maxLength(1000), ), images: array(imageSchema), }); const productSchema = object({ id: number(), created: instanceof_(Date), title: string().pipe( minLength(1), maxLength(100), ), brand: string().pipe( minLength(1), maxLength(30), ), description: string().pipe( minLength(1), maxLength(500), ), price: number().pipe( min(1), max(10000), ), discount: nullable( number().pipe(min(1), max(100)), ), quantity: number().pipe( min(0), max(10), ), tags: array( string().pipe( minLength(1), maxLength(30), ), ), images: array(imageSchema), ratings: array(ratingSchema), }) satisfies Schema< unknown, ProductData >; parse(productSchema, {});
import { array, enum_, instanceof_, nullable, number, object, parse, string, type Schema, } from "@remix-run/data-schema"; import { max, maxLength, min, minLength, url, } from "@remix-run/data-schema/checks"; import type { ProductData } from "#src"; const imageSchema = object({ id: number(), created: instanceof_(Date), title: string().pipe(minLength(1), maxLength(100)), type: enum_(["jpg", "png"]), size: number(), url: string().pipe(url()), }); const ratingSchema = object({ id: number(), stars: number().pipe(min(1), max(5)), title: string().pipe(minLength(1), maxLength(100)), text: string().pipe(minLength(1), maxLength(1000)), images: array(imageSchema), }); const productSchema = object({ id: number(), created: instanceof_(Date), title: string().pipe(minLength(1), maxLength(100)), brand: string().pipe(minLength(1), maxLength(30)), description: string().pipe(minLength(1), maxLength(500)), price: number().pipe(min(1), max(10000)), discount: nullable(number().pipe(min(1), max(100))), quantity: number().pipe(min(0), max(10)), tags: array(string().pipe(minLength(1), maxLength(30))), images: array(imageSchema), ratings: array(ratingSchema), }) satisfies Schema<unknown, ProductData>; parse(productSchema, {});
import { array, enum_, instanceof_, nullable, number, object, parse, string, type Schema, } from "@remix-run/data-schema"; import { max, maxLength, min, minLength, url } from "@remix-run/data-schema/checks"; import type { ProductData } from "#src"; const imageSchema = object({ id: number(), created: instanceof_(Date), title: string().pipe(minLength(1), maxLength(100)), type: enum_(["jpg", "png"]), size: number(), url: string().pipe(url()), }); const ratingSchema = object({ id: number(), stars: number().pipe(min(1), max(5)), title: string().pipe(minLength(1), maxLength(100)), text: string().pipe(minLength(1), maxLength(1000)), images: array(imageSchema), }); const productSchema = object({ id: number(), created: instanceof_(Date), title: string().pipe(minLength(1), maxLength(100)), brand: string().pipe(minLength(1), maxLength(30)), description: string().pipe(minLength(1), maxLength(500)), price: number().pipe(min(1), max(10000)), discount: nullable(number().pipe(min(1), max(100))), quantity: number().pipe(min(0), max(10)), tags: array(string().pipe(minLength(1), maxLength(30))), images: array(imageSchema), ratings: array(ratingSchema), }) satisfies Schema<unknown, ProductData>; parse(productSchema, {});