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是字符串,但也传递了整数。
怎么了?
谢谢。
我使用的是 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 上一样重新格式化代码。
如何调整代码重新格式化规则?