plumatic-schema

Validating multiple polymorphic values using Prismatic Schema

亡梦爱人 提交于 2019-12-23 19:39:44
问题 A little while ago I asked about simple polymorphic schemas, and the answer there worked well for a time. Now the map I wish to validate has an additional value which is dependent upon another key's value. A contrived example of the object: {:type :foo {:type :bert {:type :foo :foo-param :bar :bert-size :medium :foo-param :bar :method :baz :method :baz :method :bang :baz-rate :max} :baz-rate :max} :bangness :considerable} The discriminators here are :type and :method , each of which has its

Non-required arguments in compojure-api/schema/swagger?

我与影子孤独终老i 提交于 2019-12-07 02:57:43
问题 When I have a definition of an API like this: (POST* "/register" [] :body-params [username :- String, password :- String, name :- String] (ok))) what's the appropriate way of making name optional? Is it: (POST* "/register" [] :body-params [username :- String, password :- String, {name :- String nil}] (ok))) 回答1: As you know it uses letk plumbing notation and as far as I recall the syntax is correct but the default value should be consistent with the expected type so I'd say it should be ""

Non-required arguments in compojure-api/schema/swagger?

时光总嘲笑我的痴心妄想 提交于 2019-12-05 08:05:37
When I have a definition of an API like this: (POST* "/register" [] :body-params [username :- String, password :- String, name :- String] (ok))) what's the appropriate way of making name optional? Is it: (POST* "/register" [] :body-params [username :- String, password :- String, {name :- String nil}] (ok))) As you know it uses letk plumbing notation and as far as I recall the syntax is correct but the default value should be consistent with the expected type so I'd say it should be "" rather than nil as (string? nil) => false (POST* "/register" [] :body-params [username :- String, password :-

Prisma data modeling has many and belongs to

被刻印的时光 ゝ 提交于 2019-12-02 01:57:45
I have a prisma data model that consists of a root Category and a Subcategory. A Category has many Subcategories and a Subcategory belongs to one Category. My model looks like this: type Category { id: ID! @unique createdAt: DateTime! updatedAt: DateTime! name: String! subCategories: [SubCategory!]! @relation(name: "Subcategories") } type SubCategory { id: ID! @unique createdAt: DateTime! updatedAt: DateTime! name: String! category: Category! @relation(name: "ParentCategory") cards: [Card!]! @relation(name: "SubCategoryCards") #Category @relation(name: "CardCategory") } Now when i go to create