Files
OpenShell/python/openshell/policy.py
Piotr Mlocek aca0575a50 feat(policy)!: finalize public policy protobuf contract
BREAKING CHANGE: Policy YAML and public policy APIs now use the protobuf-shaped openshell.policy.v1.PolicyDocument contract.

Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
2026-09-19 00:19:16 -07:00

19 lines
557 B
Python

# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""Validation helpers for the public authored policy contract."""
from __future__ import annotations
import protovalidate
from ._proto import policy_pb2
PolicyDocument = policy_pb2.PolicyDocument
def validate_policy_document(document: PolicyDocument) -> PolicyDocument:
"""Validate a policy against the portable rules declared in policy.proto."""
protovalidate.validate(document)
return document