drafter icon indicating copy to clipboard operation
drafter copied to clipboard

Allow type attributes in Mixins

Open pksunkara opened this issue 8 years ago • 2 comments

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.

pksunkara avatar Aug 10 '16 14:08 pksunkara

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.

screen shot 2017-09-01 at 15 07 15

kylef avatar Sep 01 '17 22:09 kylef

What? Type Definition is allowed according to your own screenshot. Type Definition contains Type Attributes. This has been like this since the beginning.

pksunkara avatar Sep 04 '17 11:09 pksunkara