Skip to content

SchemaError

SchemaError

SchemaError(message: str, *, missing: list[str] | None = None, present: list[str] | None = None, what: str | None = None)

Bases: GBFSValidationError, ValueError

Raised when a frame does not satisfy the canonical schema.

Subclasses both GBFSValidationError (so except GBFSError catches it) and ValueError (backward compatibility).

For schema-mismatch cases the exception also carries structured fields, so an automated pipeline can branch on them without parsing the message: missing (the absent columns), present (the columns that were supplied), and what (the operation that required them). They are None for other validation failures.

See Also

validate_schema : Raises this on failure. GBFSValidationError : The feed-level validation error.

Source code in src/gbfs_toolkit/core/models.py
def __init__(
    self,
    message: str,
    *,
    missing: list[str] | None = None,
    present: list[str] | None = None,
    what: str | None = None,
) -> None:
    super().__init__(message)
    self.missing = missing
    self.present = present
    self.what = what