labthings_fastapi.thing_description.validation ============================================== .. py:module:: labthings_fastapi.thing_description.validation .. autoapi-nested-parse:: Validate a generated Thing Description against the W3C schema. We generate :ref:`wot_td` using `pydantic` models so there is a layer of validation applied every time one is created. However, this module allows the generated JSON document to be formally validated against the schema in the W3C specification, as an additional check. See :ref:`wot_td` for a link to the specification in human-readable format. Functions --------- .. autoapisummary:: labthings_fastapi.thing_description.validation.validate_thing_description Module Contents --------------- .. py:function:: validate_thing_description(td: dict) -> None Validate a Thing Description. This accepts a dictionary (usually generated from `labthings_fastapi.thing_description._model.ThingDescription.model_dump()` ) and validates it against the JSON schema for Thing Descriptions. This is obtained from the W3C's Thing Description repository on GitHub, URL in the file. No return value is provided, but a `~jsonschema.exceptions.ValidationError` is raised if the schema is invalid. :param td: the Thing Description to be validated. :raise jsonschema.exceptions.ValidationError: if the Thing Description is invalid.