小编Jak*_*ski的帖子

Pydantic 在具有自定义模型的可选字段上返回“必需字段 (type=value_error.missing)”

我正在尝试在 Fastapi-users pydantic 架构中构建自定义字段,如下所示:

class UserRead(schemas.BaseUser[uuid.UUID]):
    twitter_account: Optional['TwitterAccount']
Run Code Online (Sandbox Code Playgroud)

在 UserRead 验证上 Pydantic 返回

field required (type=value_error.missing)
Run Code Online (Sandbox Code Playgroud)

'TwitterAccount' schema.update_forward_refs()最后调用每个字段。

TwitterAccount本身具有必填字段,并使它们可选并不是可接受的解决方法。我注意到我可以做到Optional[List['TwitterAccount']]并且会起作用,但这有点愚蠢。

python pydantic fastapi fastapiusers

10
推荐指数
1
解决办法
3万
查看次数

SBT installation error (module not found: org.scala-sbt.ivy#ivy;2.3.0-sbt-2cf13e211b2cb31f0d3b317289dca70eca3362f6)

I'm trying to install SBT. I went through few cycles of reinstalling SBT and JAVA, restarting pc and so on. Everything I was able to find in Google about similar issues seems to refer to later stages of using sbt.

I'm a complete newbie, so I might have missed something obvious along the way.

Here's what I do:

  1. I install SBT via msi installer.
  2. I run "sbt" in command prompt. This is command prompt window (I manually broke all the …

scala sbt

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

如何在 Tortoise-ORM 中使用 Postgresql 数组字段

几乎如标题所示,我正在尝试设置 Tortoise-ORM 模型,其中包含与 Postgresql 数组列相对应的字段。

似乎要正确地做到这一点,我需要从 asyncpg (因为它具有完整的数组支持)向上扩展 Tortoise Field 进行构建。然而,我刚刚开始使用乌龟,也许有一些更好/更简单的方法/有人已经做了类似的事情。

python postgresql asyncpg tortoise-orm

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