fairdm.api.checks#
System checks on how registered types appear in the API.
Module Contents#
Functions#
Return the required model fields the type’s API serializer cannot accept. |
|
Report fairdm.E600 for each required field a registered type’s API cannot accept. |
API#
- required_fields_left_out(config) list[str][source]#
Return the required model fields the type’s API serializer cannot accept.
A field is required when it is editable, is not filled in by the database and may be neither blank nor null. The serializer accepts it when it has a writable field reading that model field.
Args: config: The registered type’s :class:
~fairdm.registry.ModelConfiguration.Returns: The names of the required model fields no writable serializer field covers.
- check_registered_types(app_configs, **kwargs) list[django.core.checks.CheckMessage][source]#
Report fairdm.E600 for each required field a registered type’s API cannot accept.
Without such a field no record of the type can be created through the API, and the caller would learn it only from the first failed request.
Args: app_configs: Unused; the registry is not tied to one app. **kwargs: Unused.
Returns: One error for each required field a sample or measurement type leaves out.