def filter_paths(openapi_schema: Dict[str, Any]) -> Dict[str, Any]:
    """Filter OpenAPI paths to only include allowed endpoints."""
    if "paths" not in openapi_schema:
        return openapi_schema

    filtered_paths = {}
    for path, path_item in openapi_schema["paths"].items():
        include_path = False
        filtered_operations = {}

        for method, operation in path_item.items():
            if method.lower() in ["get", "post", "put", "delete", "patch"] and is_included_endpoint(
                path, method
            ):
                filtered_operations[method] = operation
                include_path = True

        if include_path:
            filtered_paths[path] = filtered_operations

    openapi_schema["paths"] = filtered_paths
    return openapi_schema
Filter OpenAPI paths to only include allowed endpoints.
fern/scripts/generate_openapi.py