Skip to content

Commit 70a2b66

Browse files
author
Z
committed
Further variable attribute clarification
1 parent f401671 commit 70a2b66

File tree

1 file changed

+51
-49
lines changed

1 file changed

+51
-49
lines changed

namespaces/mson-namespace.md

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,32 @@ This document extends [Refract][] Specification with new element types necessary
66

77
<!-- TOC depth:3 withLinks:1 updateOnSave:0 -->
88
- [MSON Namespace](#mson-namespace)
9-
- [Content](#content)
10-
- [About this Document](#about-this-document)
11-
- [Expanded Element](#expanded-element)
12-
- [Base Element](#base-element)
13-
- [Type comparison](#type-comparison)
9+
- [Content](#content)
10+
- [About this Document](#about-this-document)
11+
- [Expanded Element](#expanded-element)
12+
- [Base Element](#base-element)
13+
- [Type comparison](#type-comparison)
1414
- [MSON Refract Elements](#mson-refract-elements)
15-
- [MSON Element (Element)](#mson-element-element)
16-
- [Properties](#properties)
17-
- [Boolean Type (Boolean Element)](#boolean-type-boolean-element)
18-
- [String Type (String Element)](#string-type-string-element)
19-
- [Number Type (Number Element)](#number-type-number-element)
20-
- [Array Type (Array Element)](#array-type-array-element)
21-
- [Object Type (Object Element)](#object-type-object-element)
22-
- [Enum Type (MSON Element)](#enum-type-mson-element)
23-
- [Properties](#properties)
24-
- [Examples](#examples)
25-
- [Examples](#examples)
26-
- [Anonymous Object Type](#anonymous-object-type)
27-
- [Type Attributes](#type-attributes)
28-
- [Default Value](#default-value)
29-
- [One Of](#one-of)
30-
- [Mixin](#mixin)
31-
- [Named Type](#named-type)
32-
15+
- [MSON Element (Element)](#mson-element-element)
16+
- [Properties](#properties)
17+
- [Boolean Type (Boolean Element)](#boolean-type-boolean-element)
18+
- [String Type (String Element)](#string-type-string-element)
19+
- [Number Type (Number Element)](#number-type-number-element)
20+
- [Array Type (Array Element)](#array-type-array-element)
21+
- [Object Type (Object Element)](#object-type-object-element)
22+
- [Enum Type (MSON Element)](#enum-type-mson-element)
23+
- [Properties](#properties)
24+
- [Examples](#examples)
25+
- [Examples](#examples)
26+
- [Anonymous Object Type](#anonymous-object-type)
27+
- [Type Attributes](#type-attributes)
28+
- [Default Value](#default-value)
29+
- [One Of](#one-of)
30+
- [Mixin](#mixin)
31+
- [Named Type](#named-type)
32+
- [Variable Value](#variable-value)
33+
- [Variable Property Name](#variable-property-name)
34+
- [Variable Type Name](#variable-type-name)
3335
<!-- /TOC -->
3436

3537
## About this Document
@@ -72,7 +74,7 @@ Note: Not every MSON _Base Type_ is presented in Refract primitive types and vic
7274

7375
# MSON Refract Elements
7476

75-
## MSON Element (Element[*T*])
77+
## MSON Element (Element)
7678

7779
Base element for every MSON element.
7880

@@ -91,21 +93,23 @@ Note: In MSON Refract _Nested Member Types_ _Type Section_ is the `content` of t
9193
- sample - The `content` value is a sample value.
9294
- default - The `content` value is a default value.
9395

94-
- `variable` (boolean) - The `content` value is a _Variable Value_
96+
- `variable` (boolean)
97+
98+
The `content` value is either a _Variable Type Name_, or _Variable Property Name_.
9599

96-
The `content` value is either a _Variable Type Name_, _Variable Value_ or _Variable Property Name_.
100+
Note, if the `content` is a _Variable Value_ the `sample` type attribute
101+
should be used instead (see `typeAttributes`).
97102

98-
- `sample` (array[T]) - Alternative sample value for _Member Types_
103+
- `sample` (array) - Alternative sample value for _Member Types_
99104

100105
The type of items in `sample` array attribute MUST match the type of element's `content`.
101106

102-
- `default` (T) - Default value for _Member Types_
107+
- `default` - Default value for _Member Types_
103108

104109
The type of of `default` attribute MUST match the type of element's `content`.
105110

106111
- `validation` - Not used, reserved for a future use
107112

108-
- `content` (T)
109113

110114
## Boolean Type (Boolean Element)
111115

@@ -495,61 +499,59 @@ Description is here! Properties to follow.
495499

496500
### Variable Value
497501

498-
### MSON
502+
#### MSON
499503

500504
```markdown
501505
- p: *42*
502506
```
503507

504-
### MSON Refract
508+
#### MSON Refract
505509

506510
```json
507511
["object", {}, {}, [
508-
["string", {"name": "p"}, {"typeAttributes": ["sample"]}, 42]
509-
]]
512+
["string", {"name": "p"}, {"typeAttributes": ["sample"]}, 42]
513+
]]
510514
```
511515

512-
## Variable Property Name
516+
### Variable Property Name
513517

514-
### MSON
518+
#### MSON
515519

516520
```markdown
517521
- *rel (Relation)*
518522
```
519523

520-
### MSON Refract
524+
#### MSON Refract
521525

522526
```json
523527
["object", {}, {}, [
524-
["string",
525-
{"name": ["Relation", {}, {"variable": true}, "rel" ] },
526-
{},
527-
null]
528-
]]
528+
["string",
529+
{"name": ["Relation", {}, {"variable": true}, "rel" ] },
530+
{},
531+
null]
532+
]]
529533
```
530534

531-
## Variable Type Name
535+
### Variable Type Name
532536

533537
**Proposal – not yet implemented**
534538

535539
Note this needs an introduction of a new MSON namespace element for any type - `generic`.
536540

537-
### MSON
541+
#### MSON
538542

539543
```markdown
540544
- p (array[*T*])
541545
```
542546

543-
### MSON Refract
547+
#### MSON Refract
544548

545549
```json
546550
["object", {}, {}, [
547-
["array", {"name": "p"}, {}, [
548-
[
549-
["generic", {}, {}, "T"]
550-
]
551-
]]
551+
["array", {"name": "p"}, {}, [
552+
["generic", {}, {}, "T"]
552553
]]
554+
]]
553555
```
554556

555557
---

0 commit comments

Comments
 (0)