Shale is a Ruby object mapper and serializer for JSON, YAML, TOML, CSV and XML. It allows you to parse JSON, YAML, TOML, CSV and XML data and convert it into Ruby data structures, as well as serialize data structures into JSON, YAML, TOML, CSV or XML.
Hey Kamil! I just started using Shale to clean up our in-house API clients and so far things are going well! I was wondering if you would be open to introducing an attribute type registry/lookup table to make the Shale mapping process a bit less verbose and streamline the UX?
I'm imagining something similar (if not the exact same) as what ActiveModel::Attributes does with the symbol to type lookup done through ActiveModel::Type's lookup and register methods. That would allow us to do something like the following which I personally think cuts down on the cognitive overhead and makes reading the class a little easier. What do you think? I'm happy to submit a PR if you're open to it.
class Person < Shale::Mapper
attribute :first_name, :string
attribute :last_name, :string
attribute :date_of_birth, :date
end
Hey Kamil! I just started using Shale to clean up our in-house API clients and so far things are going well! I was wondering if you would be open to introducing an attribute type registry/lookup table to make the Shale mapping process a bit less verbose and streamline the UX?
I'm imagining something similar (if not the exact same) as what
ActiveModel::Attributes
does with the symbol to type lookup done throughActiveModel::Type
'slookup
andregister
methods. That would allow us to do something like the following which I personally think cuts down on the cognitive overhead and makes reading the class a little easier. What do you think? I'm happy to submit a PR if you're open to it.