(field: ModelField, schema_overrides: bool = False)
| 198 | |
| 199 | |
| 200 | def get_field_info_schema(field: ModelField, schema_overrides: bool = False) -> Tuple[Dict[str, Any], bool]: |
| 201 | # If no title is explicitly set, we don't set title in the schema for enums. |
| 202 | # The behaviour is the same as `BaseModel` reference, where the default title |
| 203 | # is in the definitions part of the schema. |
| 204 | schema_: Dict[str, Any] = {} |
| 205 | if field.field_info.title or not lenient_issubclass(field.type_, Enum): |
| 206 | schema_['title'] = field.field_info.title or field.alias.title().replace('_', ' ') |
| 207 | |
| 208 | if field.field_info.title: |
| 209 | schema_overrides = True |
| 210 | |
| 211 | if field.field_info.description: |
| 212 | schema_['description'] = field.field_info.description |
| 213 | schema_overrides = True |
| 214 | |
| 215 | if not field.required and field.default is not None and not is_callable_type(field.outer_type_): |
| 216 | schema_['default'] = encode_default(field.default) |
| 217 | schema_overrides = True |
| 218 | |
| 219 | return schema_, schema_overrides |
| 220 | |
| 221 | |
| 222 | def field_schema( |
no test coverage detected