AshTypescript.Rpc.FieldProcessing.FieldSelector.Validation (ash_typescript v0.17.2)

Copy Markdown View Source

Field validation helpers for the FieldSelector module.

Provides validation functions for checking field selections are valid and properly structured.

Summary

Functions

Checks for duplicate field names in a field selection list.

Validates that nested fields are non-empty for fields that require selection.

Functions

check_for_duplicates(fields, path)

Checks for duplicate field names in a field selection list.

Normalizes field names using the input formatter before checking for duplicates. Throws {:duplicate_field, field_name, path} if duplicates are found.

validate_field_exists!(field_name, field_specs, path, error_type \\ "field_constrained_type")

Validates that a field exists in the given field specs.

Throws {:unknown_field, field_name, error_type, path} if not found.

validate_non_empty(nested_fields, field_name, path, error_type \\ :relationship)

Validates that nested fields are non-empty for fields that require selection.

Throws appropriate errors if validation fails.