fix: daletl body spec and types

This commit is contained in:
Artemy Egorov 2024-07-28 22:30:19 +03:00
parent bac4c25681
commit 1626ef38eb
6 changed files with 9 additions and 9 deletions

2
libs/rust/Cargo.lock generated
View file

@ -4,7 +4,7 @@ version = 3
[[package]]
name = "dalet"
version = "1.0.0-pre1"
version = "1.0.0-pre2"
dependencies = [
"serde",
]

View file

@ -1,6 +1,6 @@
[package]
name = "dalet"
version = "1.0.0-pre1"
version = "1.0.0-pre2"
edition = "2021"
authors = ["artegoser"]
license = "MIT"

View file

@ -16,7 +16,7 @@ impl Tag {
#[derive(Debug)]
pub enum Body {
Text(String),
Tag(Box<Tag>),
Tags(Vec<Tag>),
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(),
}
}
}

View file

@ -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",

View file

@ -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;

View file

@ -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;
}
```