Effect CommunityEC
Effect Community2y ago
33 replies
Colin Morelli

JSON Schema on Transformations

I can't tell if what I'm experiencing is a bug or just a misunderstanding of how JSONSchema.make is supposed to operate.

Consider the following schema being converted:

JSONSchema.make(Schema.DateFromString.annotations({ description: 'Hello' }))


The description field is dropped entirely. This appears to be intentional, as JSONSchema.make only traverses down the from side of a transformation in order to create the schema representation.

While I understand the idea here, in practice this seems quite limiting for any schema involving transformations, without effectively annotating the transform with jsonSchema and manually declaring them. Considering just the case of dates alone, that would seem to be quite limiting.

Am I using this incorrectly? My expectation would be that annotations declared on the Transformation schema itself would be merged with annotations declared on the from side of the transformation, but anything on the to side would be explicitly ignored.
Was this page helpful?