Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

ParamSet

ParamSet. Use to define a group of parameters that can be added multiple times. This will provid a list of dictionary as values : List[Dict[str, Any]]

Attributes
PRIVATE_VISIBILITY: LiteralPROTECTED_VISIBILITY: LiteralPUBLIC_VISIBILITY: Literaladditional_info: dict | Noneai_catalog_member: booldefault_rows: list[dict[str, typing.Any]] | Nonedefault_rows_mode: ParamSetDefaultRowsModedefault_value: Optionalhuman_name: str | Noneinvalid_reason: str | Noneis_valid: boolmax_number_of_occurrences: int | Nonemin_number_of_occurrences: int | Noneoptional: boolparam_set: ConfigSpecsshort_description: str | Nonevisibility: Literal
Functions
__init__
param_set : gws_core.config.config_specs.ConfigSpecs | None
visibility : Literal - public
Visibility of the param. It override all child spec visibility. see doc on type ParamSpecVisibilty for more info
human_name : str | None
Human readable name of the param, showed in the interface
short_description : str | None
Description of the param, showed in the interface
max_number_of_occurrences : int | None
Nb max of occurence of values the params. If negative or None, there is no limit.
min_number_of_occurrences : int | None - 1
Nb min of rows. Defaults to 1. Set to 0 to make the ParamSet optional (it may then have 0 rows, the value being an empty array []). Negative or None is treated as 0.
default_rows : list[dict[str, typing.Any]] | None
Preset rows used as the initial value. Each row is a partial dict keyed by inner-spec key; unspecified inner fields fall back to their own default. Rows may carry a ``__item_id`` to keep a stable identity; otherwise a deterministic one is generated.
default_rows_mode : ParamSetDefaultRowsMode - ParamSetDefaultRowsMode.EDITABLE
How the ``default_rows`` behave for the user. ``EDITABLE`` (default) makes them a plain pre-fill. ``LOCK_PROVIDED`` pins each non-None cell provided in a preset (the user cannot edit it nor remove the row); cells left out or set to None stay editable. Any mode other than ``EDITABLE`` requires ``default_rows``. Enforced server-side.
build

Method call before the value is used (in task or view) to apply some transformation if needed by the ParamSpec. This does not affect the value in the database.

value : Any
Return type : Any
clone_with_inner_specs

Return a copy of this ParamSet with its inner specs replaced.

Every other attribute (occurrence bounds, presets, mode, visibility, ...) is carried over verbatim, so callers that need a structurally identical ParamSet over different inner specs — e.g. building a probe ConfigSpecs for cycle detection — don't have to enumerate the fields (and silently drift when a new one is added).

default_rows are copied as-is (already-built provided cells), not re-validated against inner_specs.

inner_specs : ConfigSpecs
Return type : ParamSet
get_default_value
Return type : list
to_dto
Return type : ParamSpecDTO
to_simple_dto
Return type : ParamSpecSimpleDTO
validate

Validate a ParamSet value (list of row dicts) and reconcile per-row identity.

Each row carries a reserved ConfigSpecs.ITEM_ID_KEY (__item_id) — a UUID v4 stable across saves. Clients should generate it themselves for new rows; the server fills it in if missing. Duplicate ids within the same ParamSet are rejected.

The id is stripped before delegating to the inner ConfigSpecs.get_and_check_values (which would otherwise reject the unknown reserved key) and re-attached on the validated dict.

value : list
Return type : Any
validate_lenient

Lenient variant of validate — runs leaf-level validation on provided values but does NOT raise on missing inner mandatories or on per-leaf validation failures.

Errors are returned alongside the validated rows; each key is "[<row_index>].<inner_key>" (no leading ParamSet key — the caller prepends it). Used by the form-save flow, where errors are rendered per-field and missing mandatories only block on the SUBMITTED transition.

value : list
Return type : ParamSetRowsValidationResult
ai_additional_info_doc @classmethod

Maps this type's AI-relevant additional_info constraint keys to a human explanation. Default: none. Override on types that expose constraints (min/max, lengths, multiple, ...).

Return type : dict
ai_example_spec @classmethod

A representative, valid instance of this type used as the example in :meth:describe_for_ai. Override to show meaningful constraints (e.g. min/max). The default is a bare instance with a human_name.

Return type : ParamSet
ai_summary @classmethod

One-line description of what this field type is for. Override per type.

Return type : str
describe_for_ai @classmethod

Self-describe this param type for an AI form-builder.

Returns the type tag, a one-line summary, the meaning of each AI-relevant additional_info key, and a real example spec serialized exactly as ConfigSpecs.from_json expects. Built from :meth:ai_example_spec / :meth:ai_summary / :meth:ai_additional_info_doc so a type only overrides the small pieces it cares about. Keeping this on the type (not in the AI service) means a new param type ships its own catalog entry.

example_key : str - example_field
Return type : ParamSpecAiDescriptionDTO
empty @classmethod
Return type : Self
get_category @classmethod

The :class:ParamSpecCategory this type was registered with by the @param_spec_decorator. None if the class was never decorated.

Return type : gws_core.config.param.param_spec_decorator.ParamSpecCategory | None
get_param_spec_type @classmethod
Return type : ParamSpecType
load_from_dto @classmethod
spec_dto : ParamSpecDTO
validate : bool - False
Return type : ParamSet
diff_values @staticmethod

Diff two ParamSet values (lists of row dicts) by __item_id.

Produces:

  • PARAMSET_ITEM_REMOVED for ids only in old (path: key[item_id=<uuid>]).
  • PARAMSET_ITEM_ADDED for ids only in new.
  • One FIELD_CREATED / FIELD_UPDATED / FIELD_DELETED per inner field change for ids present on both sides (path: key[item_id=<uuid>].<field>).

Reorder = same set of ids on both sides with no inner change → no entries.

__item_id is stripped from old_value / new_value payloads on ITEM_ADDED / ITEM_REMOVED entries — the path already carries the id.

key : str
old_val : Any
new_val : Any
Return type : list
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.