Whether the field should be included in the generated JSON schema. Args: field: The schema for the field itself. Returns: `True` if the field should be included in the generated JSON schema, `False` otherwise.
(self, field: CoreSchemaField)
| 1747 | return json_schema |
| 1748 | |
| 1749 | def field_is_present(self, field: CoreSchemaField) -> bool: |
| 1750 | """Whether the field should be included in the generated JSON schema. |
| 1751 | |
| 1752 | Args: |
| 1753 | field: The schema for the field itself. |
| 1754 | |
| 1755 | Returns: |
| 1756 | `True` if the field should be included in the generated JSON schema, `False` otherwise. |
| 1757 | """ |
| 1758 | if self.mode == 'serialization': |
| 1759 | # If you still want to include the field in the generated JSON schema, |
| 1760 | # override this method and return True |
| 1761 | return not field.get('serialization_exclude') |
| 1762 | elif self.mode == 'validation': |
| 1763 | return True |
| 1764 | else: |
| 1765 | assert_never(self.mode) |
| 1766 | |
| 1767 | def field_is_required( |
| 1768 | self, |
no test coverage detected