lenskit.data.schema.DataSchema#

class lenskit.data.schema.DataSchema(/, **data)#

Bases: pydantic.BaseModel

Description of the entities and layout of a dataset.

Parameters:

data (Any)

version: str = '2025.3'#

The data layout version.

Note

When a new schema model is created, this defaults to the current version instead of the oldest version.

name: str | None = None#

The dataset name.

default_interaction: Name | None = None#

The default interaction type.

entities: dict[Name, EntitySchema]#

Entity classes defined for this dataset.

relationships: dict[Name, RelationshipSchema]#

Relationship classes defined for this dataset.

classmethod model_validate_json(json_data, *, context=None, **kwargs)#
!!! abstract “Usage Documentation”

[JSON Parsing](../concepts/json.md#json-parsing)

Validate the given JSON data against the Pydantic model.

A [ValidationError][pydantic_core.ValidationError] raised here reports the rejected locations and values, but may not retain the complete source document. Recording validations with [Logfire](../integrations/logfire.md) keeps the complete JSON input alongside the error — see [Troubleshooting validation errors](../errors/troubleshooting.md).

Parameters:
  • json_data (str | bytes | bytearray) – The JSON data to validate.

  • strict – Whether to enforce types strictly.

  • extra – Whether to ignore, allow, or forbid extra data during model validation. See the [extra configuration value][pydantic.ConfigDict.extra] for details.

  • context (Any) – Extra variables to pass to the validator.

  • by_alias – Whether to use the field’s alias when validating against the provided input data.

  • by_name – Whether to use the field’s name when validating against the provided input data.

  • kwargs (Any)

Returns:

The validated Pydantic model.

Raises:

ValidationError – If json_data is not a JSON string or the object could not be validated.