Pax8API/Private/Get-Pax8SchemaCatalog.ps1

function Get-Pax8SchemaCatalog {
    [CmdletBinding()]
    param ()

    if (-not $script:Pax8SchemaCatalog) {
        $schemaPath = Join-Path -Path $script:Pax8ModuleRoot -ChildPath 'data/Pax8Schemas.json'
        if (-not (Test-Path -LiteralPath $schemaPath)) {
            throw "Pax8 schema catalog was not found. Regenerate the module to create '$schemaPath'."
        }

        $script:Pax8SchemaCatalog = Get-Content -LiteralPath $schemaPath -Raw | ConvertFrom-Json
    }

    $script:Pax8SchemaCatalog
}