|
|
@ -280,7 +280,7 @@ if PYDANTIC_V2: |
|
|
|
) -> Dict[str, Any]: |
|
|
|
error = ValidationError.from_exception_data( |
|
|
|
"Field required", [{"type": "missing", "loc": loc, "input": {}}] |
|
|
|
).errors(include_url=include_error_url)[0] |
|
|
|
).errors(include_input=include_error_input, include_url=include_error_url)[0] |
|
|
|
if include_error_input: |
|
|
|
error["input"] = None |
|
|
|
return error # type: ignore[return-value] |
|
|
@ -520,18 +520,10 @@ else: |
|
|
|
def serialize_sequence_value(*, field: ModelField, value: Any) -> Sequence[Any]: |
|
|
|
return sequence_shape_to_type[field.shape](value) # type: ignore[no-any-return,attr-defined] |
|
|
|
|
|
|
|
def get_missing_field_error( |
|
|
|
loc: Tuple[str, ...], |
|
|
|
include_error_input: bool = True, |
|
|
|
include_error_url: bool = False, |
|
|
|
) -> Dict[str, Any]: |
|
|
|
def get_missing_field_error(loc: Tuple[str, ...]) -> Dict[str, Any]: |
|
|
|
missing_field_error = ErrorWrapper(MissingError(), loc=loc) # type: ignore[call-arg] |
|
|
|
new_error = ValidationError([missing_field_error], RequestErrorModel).errors( |
|
|
|
include_url=include_error_url |
|
|
|
)[0] |
|
|
|
if include_error_input: |
|
|
|
new_error["input"] = None |
|
|
|
return new_error # type: ignore[return-value] |
|
|
|
new_error = ValidationError([missing_field_error], RequestErrorModel) |
|
|
|
return new_error.errors()[0] # type: ignore[return-value] |
|
|
|
|
|
|
|
def create_body_model( |
|
|
|
*, fields: Sequence[ModelField], model_name: str |
|
|
|