normalize_scopes#

gafaelfawr.util.normalize_scopes(v)#

Pydantic validator for scope fields.

Scopes are stored in the database as a comma-delimited, sorted list. Convert to the list representation we want to use in Python, preserving None.

Parameters:

v (str | list[str] | None) – The field representing token scopes.

Returns:

The scopes as a list.

Return type:

list of str or None