Questions tagged [plumatic-schema]

A Clojure(Script) library for declarative data description and validation. Originally known as Prismatic-Schema.

A Clojure(Script) library for declarative data description and validation.

Schema enables Clojure developers to neatly specify the form of function inputs and outputs in the function metadata. This allows the library to explain and validate a function's usage, regardless of the complexity of data types.

62 questions
3
votes
3 answers

Using Prismatic/schema for form validation with Liberator

Is Prismatic/schema a good fit for form validation? I have never designed a form validation lib before, but I imagine it outputting something like this instead of throwing exceptions on s/validate: {::errors {:name [{:missing "Required field."} …
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287
3
votes
1 answer

Function validation using Prismatic/schema in Clojure

I have a very simple question about using Prismatic/schema to validate functions. I have a schema for a map that has a single key, the value of which is a function that takes a Bar schema as its single argument and returns anything (used for side…
Josh Glover
  • 25,142
  • 27
  • 92
  • 129
3
votes
1 answer

Validating multiple polymorphic values using Prismatic Schema

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 …
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
2
votes
1 answer

How to create Categories and its SubCategory in Prisma ORM using MongoDB

type Category { id: ID! @id name: String! } type SubCategoryLevel1 { id: ID! @id name: String! parentCategory: Category! @relation(link: INLINE) } type SubCategoryLevel2 { id: ID! @id name: String! parentCategory:…
Rohan Shukla
  • 533
  • 1
  • 4
  • 16
2
votes
1 answer

Schema with a min and max limit?

Is it possible to add a min and max limit to the following schema? I would like schema to throw an exception when Number is < 0 and > 100. (def Number schema/Int)
Freid001
  • 2,580
  • 3
  • 29
  • 60
2
votes
0 answers

Use of prismatic schema =>

What is the intended use of the => macro? https://github.com/plumatic/schema/blob/master/src/cljx/schema/core.cljx#L1077-L1091 It seems to pass as long as a function is passed, for instance: (s/defschema MySchema s/Int) (def a (s/=> MySchema…
nha
  • 17,623
  • 13
  • 87
  • 133
2
votes
0 answers

Using Prismatic Schema and Core.Typed at the same time?

I'm experimenting with these two libraries. I am able to use one or the other on their own, but when I try to use both at the same time (i.e., in the same file) I get an extremely large console error that complains about numerous prismatic schema…
George
  • 6,927
  • 4
  • 34
  • 67
2
votes
0 answers

Polymorphic Schemas in Clojure

I want to create polymorphic schemas/types, and I'm curious of best practices. The following 2 examples allow me to create a Frequency schema which can repeat an event monthly by day of month, or monthly by day of week (eg, every 15th, or every…
Josh.F
  • 3,666
  • 2
  • 27
  • 37
2
votes
1 answer

Check specifically for vector in a matrix Clojure's Schema

In my program, I'm using a kind of matrix (as a vector of vectors) like this one: [[:lt :lt :gt :eq] [:eq :lt :gt :eq] [:eq :eq :gt :gt] [:un :eq :lt :lt]] I have a schema for it, declared as: (def OrderMatrix [[(s/enum :lt :eq :gt :un)]] What…
Setzer22
  • 1,589
  • 2
  • 13
  • 29
2
votes
1 answer

(Prismatic) Plumatic Schema Documentation

I have been looking at using prismatic/schema for typing and documentation in clojure, but I have had trouble finding thorough documentation for it. The github readme provides some helpful basic usage information but leaves me with a lot of open…
pdiffley
  • 603
  • 9
  • 18
2
votes
1 answer

Why does the validation fail (ExceptionInfo Value does not match schema) for a prismatic schema using onyx?

Can someone throw light on whats going on here ? I have double checked dynamodb-local behavior using a non-onyxian client and simple operations work using Faraday . The code which I am trying to run is here and I have logged an issue here but…
ZeroGraviti
  • 1,047
  • 2
  • 12
  • 28
2
votes
1 answer

Prismatic Schema on Clojure 1.4?

We are evaluating Prismatic/schema for use on a project that is currently using Clojure 1.4. We would prefer not to upgrade Clojure in our project at this time. Schema requires Clojure 1.5.1, but some basic testing in the repl did not show any…
mattexx
  • 6,456
  • 3
  • 36
  • 47
1
vote
1 answer

create prisma many to many relation and one of the fields is from another table

I have a prisma schema with products, orders, and a many-to-many relation between them. I want to store the product price in the relation table because the product price can change at any time and when retrieving order data, I need the product price…
1
vote
1 answer

Room management system in Prisma

I tried to create a database for a room management sytem and I'm confused about the relations and couldn't find helpful resources on the internet can you tell me if there is anything wrong with this prisma script? as I want to control it in…
MoLeo
  • 11
  • 1
1
vote
1 answer

Count or Include filtered relations prisma

I am currently stuck on a problem with my prisma queries. I have an asset which has a 1 to Many relationship to views. I am trying to perform a findMany() on assets which returns either; The asset with a list of views created within the last day Or…
Luke
  • 19
  • 1