Updated models.yml. Added GitHub action with validator.

This commit is contained in:
Norman Jäckel 2020-09-19 20:53:44 +02:00
parent c1b9de6e81
commit a1925e87f3
2 changed files with 105 additions and 41 deletions

30
.github/workflows/models.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Validate models.yml
on: [push, pull_request]
jobs:
validate:
name: Validate models.yml
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.15
uses: actions/setup-go@v1
with:
go-version: 1.15
- name: Install validator
run: go get github.com/OpenSlides/openslides-modelsvalidate/cmd/modelsvalidate
- name: Check out code
uses: actions/checkout@v2
- name: Validate models.yml
run: $HOME/go/bin/modelsvalidate docs/models.yml
check-old:
name: Check old models.txt
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Check MD5 hash of old models.txt
run: echo "4dee769da047e0169b5fe1280f3ea2f0 docs/models.txt" | md5sum --check

View File

@ -1,28 +1,40 @@
---
# Types: # Types:
# - nativ datatypes: string, number, boolean, JSON # - Nativ datatypes: string, number, boolean, JSON
# - HTML: string with HTML content # - HTML: A string with HTML content.
# - float: numbers that are expected to be non-integer. Formatted as in rfc7159. # - 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 # - decimal(X): Decimal values represented as a string with X decimal places.
# - datetime: Datetime as a unix timestamp. Why a number? This enables queries # - datetime: Datetime as a unix timestamp. Why a number? This enables queries
# in the DB. And we do not need more precision than 1 second. # in the DB. And we do not need more precision than 1 second.
# - <T>[]: This indicates and arbitrary array of the given type.
# Relations: # Relations:
# - <collection>/<field>: This is a reference to a collection. The reverse relation # - We have the following types: `relation`, `relation-list`, `generic-relation`
# field is <field>. E.g. `category_id: motion_category/motion_ids` in a motion links # and `generic-relation-list`.
# to one category. The reverse field is `motion_ids` which may be `motion_ids: # - Non-generic relations: The simple syntax for such a field
# (motion/category_id)[]` indicating, that there are many motion ids. # `to: <collection>/<field>`. This is a reference to a collection. The reverse
# - <T>[]: This indicated multiple ids. For an example see above. # relation field in this collection is <field>. E. g. in a motion the field
# - {x,y,z}/<field>: This is a generic relation (analog: `({x,y,z}/<field>)[]` a # `category_id` links to one category where the field `motion_ids` contains the
# generic list relation) with fqids as values to the given ollections x, y and z. # motion id. The simple notation for the field is `motion_category/motion_ids`.
# - If no field is specified, there is no reverse relation. # The reverse field has type `relation-list` and is related back to
# Structured Fields: # `motion/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 collections. Therefor we split the simple notation up to the
# properties `collection` and `field`.
# Structured fields:
# - There are template fields (see autoupdate service interface) with a `$` as # - There are template fields (see autoupdate service interface) with a `$` as
# the placeholder. In this document, angle brackets are followed by the # the placeholder. We have three different types: `template`,
# dollar sign including the meaning of the template. E.g. # `structured-relation` and `structured-tag`.
# group_$<meeting_id>_ids: (group/user_ids)[]; # - The type `template` describes a structured field for the given model. The
# says, that the template are meeting ids and each structured field is a # property `replacement` describes the meaning of the template. The property
# multi-relation to groups and the reverse relation field for groups is # `fields` contains the definition for all the fields that come from the template
# user_ids. # field.
# # - The type `structured-relation` describes the content of a related field as a
# structured field (with properties `name`, `replacement` and `through`).
# - The type `structured-tag` describes the content of a related field as a
# structured field where the template is filled with arbitrary strings instead of
# instance ids.
organisation: organisation:
id: number id: number
name: string name: string
@ -65,7 +77,7 @@ user:
structure_level: string structure_level: string
email: string email: string
last_email_send: string last_email_send: string
vote_weight: decimal vote_weight: decimal(6)
role_id: role_id:
type: relation type: relation
@ -220,7 +232,7 @@ committee:
to: meeting/default_meeting_for_committee_id to: meeting/default_meeting_for_committee_id
member_ids: member_ids:
type: relation-list type: relation-list
to: user/committee_as_memeber_ids to: user/committee_as_member_ids
manager_ids: manager_ids:
type: relation-list type: relation-list
to: user/committee_as_manager_ids to: user/committee_as_manager_ids
@ -248,7 +260,9 @@ meeting:
custom_translations: JSON custom_translations: JSON
# System # System
url_name: string # For unique urls. url_name:
type: string
description: For unique urls.
template_for_committee_id: template_for_committee_id:
type: relation type: relation
to: committee/template_meeting_id to: committee/template_meeting_id
@ -463,7 +477,7 @@ meeting:
to: to:
collection: mediafile collection: mediafile
field: field:
name: used_as_font_$_in_mmeting_id name: used_as_font_$_in_meeting_id
type: structured-tag type: structured-tag
replacement: location replacement: location
# Examples: # Examples:
@ -490,7 +504,7 @@ meeting:
guest_ids: guest_ids:
type: relation-list type: relation-list
to: user/guest_meeting_ids to: user/guest_meeting_ids
user_ids: (Id)[] # Calculated: All ids from temporary_user_ids, guest_ids and all users assigned to groups. user_ids: number[] # Calculated: All ids from temporary_user_ids, guest_ids and all users assigned to groups.
reference_projector_id: reference_projector_id:
type: relation type: relation
to: projector/used_as_reference_projector_meeting_id to: projector/used_as_reference_projector_meeting_id
@ -595,7 +609,9 @@ agenda_item:
is_internal: boolean is_internal: boolean
is_hidden: boolean is_hidden: boolean
duration: number # in seconds duration: number # in seconds
weight: number weight:
type: number
default: 0
level: number # calculated. level: number # calculated.
content_object_id: content_object_id:
@ -657,7 +673,9 @@ speaker:
id: number id: number
begin_time: datetime begin_time: datetime
end_time: datetime end_time: datetime
weight: number weight:
type: number
default: 0
marked: boolean marked: boolean
list_of_speakers_id: list_of_speakers_id:
@ -679,7 +697,7 @@ topic:
attachment_ids: attachment_ids:
type: relation-list type: relation-list
to: mediafile/attachement_ids to: mediafile/attachment_ids
agenda_item_id: agenda_item_id:
type: relation type: relation
to: agenda_item/content_object_id to: agenda_item/content_object_id
@ -705,10 +723,14 @@ motion:
fields: HTML fields: HTML
modified_final_version: HTML modified_final_version: HTML
reason: HTML reason: HTML
category_weight: number category_weight:
type: number
default: 0
state_extension: string state_extension: string
recommendation_extension: string recommendation_extension: string
sort_weight: number sort_weight:
type: number
default: 0
created: datetime created: datetime
last_modified: datetime last_modified: datetime
@ -723,14 +745,14 @@ motion:
to: motion/sort_child_ids to: motion/sort_child_ids
sort_child_ids: sort_child_ids:
type: relation-list type: relation-list
to: motion/parent_id to: motion/sort_parent_id
origin_id: origin_id:
type: relation type: relation
to: motion/derived_motion_ids # Note: The related motions may not be in the same meeting to: motion/derived_motion_ids # Note: The related motions may not be in the same meeting
derived_motion_ids: derived_motion_ids:
type: relation-list type: relation-list
to: motion/origin_id # Note: The related motions may not be in the same meeting to: motion/origin_id # Note: The related motions may not be in the same meeting
forwarding_tree_motion_ids: (Id)[] # Calculated: All children (derived_motion_ids), grand children, ... and all parents (origin_id). forwarding_tree_motion_ids: number[] # Calculated: All children (derived_motion_ids), grand children, ... and all parents (origin_id).
state_id: state_id:
type: relation type: relation
to: motion_state/motion_ids to: motion_state/motion_ids
@ -802,7 +824,9 @@ motion:
motion_submitter: motion_submitter:
id: number id: number
weight: number weight:
type: number
default: 0
user_id: user_id:
type: relation type: relation
@ -830,7 +854,9 @@ motion_comment:
motion_comment_section: motion_comment_section:
id: number id: number
name: string name: string
weight: number weight:
type: number
default: 0
comment_ids: comment_ids:
type: relation-list type: relation-list
@ -849,7 +875,9 @@ motion_category:
id: number id: number
name: string name: string
prefix: string prefix: string
weight: number weight:
type: number
default: 0
level: number level: number
parent_id: parent_id:
@ -863,7 +891,7 @@ motion_category:
to: motion/category_id to: motion/category_id
meeting_id: meeting_id:
type: relation type: relation
to: meeting/category_ids to: meeting/motion_category_ids
motion_block: motion_block:
id: number id: number
@ -964,7 +992,9 @@ motion_statute_paragraph:
id: number id: number
title: string title: string
text: HTML text: HTML
weight: number weight:
type: number
default: 0
motion_ids: motion_ids:
type: relation-list type: relation-list
@ -1082,7 +1112,9 @@ assignment:
assignment_candidate: assignment_candidate:
id: number id: number
weight: number weight:
type: number
default: 0
assignment_id: assignment_id:
type: relation type: relation
@ -1148,7 +1180,9 @@ assignment_option:
yes: decimal(6) yes: decimal(6)
no: decimal(6) no: decimal(6)
abstain: decimal(6) abstain: decimal(6)
weight: number weight:
type: number
default: 0
poll_id: poll_id:
type: relation type: relation
@ -1294,10 +1328,10 @@ projector:
field: current_projector_ids field: current_projector_ids
preview_projection_ids: preview_projection_ids:
type: relation-list type: relation-list
to: projection/projector_preview_id to: projection/preview_projector_id
history_projection_ids: history_projection_ids:
type: relation-list type: relation-list
to: projection/projector_history_id to: projection/history_projector_id
used_as_reference_projector_meeting_id: used_as_reference_projector_meeting_id:
type: relation type: relation
to: meeting/reference_projector_id to: meeting/reference_projector_id