Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update and improve json schemas to draft 7 #161

Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 81 additions & 79 deletions csl-citation.json
Original file line number Diff line number Diff line change
@@ -1,101 +1,103 @@
{
"$id": "https://raw.githubusercontent.com/citation-style-language/schema/master/csl-citation.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "JSON schema for CSL citation objects",
"$schema" : "http://json-schema.org/draft-03/schema#",
"id": "https://github.com/citation-style-language/schema/raw/master/csl-citation.json",
"definitions": {
"citationItemDefinition": {
"type": "object",
"properties": {
"id": {
"type": [
"string",
"number"
]
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original schema requires "id" for each citation item, which is a requirement we should keep.

"itemData": {
dsifford marked this conversation as resolved.
Show resolved Hide resolved
"$ref": "csl-data.json"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tried using your version schema, but are you sure this shouldn't be "$ref": "csl-data.json/#/items" like in the original?

},
"prefix": {
"type": "string"
},
"suffix": {
"type": "string"
},
"locator": {
"type": "string"
},
"label": {
"type": "string",
"enum": [
"book",
"chapter",
"column",
"figure",
"folio",
"issue",
"line",
"note",
"opus",
"page",
"paragraph",
"part",
"section",
"sub verbo",
"verse",
"volume"
]
},
"suppress-author": {
"type": [
"string",
"number",
"boolean"
]
},
"author-only": {
"type": [
"string",
"number",
"boolean"
]
},
"uris": {
"type": "array",
"items": {
"type": "string",
"format": "uri"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this to specifically require uri format.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be breaking so I'm gonna leave it.

}
}
},
"additionalProperties": false
}
},
"type": "object",
"properties": {
"schema": {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://github.com/rmzelle/ref-extractor/wiki#single-item-zotero-citation again. Zotero and Mendeley both reference the "csl-citation.json" schema in their embedded citation metadata.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but why cant they use JSON schema as it's indended and just reference the base schema using the top-level $id property? It seems redundant and unnecessary.

"type": "string",
"required": true,
"enum" : [
"https://github.com/citation-style-language/schema/raw/master/csl-citation.json"
]
"format": "uri"
},
"citationID": {
dsifford marked this conversation as resolved.
Show resolved Hide resolved
"type": [
"string",
"number"
],
"required": true
"number"
]
},
"citationItems": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": [
"string",
"number"
],
"required": true
},
"itemData": {
"$ref": "csl-data.json/#/items"
},
"prefix": {
"type": "string"
},
"suffix": {
"type": "string"
},
"locator": {
"type": "string"
},
"label": {
"type": "string",
"enum": [
"book",
"chapter",
"column",
"figure",
"folio",
"issue",
"line",
"note",
"opus",
"page",
"paragraph",
"part",
"section",
"sub verbo",
"verse",
"volume"
]
},
"suppress-author": {
"type": [
"string",
"number",
"boolean"
]
},
"author-only": {
"type": [
"string",
"number",
"boolean"
]
},
"uris": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties" : false
}
"$ref": "#/definitions/citationItemDefinition"
}
},
"properties": {
"type": "object",
"properties": {
"noteIndex": {
"type": "number"
}
"type": "number"
}
},
"additionalProperties" : false
}
"additionalProperties": false
}
},
"additionalProperties" : false
"required": ["schema", "citationID", "citationItems"],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this to include citationItems because it should always return an array, even if empty IMHO.

"additionalProperties": false
}
Loading