go-helpers
myzod
go-helpers | myzod | |
---|---|---|
1 | 5 | |
5 | 294 | |
- | - | |
5.6 | 5.6 | |
8 months ago | 5 months ago | |
Go | TypeScript | |
GNU General Public License v3.0 or later | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
go-helpers
-
JSON Schema bundling finally formalised
```
The "IsInteger" validator can of course be interpreted as a type, the important thing is though that it can be customized using type parameters and that we can add any number of additional validators that do advanced things (e.g. we could define an "IsPrime" validator that checks for primality of the number).
I find this more elegant than having both a "type" field and various extensions for validations that you need to remember. The validator list mechanism also makes it easy to chain validations and perform sub-validations for lists or maps. I have an open-source implementation of this written in Golang [1] that I use in all my projects. It enables me to write a form specification and a Go struct and validate as well as coerce unstructured data into the struct. It makes it very easy to validate complex, hierarchical documents like configuration files as well, is easy to extend and provides nice errors.
1: https://github.com/kiprotect/go-helpers/tree/master/forms
myzod
-
Good replacements for Zod, preferably with a similar API/interface?
if you only need to validate JSON type objects (I.e no functions, classes, instanceof) I like myzod https://github.com/davidmdm/myzod
-
Making the Jump; favorite 23' resources for TS + Node.js
zod Or alternatively myzod
-
TypeScript schema validation with Zod
I use myzod (https://github.com/davidmdm/myzod) but assuming it’s similar, you write your models / interfaces with the tool, and it produces both your models/interface types AND a runtime validation function for them. So, if you want to adopt, you will need to convert your existing interfaces, but imho it’s quite worthwhile for many use cases.
-
JSON Schema bundling finally formalised
If you like zod, you should check out myzod: https://github.com/davidmdm/myzod
What are some alternatives?
ajv - The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)
zod - TypeScript-first schema validation with static type inference
schema-org-json-schemas - Generate JSON Schemas from Schema.org classes
openapi-preprocessor - An authoring tool for OpenAPI specifications
io-ts - Runtime type system for IO decoding/encoding
runtypes - Runtime validation for static types
typescript-json-schema - Generate json-schema from your Typescript sources