drafter
drafter copied to clipboard
Allow type attributes in Mixins
fixed
, required
and optional
are allowed for mixin definitions.
Input
# Data Structures
# A
+ a: a
# B
+ b: b
+ Include (A, optional)
Output
element: "parseResult"
content:
-
element: "category"
meta:
classes:
- "api"
title: ""
content:
-
element: "category"
meta:
classes:
- "dataStructures"
content:
-
element: "dataStructure"
content:
-
element: "object"
meta:
id: "A"
content:
-
element: "member"
content:
key:
element: "string"
content: "a"
value:
element: "string"
content: "a"
-
element: "dataStructure"
content:
-
element: "object"
meta:
id: "B"
content:
-
element: "member"
content:
key:
element: "string"
content: "b"
value:
element: "string"
content: "b"
-
element: "ref"
content:
href: "A"
path: "content"
Expected
There should typeAttributes: ["optional"]
somewhere in there.
According to MSON specification, (
and )
are not used for included mixins at all. The syntax is + Include A
not + Include (A)
. No type attributes are permitted. We should make the parser stricter.
What? Type Definition
is allowed according to your own screenshot. Type Definition
contains Type Attributes
. This has been like this since the beginning.