json-tools/json-schema

Decode json into elm using schema

1602 opened this issue · 3 comments

1602 commented

It might be useful to use json schema in place of traditional decoders in some cases. This is research and not development.

Conclusion?

1602 commented

@jpierson the conclusion: JSON Schema doesn't have a sufficient amount of information to be decoded into elm values. It will work in limited cases for example if you have flat object which consists of strings, numbers, booleans, or list of primitives. Union types, tuples and more fluffy structures is a big obstacle here. Dealing with those would mean having additional abstraction level on top of JSON Schema, so traditional decoders would be a nicer solution in this case (less complexity involved).

It might worth reopening this later though, if there will be more interest in the future. Speaking frankly I just struggle to find a good enough use-case for this, hence it doesn't worth any more time invested in this research.