Table of Contents

Class PolicyParser

Namespace
JD.AI.Core.Governance
Assembly
JD.AI.Core.dll

Parses YAML policy documents into PolicyDocument instances.

public static class PolicyParser
Inheritance
PolicyParser
Inherited Members

Methods

Parse(string)

Parses a YAML string into a PolicyDocument.

public static PolicyDocument Parse(string yaml)

Parameters

yaml string

YAML content to parse.

Returns

PolicyDocument

The parsed PolicyDocument.

Exceptions

YamlException

Thrown when the YAML is invalid.

ParseDirectory(string)

Parses all .yaml and .yml files in a directory into PolicyDocument instances. Files that fail to parse are skipped silently.

public static IEnumerable<PolicyDocument> ParseDirectory(string dirPath)

Parameters

dirPath string

Directory to search for policy files.

Returns

IEnumerable<PolicyDocument>

Enumerable of successfully parsed documents.

ParseFile(string)

Reads and parses a YAML file into a PolicyDocument.

public static PolicyDocument ParseFile(string path)

Parameters

path string

Absolute path to the YAML file.

Returns

PolicyDocument

The parsed PolicyDocument.