typedefs / tdlc

compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON Schema Extraction

wires opened this issue · comments

From @wires on February 3, 2017 13:29

related to #16

Typedef Purescript Type JSON Value JSON Schema
Product A * B Tuple A B [_, _] { "type": "array , items: [ A, B ]}
Labeled Product a:A * b:B {a::A, b::B} {a:_, b:_} { "type": "object", properties: { a:A, b:B}}
Sum A + B Either A B [k,_] {oneOf: [?,?]}
Labeled Sum a:A + b:B ADT Constructor {a:_} or {b:_} {oneOf: [ {"type": "object",properties: { a:A }}, {"type": "object",properties: { b:B }} ]}
Primitive text String "..." {"type":"string"}
  • extraction to JSON schema
  • ser/deser JSON according to this schema

Copied from original issue: TinkerTravel/tdl#23