3 ms·
These days all my needs for "structured data" start with JSON Schema. I refuse to work with schemaless apps and databases anymore. The workflow which I use for
by atombender 8y ago
These days all my needs for "structured data" start with JSON Schema. I refuse to work with schemaless apps and databases anymore.
The workflow which I use for one app is:
* Define a JSON Schema for all the app's models
* Generate static Go types from these definitions
* Generate corresponding GraphQL types and inputs in the Go app for serving the API
* Generate TypeScript types in JavaScript front ends against the same schema
* Same model structs in Go are used to shuffle data in and out of data stores
Since GraphQL is more limited than JSON Schema (for example, very limited union ("oneof") support), there are some features I'm not able to fully make use of, but the common denominator covers most use cases.
I love having end-to-end static typing, validation and consistency.