malli

Andrew Leverette 2025-03-08T14:59:10.932659Z

I'm using malli for the first time and I'm confused about what schema types are available. Specifically, I'm not sure if I can use :inst or I have to use inst? in the schema. For example, this works:

(def DocumentMetadata
  [:map
   [:value_data_type {:description "The data type of the value"} :string]
   [:attribute_definition_id {:description "The UUID of the attribute definition"} :uuid]
   [:attribute_value {:description "The value of the attribute"} :string]
   [:created_at {:description "The date and time the document metadata was created"} inst?]
   [:updated_at {:description "The date and time the document metadata was updated"} inst?]])
but this doesn't
(def DocumentMetadata
  [:map
   [:value_data_type {:description "The data type of the value"} :string]
   [:attribute_definition_id {:description "The UUID of the attribute definition"} :uuid]
   [:attribute_value {:description "The value of the attribute"} :string]
   [:created_at {:description "The date and time the document metadata was created"} :inst]
   [:updated_at {:description "The date and time the document metadata was updated"} :inst]])

Andrew Leverette 2025-03-08T15:03:04.026859Z

I've seen documentation that suggests that :inst is a valid schema syntax, but it doesn't work.

valtteri 2025-03-08T15:36:43.400109Z

Here's the list of built-in schemas that should work out of the box: https://github.com/metosin/malli?tab=readme-ov-file#built-in-schemas Note: inst? is there, but a keyword schema :inst does not exist.

escherize 2025-03-08T17:25:32.608559Z

There’s also a time schema pack that you can add to your registry. I think it’s in the readme too