rom-rb / rom-http

Abstract HTTP adapter for ROM
https://rom-rb.org
MIT License
73 stars 18 forks source link

Using input and output schemas in the gem #30

Closed flash-gordon closed 5 years ago

flash-gordon commented 7 years ago

It's not clear to me how they should be used. Right now rom-http's input schemas is used for projecting data, in other words for processing an HTTP response. And it looks strange provided that in rom-sql it is used for writing data via commands, and for projecting we're using so called output schemas there. Also it's common for HTTP APIs that POST/PUT requests return an ID or some other sort of a result which differs from ordinary GETs. Any thoughts on this? /cc @solnic @cflipse @AMHOL

solnic commented 7 years ago

It'd be good to bring this inline with rom core (thus sql too), like you pointed out we have input_schema for commands and output_schema for relations. We may want to consider adding an option to schema to tell it that attribute types should be used as read attribute types too. This way users won't have to define same read types in schemas. We also need to add ability to configure hash constructor type, as I believe we want symbolized here.

solnic commented 5 years ago

This is outdated. The adapter has been updated to leverage core APIs where output_schema is used automatically when loading read data, and input_schema is used in HTTP::Relation#{insert,update}.

solnic commented 5 years ago

This is outdated. The adapter has been updated to leverage core APIs where output_schema is used automatically when loading read data, and input_schema is used in HTTP::Relation#{insert,update}.