- JSON Schema: http://json-schema.org
- Understanding JSON Schema: https://spacetelescope.github.io/understanding-json-schema/
These guidelines are also related to the layout charter, specifically the form design section.
Properties are ordered like this:
- title
- description
- type
- default (Default value)
- Constraints (e.g. minLength or pattern or minItems)
- additionalProperties (Only for objects)
- properties (Only for objects)
- propertiesOrder (Only for objects)
- required (Only for objects)
- items (Only for arrays)
- form (Editor specific behavior)
- Mandatory.
- Snake case is the main rule:
snake_case
instead ofcamelCase
. - Except when the key name (ie field name) is inspired from BIBFRAME. This is the case with documents, as specified by the metadata working group.
- Title is the natural language form of the property.
- It does not have any punctuation mark.
- In English and French, only the first word has a capitalized initial!
- A description is optional.
- If used, it should add information to the title.
- It's considered as a form help for the end user.
- It's a sentence, it begins with a capital letter and ends with a punctuation mark.
- In English, only the first word has a capitalized initial.
- Always set the
minLength
andmaxLength
property. Adapt the ES mapping accordingly (see ES doc onignore_above
) - If the
pattern
property is set and requires at least one character, theminLength
property is not mandatory.
- Arrays always set the
minItems
property.
In the following example, the main key is singular, but its title
is plural,
as it is the label in the editor, which will contain a list of elements.
On the contrary, the title
of the array
items
is singular, as it is the
label of each item of the list.
The same logic would apply to the description
if any where there.
"language": {
"title": "Languages",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "object",
"title": "Language",
"required": [
"type",
"value"
],
"additionalProperties": false,
"propertiesOrder": [
"type",
"value"
],
"properties": {
"type": {
"title": "Type",
"description": "Type of the language.",
"type": "string",
"default": "bf:Language",
"enum": [
"bf:Language"
],
"form": {
"hideExpression": "true",
"options": [
{
"label": "bf:Language",
"value": "bf:Language"
}
]
}
},
"value": {
"$ref": "#/definitions/language"
}
}
}
}
- For values, apply the following rules to ease the translation work:
- Use a standard controlled vocabulary if possible. Example: RDA values
- Use a prefix to identify the vocabulary, and separate it from the value with colon
:
- Example for RDA mode of issuance:
rdami:1001
. "rdami" refers to a URI.
- Use a prefix to identify the vocabulary, and separate it from the value with colon
- If no standard controlled vocabulary exists
- use natural language, or
- create home made codes, if the values need specific translations that should not be confused with others.
- add a home made prefix spearated by underscore
_
in the case of a list bigger than 8-10 values or if the code is too short (like sz for Switzerland). - Example of a home made code with prefix for Switzerland:
country_sz
. - Example of a home made code without prefix:
received_and_complete_or_ceased
- add a home made prefix spearated by underscore
- Use a standard controlled vocabulary if possible. Example: RDA values
- Form options:
- Use the
value
/label
method only if the codes need to be translated. - In the
label
value, use the same value as the one of thevalue
key. This is to avoid translating the label and the value, as it is sometimes needed. - In case of a list and sublist with
oneOf
(ex: main type/subtype), use the same text fortitle
of the 1st-level element, as forvalue
andlabel
. This will ease the translations.
- Use the