小编Myu*_*Hun的帖子

pydantic无法区分整数和字符串

from pydantic import BaseModel


class AuthenticationResponseSchema(BaseModel):
    type: str
Run Code Online (Sandbox Code Playgroud)
schema = AuthenticationResponseSchema(type=1)
Run Code Online (Sandbox Code Playgroud)

现在我正在将 marshmallow 更改为 pydantic 的架构、模型......

type但 pydantic 模式在数据响应时未进行验证。

的数据类型type是字符串,但也传递了整数。

怎么了?

谢谢。

python validation marshmallow pydantic

5
推荐指数
1
解决办法
9308
查看次数

如何在 PhpStorm 中的变量和运算符之间留出空间?

我使用的是 Mac 和 Windows,但代码重新格式化在 Mac 和 Windows 上的工作方式不同。

在 Mac 上

return response()->json([
    'access_token' => $jwtToken,
    'token_type'   => 'bearer',
    'expires_in'   => Auth::guard()->factory()->getTTL() * 60
]);
Run Code Online (Sandbox Code Playgroud)

在 Windows 上

return response()->json([
    'access_token' => $jwtToken,
    'token_type' => 'bearer',
    'expires_in' => Auth::guard()->factory()->getTTL() * 60
]);
Run Code Online (Sandbox Code Playgroud)

我想像在 Mac 上一样重新格式化代码。

如何调整代码重新格式化规则?

reformat phpstorm

2
推荐指数
1
解决办法
76
查看次数

标签 统计

marshmallow ×1

phpstorm ×1

pydantic ×1

python ×1

reformat ×1

validation ×1