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

Create JSON Schema for YAML File #192

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Create JSON Schema for YAML File #192

wants to merge 6 commits into from

Conversation

mkdjr
Copy link
Contributor

@mkdjr mkdjr commented Jul 29, 2024

I took a pass at creating a JSON schema based on the Hayagriva specification. This will likely close #33!

Please provide any and all feedback! This is my first time creating a JSON schema.

This PR might be related to issue #134.

Fixes #206, #33

@EpicEricEE
Copy link

The specification is not fully up to date as the fields added in #102 (abstract, annote and genre) aren't included and are thus also missing here.

@mkdjr
Copy link
Contributor Author

mkdjr commented Aug 2, 2024

The specification is not fully up to date as the fields added in #102 (abstract, annote and genre) aren't included and are thus also missing here.

Thanks for pointing this out! I added them to the schema and started a PR to add them to the documentation (#194).

Copy link
Member

@reknih reknih left a comment

Choose a reason for hiding this comment

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

I found a few mismatches with basic.yml. I think that before merging this, we should at a test that checks whether basic.yml (which is normative) passes the schema. We can do this using jsonschema.

"title": "Hayagriva Bibliography Format",
"description": "A bibliography management format for the modern age.",
"type": "object",
"additionalProperties": false,
Copy link
Member

Choose a reason for hiding this comment

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

This blocks patternProperties from being used.

Comment on lines +43 to +72
"article",
"chapter",
"entry",
"anthos",
"report",
"thesis",
"web",
"scene",
"artwork",
"patent",
"case",
"newspaper",
"legislation",
"manuscript",
"original",
"post",
"misc",
"performance",
"periodical",
"proceedings",
"book",
"blog",
"reference",
"conference",
"anthology",
"repository",
"thread",
"video",
"audio",
"exhibition"
Copy link
Member

Choose a reason for hiding this comment

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

Types are case-insensitive. In particular, they can start with an uppercase letter. I don't think that there is a particularly clean solution to encoding this right now though: https://stackoverflow.com/questions/26604730/can-json-schema-enums-be-case-insensitive

Comment on lines +76 to +82
"title": {
"type": "string",
"description": "The title of the item.",
"examples": [
"Rick Astley: How An Internet Joke Revived My Career"
]
},
Copy link
Member

Choose a reason for hiding this comment

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

Does not support the object mode:

    title:
        value: "ZygOS: Achieving Low Tail Latency for Microsecond-Scale Networked Tasks"
        verbatim: true
        # also possible: sentence-case, title-case, short

Comment on lines +125 to +131
"date": {
"type": "string",
"description": "The date at which the item was published.",
"examples": [
"1949-05"
]
},
Copy link
Member

Choose a reason for hiding this comment

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

A integer should be allowed here to just specify a year

Comment on lines +387 to +404
"serial-number": {
"type": [
"string",
"object"
],
"description": "Any serial number, including article numbers. If you have serial numbers of well-known schemes like doi, you should put them into the serial number as a dictionary like in the second example. Hayagriva will recognize and specially treat `doi`, `isbn`, `issn`, `pmid`, `pmcid`, and `arxiv`. You can also include `serial` for the serial number when you provide other formats as well.",
"additionalProperties": {
"type": "string"
},
"examples": [
"2003.13722",
{
"doi": "10.22541/au.148771883.35456290",
"arxiv": "1906.00356",
"serial": "8516"
}
]
},
Copy link
Member

Choose a reason for hiding this comment

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

Should also support integers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSONschema for bibliography file Add YAML/JSON Schema
3 participants