diff --git a/python/stencila/schema/types.py b/python/stencila/schema/types.py index 6eb3f02c..2f287b96 100644 --- a/python/stencila/schema/types.py +++ b/python/stencila/schema/types.py @@ -2079,7 +2079,7 @@ def __init__( class ListItem(Thing): """A single item in a list.""" - content: Optional[Array["Node"]] = None + content: Optional[Union[Array["BlockContent"], Array["InlineContent"]]] = None """The content of the list item.""" isChecked: Optional[bool] = None @@ -2095,7 +2095,7 @@ class ListItem(Thing): def __init__( self, alternateNames: Optional[Array[str]] = None, - content: Optional[Array["Node"]] = None, + content: Optional[Union[Array["BlockContent"], Array["InlineContent"]]] = None, description: Optional[Union[Array["BlockContent"], Array["InlineContent"], str]] = None, id: Optional[str] = None, identifiers: Optional[Array[Union["PropertyValue", str]]] = None, diff --git a/r/R/types.R b/r/R/types.R index 46d049e8..6d6cfbf5 100644 --- a/r/R/types.R +++ b/r/R/types.R @@ -2308,7 +2308,7 @@ ListItem <- function( url = url ) self$type <- as_scalar("ListItem") - self[["content"]] <- check_property("ListItem", "content", FALSE, missing(content), Array(Node), content) + self[["content"]] <- check_property("ListItem", "content", FALSE, missing(content), Union(Array(BlockContent), Array(InlineContent)), content) self[["isChecked"]] <- check_property("ListItem", "isChecked", FALSE, missing(isChecked), "logical", isChecked) self[["item"]] <- check_property("ListItem", "item", FALSE, missing(item), Node, item) self[["position"]] <- check_property("ListItem", "position", FALSE, missing(position), "numeric", position) @@ -4114,9 +4114,9 @@ Table <- function( #' A cell within a `Table`. #' #' @name TableCell -#' @param content Contents of the table cell. \bold{Required}. #' @param cellType Indicates whether the cell is a header or data. #' @param colspan How many columns the cell extends. +#' @param content Contents of the table cell. #' @param id The identifier for this item. #' @param meta Metadata associated with this item. #' @param name The name of the cell. @@ -4125,9 +4125,9 @@ Table <- function( #' @seealso \code{\link{Entity}} #' @export TableCell <- function( - content, cellType, colspan, + content, id, meta, name, @@ -4138,9 +4138,9 @@ TableCell <- function( meta = meta ) self$type <- as_scalar("TableCell") - self[["content"]] <- check_property("TableCell", "content", TRUE, missing(content), Union(Array(BlockContent), Array(InlineContent)), content) self[["cellType"]] <- check_property("TableCell", "cellType", FALSE, missing(cellType), Enum("Data", "Header"), cellType) self[["colspan"]] <- check_property("TableCell", "colspan", FALSE, missing(colspan), "numeric", colspan) + self[["content"]] <- check_property("TableCell", "content", FALSE, missing(content), Union(Array(BlockContent), Array(InlineContent)), content) self[["name"]] <- check_property("TableCell", "name", FALSE, missing(name), "character", name) self[["rowspan"]] <- check_property("TableCell", "rowspan", FALSE, missing(rowspan), "numeric", rowspan) class(self) <- c(class(self), "TableCell") diff --git a/rust/src/types.rs b/rust/src/types.rs index 31f9beaa..b364bf30 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -2107,7 +2107,7 @@ pub struct ListItem { pub alternate_names: Option>, /// The content of the list item. - pub content: Option>, + pub content: Option, /// A description of the item. pub description: Option, @@ -4330,6 +4330,14 @@ pub enum ListOrder { Unordered, } +/// Types permitted for the `content` property of a `ListItem` node. +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListItemContent { + VecBlockContent(Vec), + VecInlineContent(Vec), +} + /// Types permitted for the `funders` property of a `MonetaryGrant` node. #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(untagged)] diff --git a/schema/ListItem.schema.yaml b/schema/ListItem.schema.yaml index 3f422e21..1427f84d 100644 --- a/schema/ListItem.schema.yaml +++ b/schema/ListItem.schema.yaml @@ -19,9 +19,13 @@ properties: '@id': stencila:content description: The content of the list item. $comment: Use either `content` or `item`, not both. - type: array - items: - $ref: Node + anyOf: + - type: array + items: + $ref: BlockContent + - type: array + items: + $ref: InlineContent isChecked: '@id': stencila:isChecked description: A flag to indicate if this list item is checked.