feat!: Validate monotonic numbers for rich parameters (#6046)

* Database changes

* protobuf

* Fix: docs

* workspaces_test

* Validation in coderd

* Fix: resources

* omitempty

* UI changes

* UI tests

* fix
This commit is contained in:
Marcin Tojek
2023-02-07 09:36:13 +01:00
committed by GitHub
parent e3ae664a29
commit b86bce8494
32 changed files with 917 additions and 392 deletions

View File

@ -353,7 +353,9 @@ CREATE TABLE template_version_parameters (
validation_regex text NOT NULL,
validation_min integer NOT NULL,
validation_max integer NOT NULL,
validation_error text DEFAULT ''::text NOT NULL
validation_error text DEFAULT ''::text NOT NULL,
validation_monotonic text DEFAULT ''::text NOT NULL,
CONSTRAINT validation_monotonic_order CHECK ((validation_monotonic = ANY (ARRAY['increasing'::text, 'decreasing'::text, ''::text])))
);
COMMENT ON COLUMN template_version_parameters.name IS 'Parameter name';
@ -378,6 +380,8 @@ COMMENT ON COLUMN template_version_parameters.validation_max IS 'Validation: max
COMMENT ON COLUMN template_version_parameters.validation_error IS 'Validation: error displayed when the regex does not match.';
COMMENT ON COLUMN template_version_parameters.validation_monotonic IS 'Validation: consecutive values preserve the monotonic order';
CREATE TABLE template_versions (
id uuid NOT NULL,
template_id uuid,