Skip to content

Commit

Permalink
Add special case JSON representation for when an EnumBlock is in a Li…
Browse files Browse the repository at this point in the history
…stBlock
  • Loading branch information
kaedroho committed Jan 3, 2021
1 parent 854ef02 commit 4fae89a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions text/066-enumblock.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,17 @@ For example, an external link using the block definition in the "Link chooser" e
"value": "https://wagtail.io"
}
```

One exception to this is when an ``EnumBlock`` is used in a ``ListBlock``. In this case, the ``EnumBlock``, ``type`` field will be added to the ``ListBlock`` item, alongside its existing ``id`` field. For example:

```json
[
"id": "<List block item ID>",
"type": "paragraph",
"value": "Hello world!"
]
```

This assumes that [RFC 65](https://github.com/wagtail/rfcs/pull/65) is implemented first.

This means that ``ListBlock(EnumBlock(X))`` always has the exact same database representation as ``StreamBlock(X)`` which will simplify switching between the two. I think this would also make it easier to implement StreamField migrations later, as this would mean we only have three simple structural types to deal with.

0 comments on commit 4fae89a

Please sign in to comment.