Skip to content

ontocast.cli.http_responses

JSON error bodies for HTTP routes (keeps FastAPI handlers thin).

missing_fixed_catalog_ontology_id_response()

400 when ontology_context_mode is fixed_single_ontology but id is absent.

Source code in ontocast/cli/http_responses.py
def missing_fixed_catalog_ontology_id_response() -> JSONResponse:
    """400 when ontology_context_mode is fixed_single_ontology but id is absent."""
    return JSONResponse(
        status_code=400,
        content=StatusErrorBody(
            error=(
                "ontology_context_mode=fixed_single_ontology requires "
                "non-empty ontology_context_fixed_ontology_id (query, form field, or JSON)."
            ),
            error_type="ValidationError",
        ).model_dump(),
    )