Skip to content

cjinhuo/thrift-to-json-schema

Repository files navigation

overview

parse Thrift to JSON schema with typescript

demo

Online Demo

install

pnpm add @trasm/thrift-jsma

usage

import { parseThriftToJsonSchema,parseThriftToTypeBox } from '@trasm/thrift-jsma'
  const structString = `
    struct EmptyStruct {
    string field_string
    double field_double
    i32 field_i32
    i64 field_i64
    bool field_bool
    optional string field_optional_string
    }
  `
  const jsonSchema = parseThriftToJsonSchema(structString)
  const jsonTypeBox = parseThriftToTypeBox(structString)

references