Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 862 Bytes

File metadata and controls

32 lines (22 loc) · 862 Bytes

@amar4enko/effect-schema-compiler

Attempt at ergonomic effect/Schema compiler

Installation

bun add @amar4enko/effect-schema-compiler
const compiler = Compiler.make<Result, Context>()
  .rule(hasReference, ({ referenceId, propertySignatures }, go, context) => {
    //...
  })
  .rule(isUnionWithUndefined, ({ type }, go, context) => {
    //...
  })


const result = yield* compiler.compile(MySchema.ast, initialContext)

Rationale

Working with effect/Schema AST is non-trivial to say the least.
I've put this library together after spending some time on writing code compiling schemas to Confluence docs, other language types etc.
It doesn't automagically weave the need to understand AST, yet provides some nice-to-haves when working with it.

Usage example with tests

example.test.ts