From 1626ef38eb05f95798fd928fbc6ed19976cd0d34 Mon Sep 17 00:00:00 2001 From: Artemy Egorov Date: Sun, 28 Jul 2024 22:30:19 +0300 Subject: [PATCH] fix: daletl body spec and types --- libs/rust/Cargo.lock | 2 +- libs/rust/Cargo.toml | 2 +- libs/rust/src/types.rs | 8 ++++---- libs/typescript/package.json | 2 +- libs/typescript/src/daletl/types.ts | 2 +- specification/daletl.md | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libs/rust/Cargo.lock b/libs/rust/Cargo.lock index 0367a03..11dd28d 100644 --- a/libs/rust/Cargo.lock +++ b/libs/rust/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "dalet" -version = "1.0.0-pre1" +version = "1.0.0-pre2" dependencies = [ "serde", ] diff --git a/libs/rust/Cargo.toml b/libs/rust/Cargo.toml index c738659..e39698d 100644 --- a/libs/rust/Cargo.toml +++ b/libs/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dalet" -version = "1.0.0-pre1" +version = "1.0.0-pre2" edition = "2021" authors = ["artegoser"] license = "MIT" diff --git a/libs/rust/src/types.rs b/libs/rust/src/types.rs index 198b61f..f95bc86 100644 --- a/libs/rust/src/types.rs +++ b/libs/rust/src/types.rs @@ -16,7 +16,7 @@ impl Tag { #[derive(Debug)] pub enum Body { Text(String), - Tag(Box), + Tags(Vec), Null, } @@ -27,8 +27,8 @@ impl Serialize for Body { { match *self { Body::Text(ref text) => serializer.serialize_str(text), - Body::Tag(ref tag) => tag.serialize(serializer), - Body::Null => serializer.serialize_str("null"), + Body::Tags(ref tag) => tag.serialize(serializer), + Body::Null => serializer.serialize_none(), } } } @@ -48,7 +48,7 @@ impl Serialize for Argument { match *self { Argument::Text(ref text) => serializer.serialize_str(text), Argument::Number(number) => serializer.serialize_i8(number), - Argument::Null => serializer.serialize_str("null"), + Argument::Null => serializer.serialize_none(), } } } diff --git a/libs/typescript/package.json b/libs/typescript/package.json index 5df2cb1..499acd2 100644 --- a/libs/typescript/package.json +++ b/libs/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@txtdot/dalet", - "version": "1.0.0-pre0", + "version": "1.0.0-pre1", "description": "Dalet implementation in typescript", "main": "dist/lib.js", "types": "dist/lib.d.ts", diff --git a/libs/typescript/src/daletl/types.ts b/libs/typescript/src/daletl/types.ts index f568570..2b5abd4 100644 --- a/libs/typescript/src/daletl/types.ts +++ b/libs/typescript/src/daletl/types.ts @@ -3,7 +3,7 @@ import { bodyToRaw } from "../utils"; export type Root = Tag[]; export type Argument = string | number | null; -export type Body = Tag[] | null; +export type Body = string | Tag[] | null; export interface Tag { id: number; diff --git a/specification/daletl.md b/specification/daletl.md index 220944b..49981d6 100644 --- a/specification/daletl.md +++ b/specification/daletl.md @@ -21,7 +21,7 @@ All tags specification is in [Tags](./tags.md). ```typescript interface Tag { id: number; - body: Tag[] | null; + body: string | Tag[] | null; argument: string | number | null; } ```