This shared repository holds all relevant (meta) data. Other services may include it as a sub-repository to have access to its data.
The datastructure of OpenSlides is defined by a list of collections. For each
collection, there is a file in the collections directory. The file
collection-meta.yml contains meta fields, that are used by more then one collection.
Each collection-file has the following format:
- Length of names:
- field name: Their length is limited to 25 characters. There are still some fields with longer names, that has to be shortened
- Types:
- Nativ datatypes: text, string (text with maxLength=256), number, boolean, JSON
- HTMLStrict: A string with HTML content.
- HTMLPermissive: A string with HTML content (with video tags).
- float: Numbers that are expected to be non-integer. Formatted as in rfc7159.
- decimal(X): Decimal values represented as a string with X decimal places. At the moment we support only X == 6.
- timestamp: Datetime as a unix timestamp. Why a number? This enables queries in the DB. And we do not need more precision than 1 second.
- []: This indicates and arbitrary array of the given type. At the moment
we support only some types. You can add JSON Schema properties for items
using the extra property
items - color: string that must match ^#[0-9a-f]{6}$
- Relations:
- We have the following types:
relation,relation-list,generic-relationandgeneric-relation-list. - Non-generic relations: The simple syntax for such a field
to: <collection>/<field>. This is a reference to a collection. The reverse relation field in this collection is . E. g. in a motion the fieldcategory_idlinks to one category where the fieldmotion_idscontains the motion id. The simple notation for the field ismotion_category/motion_ids. The reverse field has typerelation-listand is related back tomotion/category_id. The type indicates that there are many motion ids. - Generic relations: The difference to non-generic relations is that you have a
list of possible fields, so
tocan either hold multiple collections (if the field name is the same): to: collections: - agenda_item - assignment - ... field: tag_ids Ortocan be a list of collection fields: to: - motion/option_ids - user/option_$_ids - on_delete: This fields determines what should happen with the foreign model if this model gets deleted. Possible values are: - SET_NULL (default): delete the id from the foreign key - PROTECT: if the foreign key is not empty, throw an error instead of deleting the object - CASCADE: also delete all models in this foreign key
- We have the following types:
- JSON Schema Properties:
- You can add JSON Schema properties to the fields like
enum,description,items,maxLengthandminimum
- You can add JSON Schema properties to the fields like
- Additional properties:
- The property
read_onlydescribes a field that can not be changed by an action. - The property
defaultdescribes the default value that is used for new objects. - The property
requireddescribes that this field can not be null or an empty string. If this field is given it must have some content. On relation and generic-relation fields the value as to be an id of an existing object. - The property
equal_fieldsdescribes fields that must have the same value in the instance and the related instance.
- The property
- Restriction Mode:
The field
restriction_modeis required for every field. It puts the field into a restriction group. See https://github.com/OpenSlides/OpenSlides/wiki/Restrictions-Overview