Slide 1

Slide 1 text

Nozomu Ikuta 24th May 2025 Standard Schema: εΩʔϚϥΠϒϥϦͷ౷Ұن֨ͱ͸Կ͔

Slide 2

Slide 2 text

εΩʔϚϥΠϒϥϦ࢖ͬͯ·͔͢

Slide 3

Slide 3 text

• Zod • Valibot • ArkType • etc.

Slide 4

Slide 4 text

͍͟࢖͏ͱ՝୊΋͋Γ·͢

Slide 5

Slide 5 text

• ϩοΫΠϯ • ΞμϓλɺΞμϓλɺΞμϓλ… • etc.

Slide 6

Slide 6 text

newmo Ͱ͸࢖ͬͯͳ͍Ͱ͢

Slide 7

Slide 7 text

Tierͷߟ͑ํ Tier 1 : ͜ΕΛࣺͯΔ࣌͸ίʔυΛҰ͔Β ॻ͖௚֮͢ޛΛ࣋ͭʮ৺த͢Δʯ૬ख Tier 2 : ࠩ͠ସ͑ʹ͸େ͖ͳ࿑ྗΛඞཁͱ ͢Δʮڧ͘ґଘ͢Δʯ૬ख Tier 3 : ͍ͣΕࠩ͠ସ͑Δ͜ͱΛ૝ఆͨ͠ ʮґଘΛܰ͘͢Δʯ૬ख Communication Design 32 Modular Monolith Monorepo ~ γϯϓϧ͞Λอͪͳ͕ΒmonorepoͷϝϦοτΛ࠷େԽ͢Δ ~ JSConf 2024 ΑΓ

Slide 8

Slide 8 text

ఏڙػೳ͸΄΅ಉ͡

Slide 9

Slide 9 text

• ϥϯλΠϜόϦσʔγϣϯ • όϦσʔγϣϯͷResultܕ • όϦσʔγϣϯΤϥʔͷҰཡ • εΩʔϚͷܕਪ࿦

Slide 10

Slide 10 text

Standard Schema

Slide 11

Slide 11 text

• Zod, Valibot, ArkType ͷ࡞ऀʹΑͬ ͯઃܭ͞Εͨ • StandardSchemaV1 ͱ͍͏୯Ұͷ interface ͓Αͼ namespace ͱͯ͠ ఆٛ͞Ε͍ͯΔ

Slide 12

Slide 12 text

interface StandardSchemaV1 { readonly '~standard': StandardSchemaV1.Props; } export declare namespace StandardSchemaV1 { // ϓϩύςΟఆٛ
 } • APIίϯϑϦΫτճආͷͨΊ `~standard` ϓϩύςΟ഑Լʹ͢΂ͯఆٛ͢Δ

Slide 13

Slide 13 text

interface Props { readonly version: 1; readonly vendor: string; readonly validate: ( value: unknown ) => Result | Promise>; readonly types?: Types | unde fi ned; } • όϦσʔγϣϯؔ਺ • εΩʔϚͷܕਪ࿦

Slide 14

Slide 14 text

type Result = SuccessResult | FailureResult; interface SuccessResult { readonly value: Output; readonly issues?: unde fi ned; } interface FailureResult { readonly issues: ReadonlyArray; } • όϦσʔγϣϯͷResultܕ • Τϥʔ͸issuesͱ͍͏഑ྻͰදݱ͢Δ

Slide 15

Slide 15 text

interface Issue { readonly message: string; readonly path?: ReadonlyArray | unde fi ned; } interface PathSegment { readonly key: PropertyKey; } • όϦσʔγϣϯΤϥʔ • ͻͱͭͷΤϥʔ͸ϝοηʔδͱϓϩύςΟΩʔͰදݱ͢Δ

Slide 16

Slide 16 text

interface Types { readonly input: Input; readonly output: Output; } type InferInput = NonNullable< Schema['~standard']['types'] >['input']; type InferOutput = NonNullable< Schema['~standard']['types'] >['output']; • εΩʔϚͷܕਪ࿦

Slide 17

Slide 17 text

·ͱΊ

Slide 18

Slide 18 text

• Standard SchemaͰεΩʔϚϥΠϒϥϦͷ૬ޓӡ༻ੑ͕ߴ·Δ • ओཁͳεΩʔϚϥΠϒϥϦ͸͢ͰʹରԠࡁΈ • εΩʔϚϥΠϒϥϦͷࠩผԽ͕೉͘͠ͳΔ͔΋ʢʁʣ

Slide 19

Slide 19 text

ࢀߟจݙ • https://github.com/standard-schema • https://github.com/colinhacks/zod • https://github.com/fabian-hiller/valibot • https://github.com/arktypeio/arktype • https://speakerdeck.com/yuisakamoto/modular-monolith-monorepo- sinpurusawobao-tinagaramonoreponomeritutowozui-da-hua-suru

Slide 20

Slide 20 text

@nozomuikuta • ιϑτ΢ΣΞΤϯδχΞ • Vue.js-JP ڞಉΦʔΨφΠβʔ • UnJS ϝϯόʔ • Shibuya.go ओ࠵

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content