jxn

jxn

jxn (JSON eXplained Notation) is a schema language for JSON — readable definitions with meanings and relations, compiled to JSON Schema.

jxn(JSON eXplained Notation)은 JSON 의 형태와 뜻을 정의하는 언어(스키마 언어)다. 정의는 .jxn 으로 적고, 인스턴스는 평범한 JSON 으로 쓴다. 키 하나를 보면 무엇인가(뜻) · 무엇이 들어가나(타입 · 허용 값) · 누가 채우고 읽나 · 다른 키와 어떻게 이어지나(관계) 가 한 자리에 나온다.

jxn
{                                       // 주문 하나
    "id": string,                       // 주문 번호
    "items": [ Item ] min 1,            // 담은 상품
    "total": number,                    // 합계 금액
        derived-from items[*].price     // 담은 상품 값의 합
    "method": "card" | "cash"           // 결제 방법
}
sh
git clone https://github.com/AidanPark/jxn.git && cd jxn && npm install && npm run build
node dist/cli.js build order.jxn -o order.schema.json               # JSON Schema 2020-12
node dist/cli.js doc order.jxn --example order.json -o order.html   # 읽는 페이지 (html 한 파일)