Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions spec/data-model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,34 +180,31 @@ interface LiteralExpression {
type: "expression";
arg: Literal;
annotation?: FunctionAnnotation | UnsupportedAnnotation;
attributes: Attribute[];
attributes: Attributes;
}

interface VariableExpression {
type: "expression";
arg: VariableRef;
annotation?: FunctionAnnotation | UnsupportedAnnotation;
attributes: Attribute[];
attributes: Attributes;
}

interface FunctionExpression {
type: "expression";
arg?: never;
annotation: FunctionAnnotation;
attributes: Attribute[];
attributes: Attributes;
}

interface UnsupportedExpression {
type: "expression";
arg?: never;
annotation: UnsupportedAnnotation;
attributes: Attribute[];
attributes: Attributes;
}

interface Attribute {
name: string;
value?: Literal | VariableRef;
}
type Attributes = Map<string, Literal | VariableRef | true>;
```

## Expressions
Expand Down Expand Up @@ -237,19 +234,16 @@ interface VariableRef {
A `FunctionAnnotation` represents a _function_ _annotation_.
The `name` does not include the `:` starting sigil.

Each _option_ is represented by an `Option`.
Each _option_ is represented by an `Options` key-value mapping.

```ts
interface FunctionAnnotation {
type: "function";
name: string;
options: Option[];
options: Options;
}

interface Option {
name: string;
value: Literal | VariableRef;
}
type Options = Map<string, Literal | VariableRef>;
```

An `UnsupportedAnnotation` represents a
Expand All @@ -276,15 +270,15 @@ A `Markup` object has a `kind` of either `"open"`, `"standalone"`, or `"close"`,
each corresponding to _open_, _standalone_, and _close_ _markup_.
The `name` in these does not include the starting sigils `#` and `/`
or the ending sigil `/`.
The optional `options` for markup use the same `Option` as `FunctionAnnotation`.
The optional `options` for markup use the same key-value mapping as `FunctionAnnotation`.

```ts
interface Markup {
type: "markup";
kind: "open" | "standalone" | "close";
name: string;
options: Option[];
attributes: Attribute[];
options: Options;
attributes: Attributes;
}
```

Expand Down
38 changes: 10 additions & 28 deletions spec/data-model/message.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,18 @@
},
"required": ["type", "name"]
},
"literal-or-variable": {
"oneOf": [{ "$ref": "#/$defs/literal" }, { "$ref": "#/$defs/variable" }]
},

"options": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"value": {
"oneOf": [
{ "$ref": "#/$defs/literal" },
{ "$ref": "#/$defs/variable" }
]
}
},
"required": ["name", "value"]
}
"type": "object",
"additionalProperties": { "$ref": "#/$defs/literal-or-variable" }
},
"attributes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"value": {
"oneOf": [
{ "$ref": "#/$defs/literal" },
{ "$ref": "#/$defs/variable" }
]
}
},
"required": ["name"]
"type": "object",
"additionalProperties": {
"oneOf": [{ "$ref": "#/$defs/literal-or-variable" }, { "const": true }]
}
},

Expand Down Expand Up @@ -129,7 +111,7 @@
"type": "object",
"properties": {
"type": { "const": "markup" },
"kind": { "oneOf": [ "open", "standalone", "close" ] },
"kind": { "oneOf": ["open", "standalone", "close"] },
"name": { "type": "string" },
"options": { "$ref": "#/$defs/options" },
"attributes": { "$ref": "#/$defs/attributes" }
Expand Down