cryogen-project / cryogen-core

Cryogen's core
Eclipse Public License 1.0
69 stars 62 forks source link

Config validation #89

Closed nbardy closed 7 years ago

nbardy commented 7 years ago

Added some tests and testing, but it could definitely use a little more.

The code has some inconsistencies between using nil values and missing keys in options maps. The schema could be made clearer if this was standardized.

https://github.com/cryogen-project/cryogen-core/issues/88

lacarmen commented 7 years ago

Comments not related to the code review:

Another thing that I would change is to have separate MetaData schemas for pages and posts since not all keys are shared between them (home? and navbar?, for example). However, this requires reworking how post/page content is read so I'm okay with leaving this one for later.

I agree there are some weird inconsistencies with how nils/missing keys are dealt with. These ones I can consolidate on my own.

jerger commented 7 years ago

Great work :-) Have you ever looked at (schema/defn ^:always-validate ...) ?

This would allow to validate parameters & result of a function - you will need no additional (schema/validate ...).

Usage is:

(schema/defn ^:always-validate 
    fn-name :- result-schema
    "doc-string"
    [param1 :- param1-schema
     ...]
) 
lacarmen commented 7 years ago

Hey @nbardy are you still working on this?

lacarmen commented 7 years ago

Going to merge this to keep things moving along. I'll make the requested changes myself.