bluesky_tiled_plugins.routers.validator#

Module Contents#

Classes#

ValidationResponse

!!! abstract “Usage Documentation” Models

PostValidationRequest

!!! abstract “Usage Documentation” Models

Functions#

validate_entry_structure

Validate the structure of data sources in the given entry.

validate_entry_reading

Validate that data can be read from all arrays and tables in the given entry.

get_validate_operation

post_validate_operation

Data#

API#

bluesky_tiled_plugins.routers.validator.router#

‘APIRouter(…)’

class bluesky_tiled_plugins.routers.validator.ValidationResponse(/, **data: Any)#

Bases: pydantic.BaseModel

!!! abstract “Usage Documentation” Models

A base class for creating Pydantic models.

Attributes: class_vars: The names of the class variables defined on the model. private_attributes: Metadata about the private attributes of the model. signature: The synthesized __init__ [Signature][inspect.Signature] of the model.

__pydantic_complete__: Whether model building is completed, or if there are still undefined fields.
__pydantic_core_schema__: The core schema of the model.
__pydantic_custom_init__: Whether the model has a custom `__init__` function.
__pydantic_decorators__: Metadata containing the decorators defined on the model.
    This replaces `Model.__validators__` and `Model.__root_validators__` from Pydantic V1.
__pydantic_generic_metadata__: A dictionary containing metadata about generic Pydantic models.
    The `origin` and `args` items map to the [`__origin__`][genericalias.__origin__]
    and [`__args__`][genericalias.__args__] attributes of [generic aliases][types-genericalias],
    and the `parameter` item maps to the `__parameter__` attribute of generic classes.
__pydantic_parent_namespace__: Parent namespace of the model, used for automatic rebuilding of models.
__pydantic_post_init__: The name of the post-init method for the model, if defined.
__pydantic_root_model__: Whether the model is a [`RootModel`][pydantic.root_model.RootModel].
__pydantic_serializer__: The `pydantic-core` `SchemaSerializer` used to dump instances of the model.
__pydantic_validator__: The `pydantic-core` `SchemaValidator` used to validate instances of the model.

__pydantic_fields__: A dictionary of field names and their corresponding [`FieldInfo`][pydantic.fields.FieldInfo] objects.
__pydantic_computed_fields__: A dictionary of computed field names and their corresponding [`ComputedFieldInfo`][pydantic.fields.ComputedFieldInfo] objects.

__pydantic_extra__: A dictionary containing extra values, if [`extra`][pydantic.config.ConfigDict.extra]
    is set to `'allow'`.
__pydantic_fields_set__: The names of fields explicitly set during instantiation.
__pydantic_private__: Values of private attributes set on the model instance.
valid: bool#

None

notes: list[str]#

None

class bluesky_tiled_plugins.routers.validator.PostValidationRequest(/, **data: Any)#

Bases: pydantic.BaseModel

!!! abstract “Usage Documentation” Models

A base class for creating Pydantic models.

Attributes: class_vars: The names of the class variables defined on the model. private_attributes: Metadata about the private attributes of the model. signature: The synthesized __init__ [Signature][inspect.Signature] of the model.

__pydantic_complete__: Whether model building is completed, or if there are still undefined fields.
__pydantic_core_schema__: The core schema of the model.
__pydantic_custom_init__: Whether the model has a custom `__init__` function.
__pydantic_decorators__: Metadata containing the decorators defined on the model.
    This replaces `Model.__validators__` and `Model.__root_validators__` from Pydantic V1.
__pydantic_generic_metadata__: A dictionary containing metadata about generic Pydantic models.
    The `origin` and `args` items map to the [`__origin__`][genericalias.__origin__]
    and [`__args__`][genericalias.__args__] attributes of [generic aliases][types-genericalias],
    and the `parameter` item maps to the `__parameter__` attribute of generic classes.
__pydantic_parent_namespace__: Parent namespace of the model, used for automatic rebuilding of models.
__pydantic_post_init__: The name of the post-init method for the model, if defined.
__pydantic_root_model__: Whether the model is a [`RootModel`][pydantic.root_model.RootModel].
__pydantic_serializer__: The `pydantic-core` `SchemaSerializer` used to dump instances of the model.
__pydantic_validator__: The `pydantic-core` `SchemaValidator` used to validate instances of the model.

__pydantic_fields__: A dictionary of field names and their corresponding [`FieldInfo`][pydantic.fields.FieldInfo] objects.
__pydantic_computed_fields__: A dictionary of computed field names and their corresponding [`ComputedFieldInfo`][pydantic.fields.ComputedFieldInfo] objects.

__pydantic_extra__: A dictionary containing extra values, if [`extra`][pydantic.config.ConfigDict.extra]
    is set to `'allow'`.
__pydantic_fields_set__: The names of fields explicitly set during instantiation.
__pydantic_private__: Values of private attributes set on the model instance.
ignore_errors: Optional[list[str]]#

None

async bluesky_tiled_plugins.routers.validator.validate_entry_structure(entry, fix: bool, ignore_errors: Optional[list[str]] = None) tuple[bool, list[str]]#

Validate the structure of data sources in the given entry.

Parameters:

entry: Entry The entry whose data sources should be validated. fix: bool If True, attempt to correct any structural issues in the data sources. ignore_errors: list[str], optional A list of (parts of) error messages to ignore during validation. If an error message matches any in this list, it will be included in the notes, but the validation for the remaining data sources will continue.

Returns:

valid: bool True if all data sources are valid (or were successfully fixed), False otherwise. notes: list[str] A list of notes detailing any issues found and/or corrections made during validation. If valid is False, this list will contain descriptions of the validation failures.

async bluesky_tiled_plugins.routers.validator.validate_entry_reading(entry, ignore_errors=None)#

Validate that data can be read from all arrays and tables in the given entry.

Parameters

entry: Entry The entry whose data should be validated for reading. ignore_errors: list[str], optional A list of (parts of) error messages to ignore during validation. If an error message matches any in this list, it will be included in the notes, but the validation for the remaining data will continue.

async bluesky_tiled_plugins.routers.validator.get_validate_operation(path: str, request: fastapi.Request, fix: Optional[bool] = Query(False, description='Attempt to correct structure to match data.'), read: Optional[bool] = Query(False, description='Attempt to read data from each data source to validate access and integrity.'), settings: tiled.server.settings.Settings = Depends(get_settings), principal: Optional[tiled.server.schemas.Principal] = Depends(get_current_principal), root_tree=Depends(get_root_tree), session_state: dict = Depends(get_session_state), authn_access_tags: Optional[tiled.type_aliases.AccessTags] = Depends(get_current_access_tags), authn_scopes: tiled.type_aliases.Scopes = Depends(get_current_scopes), _=Security(check_scopes, scopes=['read:data', 'read:metadata', 'write:metadata']))#
async bluesky_tiled_plugins.routers.validator.post_validate_operation(path: str, body: bluesky_tiled_plugins.routers.validator.PostValidationRequest, request: fastapi.Request, fix: Optional[bool] = Query(False, description='Attempt to correct structure to match data.'), read: Optional[bool] = Query(False, description='Attempt to read data from each data source to validate access and integrity.'), settings: tiled.server.settings.Settings = Depends(get_settings), principal: Optional[tiled.server.schemas.Principal] = Depends(get_current_principal), root_tree=Depends(get_root_tree), session_state: dict = Depends(get_session_state), authn_access_tags: Optional[tiled.type_aliases.AccessTags] = Depends(get_current_access_tags), authn_scopes: tiled.type_aliases.Scopes = Depends(get_current_scopes), _=Security(check_scopes, scopes=['read:data', 'read:metadata', 'write:metadata']))#