param.parameterized.Parameters.schema#
- Parameters.schema(safe: bool = False, subset: Iterable[str] | None = None, mode: str = 'json')[source]#
Generate a schema for the parameters on this
Parameterizedobject.This method provides a schema representation of the parameters on a Parameterized object, including their metadata, using the specified serialization mode.
- Parameters:
safe (bool, optional) – If
True, the schema will only include parameters marked as safe for serialization. Default isFalse.subset (Iterable[str], optional) – An iterable of parameter names to include in the schema. If None, all parameters will be included. Default is
None.mode (str, optional) – The serialization format to use. By default, only
'json'is supported. Default is'json'.
- Returns:
A schema dictionary representing the parameters and their metadata.
- Return type:
- Raises:
ValueError – If the specified serialization mode is not supported.
References
https://param.holoviz.org/user_guide/Serialization_and_Persistence.html#json-schemas
Examples
>>> import param >>> class P(param.Parameterized): ... a = param.Number(default=1, bounds=(0, 10), doc="A numeric parameter") ... b = param.String(default="hello", doc="A string parameter") >>> p = P()
Generate the schema for all parameters:
>>> schema = p.param.schema() >>> schema {'name': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'description': "String identifier for this object. Default is the object's class name plus a unique integer", 'title': 'Name'}, 'a': {'type': 'number',... }