Skip to content

core.checks

Overview

System checks validating VUEDA serializer configuration and model feature policy.

_get_registered_serializer_classes

Return the canonical serializer classes held in vueda.info's registry.

Covers registrations made through both register() and register_serializer(). A serializer registered for metadata alone has no route of its own, so walking the URL conf never reaches it.

Signature

_get_registered_serializer_classes()

Source

server/vueda/core/checks.py:195

_get_routed_serializer_classes

Return the serializer classes used by ViewSets registered with a router, anywhere in the URL conf.

Walking the resolved URL conf (rather than vueda.info's registry) means this covers any DRF ViewSet with a router route, not just ones registered with VUEDA's meta-info system -- the expandable_fields format being validated comes from rest_flex_fields, not VUEDA.

Signature

_get_routed_serializer_classes()

Source

server/vueda/core/checks.py:166

_get_seed_serializer_classes

Return the serializer classes graph traversal starts from.

The seed is the union of routed ViewSet serializers and vueda.info registrations, routed ones first, with duplicates dropped. A serializer that is both routed and registered appears once.

Signature

_get_seed_serializer_classes()

Source

server/vueda/core/checks.py:206

_iter_expandable_fields

Yield (field_name, field_data) for each Meta.expandable_fields entry of serializer_class.

Signature

_iter_expandable_fields(serializer_class)

Parameters

NameTypeRequiredDescription
serializer_classyes

Source

server/vueda/core/checks.py:129

_iter_nested_serializer_fields

Yield (field_name, child_serializer_class) for each declared field of serializer_class that is (or, for a many=True declaration, wraps via ListSerializer.child) another serializer.

Uses the class-level _declared_fields collected by SerializerMetaclass, so nothing needs to be instantiated (and therefore no view needs to be in context) to inspect it.

Signature

_iter_nested_serializer_fields(serializer_class)

Parameters

NameTypeRequiredDescription
serializer_classyes

Source

server/vueda/core/checks.py:136

_iter_serializer_graph

Yield every serializer class reachable from the seed, once each.

Traversal follows declared nested serializer fields and Meta.expandable_fields entries. Both serializer system checks walk this one graph, so they cover the same serializers and cannot drift apart on discovery.

Signature

_iter_serializer_graph()

Source

server/vueda/core/checks.py:215

_resolve_expandable_field_serializer_class

Best-effort resolve an expandable_fields entry to its serializer class.

Structural validity (tuple shape, resolvable strings, etc.) is check_expandable_fields_configuration's job; this simply returns None when the entry can't be resolved to a class, so the caller can skip it.

Signature

_resolve_expandable_field_serializer_class(field_data)

Parameters

NameTypeRequiredDescription
field_datayes

Source

server/vueda/core/checks.py:149

_resolve_lazy_serializer_string

Resolve a flex-fields lazy serializer string, using flex-fields' own resolver.

Returns (resolved_class, None) on success, or (None, error_message) if the string does not resolve to an importable class.

Signature

_resolve_lazy_serializer_string(lazy_path)

Parameters

NameTypeRequiredDescription
lazy_pathyes

Source

server/vueda/core/checks.py:12

_unwrap_expandable_field

Split an expandable_fields value into (field_serializer, expand_options).

An empty tuple carries no serializer, so it unwraps to None. _validate_expandable_field reports it as a malformed entry before it reaches here; graph traversal skips it.

Signature

_unwrap_expandable_field(field_data)

Parameters

NameTypeRequiredDescription
field_datayes

Source

server/vueda/core/checks.py:25

_validate_expandable_field

Validate a single expandable_fields entry.

Returns (errors, resolved_serializer). resolved_serializer is the class the entry ultimately points at (after unwrapping any tuple/lazy string), so the caller can recurse into it, or None if the entry is invalid.

Signature

_validate_expandable_field(serializer_class, field_name, field_data)

Parameters

NameTypeRequiredDescription
serializer_classyes
field_nameyes
field_datayes

Source

server/vueda/core/checks.py:39

check_exclude_fields_serializer_usage

ExcludeFieldsSerializerMixin.get_extra_kwargs() reads self.context["view"].action. A view is only ever present in context when the serializer is a routed ViewSet's serializer_class directly -- never when it is reached as a nested field, an expandable_fields entry, or a register_serializer() (viewset-less) registration. Those uses raise a bare KeyError: 'view' from manage.py spectacular (and from the /info/ meta-API), since the serializer is instantiated without a view in its context.

Signature

check_exclude_fields_serializer_usage(app_configs, kwargs)

Parameters

NameTypeRequiredDescription
app_configsyes
kwargsyes

Source

server/vueda/core/checks.py:255

check_expandable_fields_configuration

Validate every Meta.expandable_fields entry in the discovered serializer graph.

Signature

check_expandable_fields_configuration(app_configs, kwargs)

Parameters

NameTypeRequiredDescription
app_configsyes
kwargsyes

Source

server/vueda/core/checks.py:243

check_model_feature_declaration

Validate one model's class Vueda declaration and its resolved values.

Signature

check_model_feature_declaration(model)

Parameters

NameTypeRequiredDescription
modelyes

Source

server/vueda/core/checks.py:328

check_model_feature_policy

Report every fault in the class Vueda feature policy of the installed models.

Resolution itself never raises, so an unknown section, an unknown option, an invalid value, a section whose feature app is absent, or a declaration on a proxy surfaces here rather than as an import error while Django loads models.

Signature

check_model_feature_policy(app_configs, kwargs)

Parameters

NameTypeRequiredDescription
app_configsyes
kwargsyes

Source

server/vueda/core/checks.py:353

Source

server/vueda/core/checks.py

Documents matching: server v3.0.0a1.post1client v3.0.0-alpha.2