buffalo_wings.airfoil.validate_file_airfoil_source

buffalo_wings.airfoil.validate_file_airfoil_source(spec)[source]

Validate a file-backed airfoil source and its referenced contents.

Parameters:

spec (FileAirfoilSpec) – File-backed airfoil schema object describing the source path and expected or auto-detected file format.

Returns:

Validation result containing structured diagnostics for file-spec errors, read failures, detected format metadata, and content validation problems localized to file-source payload paths.

Return type:

AirfoilValidationResult

Notes

This workflow first validates the outer FileAirfoilSpec and then validates the referenced file contents when the file can be read. Diagnostics may include informational entries, such as auto-detected file format, in addition to error diagnostics.

Examples

>>> from pathlib import Path
>>> import tempfile
>>> import buffalo_wings.airfoil as bwa
>>> with tempfile.TemporaryDirectory() as tmp_dir:
...     file_path = Path(tmp_dir) / "airfoil.json"
...     _ = file_path.write_text(
...         (
...             '{"format": "upper_lower", '
...             '"upper": [[0.0, 0.0], [1.0, 0.0]], '
...             '"lower": [[0.0, 0.0], [1.0, 0.0]]}'
...         ),
...         encoding="utf-8",
...     )
...     result = bwa.validate_file_airfoil_source(
...         bwa.FileAirfoilSpec(path=str(file_path), format="auto")
...     )
>>> result.diagnostics.has_infos
True