Skip to content

Commit

Permalink
fix(Schema): For consistency capitalize all enum variants
Browse files Browse the repository at this point in the history
For consistency with schema.org we had started using PascalCase for enum variants.
This is also consistent with Rust conventions. This completes that process.
  • Loading branch information
nokome committed May 26, 2021
1 parent cfc571a commit c94405d
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions python/stencila/schema/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

EClaimType = Enum("ClaimType", ["Statement", "Theorem", "Lemma", "Proof", "Postulate", "Hypothesis", "Proposition", "Corollary"])

EItemListOrder = Enum("ItemListOrder", ["ascending", "descending", "unordered"])
EItemListOrder = Enum("ItemListOrder", ["Ascending", "Descending", "Unordered"])

ENoteType = Enum("NoteType", ["Footnote", "Endnote", "Sidenote"])

ESessionStatus = Enum("SessionStatus", ["unknown", "starting", "started", "stopping", "stopped", "failed"])
ESessionStatus = Enum("SessionStatus", ["Unknown", "Starting", "Started", "Stopping", "Stopped", "Failed"])

ECellType = Enum("CellType", ["data", "header"])
ECellType = Enum("CellType", ["Data", "Header"])

ERowType = Enum("RowType", ["header", "footer"])
ERowType = Enum("RowType", ["Header", "Footer"])


class Entity:
Expand Down
8 changes: 4 additions & 4 deletions r/R/types.R
Original file line number Diff line number Diff line change
Expand Up @@ -2259,7 +2259,7 @@ List <- function(
)
self$type <- as_scalar("List")
self[["items"]] <- check_property("List", "items", TRUE, missing(items), Array(ListItem), items)
self[["order"]] <- check_property("List", "order", FALSE, missing(order), Enum("ascending", "descending", "unordered"), order)
self[["order"]] <- check_property("List", "order", FALSE, missing(order), Enum("Ascending", "Descending", "Unordered"), order)
class(self) <- c(class(self), "List")
self
}
Expand Down Expand Up @@ -3748,7 +3748,7 @@ SoftwareSession <- function(
self[["memoryRequest"]] <- check_property("SoftwareSession", "memoryRequest", FALSE, missing(memoryRequest), "numeric", memoryRequest)
self[["networkTransferLimit"]] <- check_property("SoftwareSession", "networkTransferLimit", FALSE, missing(networkTransferLimit), "numeric", networkTransferLimit)
self[["networkTransferRequest"]] <- check_property("SoftwareSession", "networkTransferRequest", FALSE, missing(networkTransferRequest), "numeric", networkTransferRequest)
self[["status"]] <- check_property("SoftwareSession", "status", FALSE, missing(status), Enum("unknown", "starting", "started", "stopping", "stopped", "failed"), status)
self[["status"]] <- check_property("SoftwareSession", "status", FALSE, missing(status), Enum("Unknown", "Starting", "Started", "Stopping", "Stopped", "Failed"), status)
self[["timeoutLimit"]] <- check_property("SoftwareSession", "timeoutLimit", FALSE, missing(timeoutLimit), "numeric", timeoutLimit)
self[["timeoutRequest"]] <- check_property("SoftwareSession", "timeoutRequest", FALSE, missing(timeoutRequest), "numeric", timeoutRequest)
self[["volumeMounts"]] <- check_property("SoftwareSession", "volumeMounts", FALSE, missing(volumeMounts), Array(VolumeMount), volumeMounts)
Expand Down Expand Up @@ -4139,7 +4139,7 @@ TableCell <- function(
)
self$type <- as_scalar("TableCell")
self[["content"]] <- check_property("TableCell", "content", TRUE, missing(content), Array(Node), content)
self[["cellType"]] <- check_property("TableCell", "cellType", FALSE, missing(cellType), Enum("data", "header"), cellType)
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[["name"]] <- check_property("TableCell", "name", FALSE, missing(name), "character", name)
self[["rowspan"]] <- check_property("TableCell", "rowspan", FALSE, missing(rowspan), "numeric", rowspan)
Expand Down Expand Up @@ -4170,7 +4170,7 @@ TableRow <- function(
)
self$type <- as_scalar("TableRow")
self[["cells"]] <- check_property("TableRow", "cells", TRUE, missing(cells), Array(TableCell), cells)
self[["rowType"]] <- check_property("TableRow", "rowType", FALSE, missing(rowType), Enum("header", "footer"), rowType)
self[["rowType"]] <- check_property("TableRow", "rowType", FALSE, missing(rowType), Enum("Header", "Footer"), rowType)
class(self) <- c(class(self), "TableRow")
self
}
Expand Down
6 changes: 3 additions & 3 deletions schema/List.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ properties:
'@id': 'schema:itemListOrder'
description: Type of ordering.
enum:
- ascending
- descending
- unordered
- Ascending
- Descending
- Unordered
default: unordered
required:
- items
Expand Down
12 changes: 6 additions & 6 deletions schema/SoftwareSession.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ properties:
'@id': stencila:sessionStatus
description: The status of the session (starting, stopped, etc).
enum:
- unknown
- starting
- started
- stopping
- stopped
- failed
- Unknown
- Starting
- Started
- Stopping
- Stopped
- Failed
clientsRequest:
'@id': stencila:clientsRequest
description: The maximum number of concurrent clients requested for the session.
Expand Down
4 changes: 2 additions & 2 deletions schema/TableCell.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ properties:
When `data`, the cell is similar to the HTML [`<td>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td)).
type: string
enum:
- data
- header
- Data
- Header
default: data
rowspan:
'@id': stencila:rowspan
Expand Down
4 changes: 2 additions & 2 deletions schema/TableRow.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ properties:
If present, indicates that all cells in this row should be treated as header cells.
type: string
enum:
- header
- footer
- Header
- Footer
required:
- cells
2 changes: 1 addition & 1 deletion ts/bindings/r.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ test('generators', async () => {

const list = await schema('List.schema.json')
expect(enumToType(list.properties?.order.enum ?? [])).toEqual(
'Enum("ascending", "descending", "unordered")'
'Enum("Ascending", "Descending", "Unordered")'
)
})

0 comments on commit c94405d

Please sign in to comment.