From 13181a52ee1931a0e21cb7c546d53249d6429891 Mon Sep 17 00:00:00 2001 From: benne-dee <78043691+benne-dee@users.noreply.github.com> Date: Wed, 27 Jan 2021 22:38:40 +0530 Subject: [PATCH] Define schema for groups in netinstall.schema.yaml --- src/modules/netinstall/netinstall.schema.yaml | 60 ++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/src/modules/netinstall/netinstall.schema.yaml b/src/modules/netinstall/netinstall.schema.yaml index a66c877d1..61ab1c8f4 100644 --- a/src/modules/netinstall/netinstall.schema.yaml +++ b/src/modules/netinstall/netinstall.schema.yaml @@ -1,8 +1,64 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: GPL-3.0-or-later --- -$schema: https://json-schema.org/schema# +$schema: http://json-schema.org/draft-07/schema# $id: https://calamares.io/schemas/netinstall +definitions: + package: + $id: '#definitions/package' + oneOf: + - + type: string + description: bare package - actual package name as passed to the package manager + (e.g. `qt5-creator-dev`). + - + type: object + description: rich package - one with a package-name (for the package-manager) and + a description (for the human). + properties: + name: { type: string } + description: { type: string } + group: + $id: '#definitions/group' + type: object + description: Longer discussion in `netinstall.conf` file under 'Groups Format' + properties: + name: { type: string } + description: { type: string } + packages: + type: array + items: { $ref: '#definitions/package' } + hidden: { type: boolean, default: false } + selected: { type: boolean } + critical: { type: boolean, default: false } + immutable: { type: boolean } + expanded: { type: boolean } + subgroups: + type: array + items: { $ref: '#definitions/group' } + pre-install: + type: string + description: an optional command to run within the new system before the group's + packages are installed. It will run before **each** package in the group + is installed. + post-install: + type: string + description: an optional command to run within the new system after the group's + packages are installed. It will run after **each** package in the group + is installed. + required: [name, description] # Always required, at any level in the subgroups hirearchy + if: + properties: + subgroups: + maxItems: 0 + then: + required: [name, description, packages] # bottom-most (sub)group requires some package (otherwise, why bother?) + # This should validate `netinstall.yaml` also. + groups: + $id: '#definitions/groups' + type: array + items: { $ref: '#definitions/group' } + additionalProperties: false type: object properties: @@ -14,5 +70,5 @@ properties: properties: sidebar: { type: string } title: { type: string } - groups: { type: array } # TODO: the schema for the whole groups file + groups: { $ref: '#definitions/groups' } # DONE: the schema for groups required: [ groupsUrl ]