-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
base: main
Are you sure you want to change the base?
Conversation
…, move description to root of `parent` schema
The specification is not fully up to date as the fields added in #102 ( |
There was a problem hiding this 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, |
There was a problem hiding this comment.
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.
"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" |
There was a problem hiding this comment.
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
"title": { | ||
"type": "string", | ||
"description": "The title of the item.", | ||
"examples": [ | ||
"Rick Astley: How An Internet Joke Revived My Career" | ||
] | ||
}, |
There was a problem hiding this comment.
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
"date": { | ||
"type": "string", | ||
"description": "The date at which the item was published.", | ||
"examples": [ | ||
"1949-05" | ||
] | ||
}, |
There was a problem hiding this comment.
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
"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" | ||
} | ||
] | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also support integers
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