Skip to content

Commit

Permalink
Revert new date object format (#400)
Browse files Browse the repository at this point in the history
* revert new date object format

* re-add title/description to literal property

* make date-variable an anyOf because literal is valid against two

* turn date literal into a oneOf

* add example for date-variable
  • Loading branch information
cormacrelf authored Oct 16, 2021
1 parent 670f563 commit 439a703
Showing 1 changed file with 55 additions and 91 deletions.
146 changes: 55 additions & 91 deletions schemas/input/csl-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,125 +84,89 @@
"type": "string",
"pattern": "^[0-9-%~X?./]{4,}$"
},
"date-object": {
"title": "Date Object",
"description": "An EDTF date represented as an object. Seasons can be represented using the 21-24 month values of EDTF, decades and centuries using the X notation, and the qualifiers with the included boolean properties",
"date-object-v2": {
"title": "Date Object (v2)",
"description": "Supports literal only, for now",
"oneOf": [
{
"type": "object",
"title": "Literal Date",
"description": "A date that should be passed through to the processor as is; for dates that cannot be represented in EDTF.",
"examples": [{ "literal": "Han Dynasty" }],
"properties": {
"literal": {
"type": "string"
}
},
"required": ["literal"]
}
]
},
"date-object-v1": {
"title": "Date Object (v1)",
"description": "Legacy date format from CSL JSON 1.0.",
"deprecated": true,
"examples": [
{
"id": "one",
"type": "book",
"title": "The Title",
"issued": {
"year": 2000,
"month": 3,
"day": 10
},
"approximate": "true"
"date-parts": [[2000, 3, 10]],
"circa": "true"
}
}
],
"type": "object",
"properties": {
"year": {
"title": "year",
"description": "A year; can be negative.",
"examples": ["2012", "-32"],
"type": "integer"
},
"month": {
"title": "month",
"description": "A month; can also represent seasons using the EDTF 21-24 values.",
"examples": ["2", "22"],
"type": "integer"
},
"day": {
"title": "day",
"type": "integer"
"date-parts": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": ["string", "number"]
},
"minItems": 1,
"maxItems": 3
},
"minItems": 1,
"maxItems": 2
},
"literal": {
"title": "Literal date",
"description": "A date that should be passed through to the processor as is; for dates that cannot be represented in EDTF.",
"examples": ["Han Dynasty"],
"type": "string"
"season": {
"type": ["string", "number"]
},
"approximate": {
"title": "Approximate",
"description": "Indicates an approximate or circa date, which may be presented as `circa May 23, 1972`.",
"type": "boolean"
"circa": {
"type": ["string", "number", "boolean"]
},
"uncertain": {
"title": "Uncertain",
"description": "Indicates uncertainty about a date representation, which may be presented as `May 23, 1972?`",
"type": "boolean"
"literal": {
"type": "string"
},
"undefined": {
"title": "Undefined",
"description": "Use to represent an open end of a range.",
"type": "boolean"
"raw": {
"type": "string"
}
},
"oneOf": [
{
"required": ["year"]
},
{
"required": ["undefined"]
}
]
"additionalProperties": false
},
"date-range": {
"title": "Date Range",
"description": "An EDTF range is an object with begin and end properties. An open end or beginning of a range can be represented with an undefined property on the data object.",
"type": "array",
"date-variable": {
"title": "Date content model",
"description": "The CSL input model supports three date representations: an EDTF string (preferred), a literal format using `{ \"literal\": \"string\" }`, and a legacy format (deprecated).",
"examples": [
{
"id": "range-1",
"type": "book",
"title": "The Title",
"issued": {
"begin": { "year": 2000 },
"end": { "year": 2001 }
}
},
{
"id": "range-2",
"id": "one",
"type": "book",
"title": "The Title",
"issued": [
{ "begin": { "year": 2000 } },
{ "end": { "undefined": true } }
]
"issued": "2019-07-16?"
}
],
"properties": {
"begin": {
"$ref": "#/definitions/date-object"
},
"end": {
"$ref": "#/definitions/date-object"
}
}
},
"date-structured": {
"title": "Structured Date",
"description": "Can either be an object, or a two-item array.",
"oneOf": [
"anyOf": [
{
"$ref": "#/definitions/date-object"
"$ref": "#/definitions/edtf-string"
},
{
"$ref": "#/definitions/date-range"
}
]
},
"date-variable": {
"title": "Date content model.",
"description": "The CSL input model supports two different date representations: an EDTF string (preferred), and a more structured alternative.",
"oneOf": [
{
"$ref": "#/definitions/edtf-string"
"$ref": "#/definitions/date-object-v2"
},
{
"$ref": "#/definitions/date-structured"
"$ref": "#/definitions/date-object-v1"
}
]
},
Expand Down

0 comments on commit 439a703

Please sign in to comment.