# SPDX-FileCopyrightText: 2025 ash_neo4j contributors # # SPDX-License-Identifier: MIT defmodule AshNeo4j.Verifiers.VerifyLabelPascalCase do @moduledoc "Verifies that the label is PascalCase" use Spark.Dsl.Verifier alias Spark.Dsl.Verifier alias Spark.Error.DslError import AshNeo4j.Util @impl true def verify(dsl) do resource = Verifier.get_persisted(dsl, :module) module = String.to_atom(List.last(Module.split(resource))) label = Verifier.get_option(dsl, [:neo4j], :label, module) cond do label == nil -> {:error, DslError.exception( module: resource, message: "label: missing" )} is_valid_node_label?(label) -> :ok true -> {:error, DslError.exception( module: resource, message: "label: neo4j label must be PascalCase" )} end end end