小编Mat*_*w P的帖子

jsPDF + Autotable - 在每行下添加行

是否可以在 jspd-autotable 的每一行下添加一行?即不是每个单元格周围都有边框,只是每个单元格的底部边框。

jspdf jspdf-autotable

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

使用数字作为GraphQL架构中的键?

您可以使用GraphQL架构语言将数字用作GraphQL架构中的键吗?即(这是一个小片段...)

type tax_code_allocation_country_KOR_states {
  "11": tax_code_allocation_state_tax_query
  "26": tax_code_allocation_state_tax_query
  "27": tax_code_allocation_state_tax_query
}
Run Code Online (Sandbox Code Playgroud)

或以下内容,我意识到这是错误的JSON:

type tax_code_allocation_country_KOR_states {
  11: tax_code_allocation_state_tax_query
  26: tax_code_allocation_state_tax_query
  27: tax_code_allocation_state_tax_query
}
Run Code Online (Sandbox Code Playgroud)

graphql apollo-server

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

GraphQL中的可选但非空字段

在更新我们的GraphQL API时,仅_id需要model 字段,因此!在下面的SDL语言代码中。其他字段(例如,name不必包含在更新中)也不能具有null值。当前,!从名称字段中排除namein 允许最终用户不必在更新中传递in,但允许最终用户传递in的nullname,这是不允许的。

一个null值使我们知道需要从数据库中删除一个字段。

下面是一个可能导致问题的模型示例- Name自定义标量不允许空值,但GraphQL仍允许它们通过:

type language {
  _id: ObjectId
  iso: Language_ISO
  auto_translate: Boolean
  name: Name
  updated_at: Date_time
  created_at: Date_time
}
input language_create {
  iso: Language_ISO!
  auto_translate: Boolean
  name: Name!
}
input language_update {
  _id: ObjectId!
  iso: Language_ISO!
  auto_translate: Boolean
  name: Name
}
Run Code Online (Sandbox Code Playgroud)

当传入null值时,它会绕过我们的Scalars,因此如果null不是允许的值,我们就不会引发用户输入验证错误。

我知道这!意味着non-nullable,并且缺少!手段意味着该字段可为空,但是令人沮丧的是,据我所知,如果某个字段不是必需的/可选的,我们无法为该字段指定确切的值。仅在更新时会发生此问题。

有什么方法可以通过自定义Scalars解决此问题,而不必在每个更新解析器中启动硬编码逻辑,而这似乎很麻烦?

可能失败的示例变异

mutation tests_language_create( $input: language_update! ) { …
Run Code Online (Sandbox Code Playgroud)

node.js graphql graphql-js apollo-server

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