问题标签 [plumatic-schema]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
64 浏览

clojure - 棱柱形/模式需要关键依赖?

我在我的compojure-api中使用plumatic/schema来验证端点的输入。

我的架构中有两个键:Field1& Field2。我希望能够为我的模式定义一个规则,例如:

但是,我似乎只能将密钥设置为必需或可选。是否可以使密钥依赖于另一个密钥?

0 投票
0 回答
52 浏览

clojure - Where do you pass the :ignore-missing-mapping? keyword in reitit swagger to ignore unconvertable schemas?

I've been following the ring-swagger server.clj example to set my own http server but with prismatic/schema coercion.

Everything works just fine when my leafs are of basic type such as s/Str or s/Int, but I can't get it to work with (s/pred pos-int?) for example.

Every time I try to get the server's swagger API page, an error is thrown:

I understand I should be using the :ignore-missing-mapping? true setting from the ring-swagger documentation but I have no idea where do I pass that.

I'm using reitit v0.5.12, and I see that inside reitit-schema, the settings I pass from my router definition are not passed to the schema-tools ns functions when I pass the :coercion reitit.coercion.schema/coercion coercion: https://github.com/metosin/reitit/blob/master/modules/reitit-schema/src/reitit/coercion/schema.cljc#L52

I'm not sure how can I setup a prismatic-schema to work with swagger, besides constricting myself to only use plain schemas leafs such as s/Int, s/Str, etc.

0 投票
1 回答
136 浏览

prisma - 两个棱镜模型之间的一对多和可能对多关系

我正在做一个附带项目,但遇到了一个我不知道如何解决的问题。我创建了两个模型,一个用于用户,一个用于项目。它们之间的关系是多对多的,因为很多用户可以有很多项目,但我也想在 Project 模型中添加 createdBy,这应该是一对一的,因为每个项目只能有一个用户谁创造了它。这就是我的模型的外观:

从 prisma migrate dev 得到的错误是

步骤 1 将所需列添加userIdProject表中,但没有默认值。此表有 2 行,无法执行此步骤。

不确定我做错了什么,因为我几乎是一个数据库建模新手。任何帮助,将不胜感激。

0 投票
1 回答
19 浏览

prisma - 棱镜:模型和关系 1-n

我有两个表UserTasks一个用户可以有很多任务,但是我想要一个查询来返回一个特定的任务,获取任务的详细信息,作者并从用户表中分配给用户,通常会使用别名来完成。数据库是 mysql - 谢谢

接口:

期望的回应: