Hi,
and thanks for the quick response. Having a tool to create differently conforming (json/string/no-op) specs from arbitrary raw specs seems like a valid and performant option for the runtime.
About reading the existing specs: if I have understood correctly, specs are actually reified protocols. To make a spec JSON conforming I think I need be doing the following:
1) read the spec data via `s/form`
2) walk the form (with multimethod to allow extension)
3) inject conformers to the leaf specs via s/and
4) store new new spec somewhere
Am I on the right path?
Tested with few combinations of composing:
I) integer? => (s/and string->integer integer?)
* conform works, not the gen
II) integer? => (s/and integer? string->integer)
* gen works, conform doesn't
Is there a way to get them both?
Another thing that we want to solve is the spec => JSON Schema conversion, for the api-docs like Swagger/OpenAPI. The initial transformers we did uses the s/form walking, but wanted to ask would it be possible for the Specs to be Records/Types instead of reified Protocols? Would it have a performance penalty? With this, we could just extend the JSONSchema Protocol for all core Records. This would also allow things like external generic spec-walkers (similar to
https://github.com/metosin/schema-tools/blob/master/src/schema_tools/walk.cljc).
Tommi