vivus has quit [Remote host closed the connection]
_whitelogger has joined #amber
_whitelogger_ has joined #amber
_whitelogger has quit [Remote host closed the connection]
_whitelogger has joined #amber
_whitelogger has joined #amber
_whitelogger has joined #amber
<FromGitter>
<lambda2> Hello there ! I'm doing my first steps with amber (coming from rails), and I'm a bit stuck on i18n. I opened an issue to fill the documentation gaps, but in the meantime does anybody know which helpers are available in my views ?
<FromGitter>
<eliasjpr> @lambda2 you should have a i18n helper
<FromGitter>
<eliasjpr> @/all would like some input on this valiation library, originally created with the intention to use within an Amber project. https://github.com/eliasjpr/schema-validations
<FromGitter>
<eliasjpr> The intention of the library is to normalize and provide a consice way of performing validations, not only in models but also anywhere where you would need to do validation such as params validation. It also addresses the nested params issue currently open https://github.com/amberframework/amber/issues/943
<FromGitter>
<eliasjpr> There are some work (implement JSON and YAML params parsing), It supports custom validators a la Rails style.
<FromGitter>
<Blacksmoke16> hmm
<FromGitter>
<Blacksmoke16> similar idea to something i did but with explicit `validation` bock vs annotations on the ivars
<FromGitter>
<eliasjpr> A lot inspiration came from Dry-Validations, Rails
<FromGitter>
<Blacksmoke16> the schema thing is pretty neat. could that map each param to an ivar?
<FromGitter>
<eliasjpr> yes
<FromGitter>
<eliasjpr> it will give you a `subject.{your schema}` ivar
<FromGitter>
<eliasjpr> I have been making a lot of use of value object for requests and responses
<FromGitter>
<eliasjpr> at the moment there is only support for one level of nested params ⏎ ` "address.city=NY&address.street=Sleepy Hollow&address.zip=12345"`
<FromGitter>
<eliasjpr> working on adding more than one level
<FromGitter>
<Blacksmoke16> gotcha
<FromGitter>
<eliasjpr> let me know what your thoughts are and if you come up with any ideas please open an issue would like to explore. Trying to make Amber more type safe
<FromGitter>
<Blacksmoke16> this is mostly for form data?
<FromGitter>
<Blacksmoke16> couldnt you have something define a like `from_form_data` class method that would work like `from_json`
<FromGitter>
<eliasjpr> form, api, anything that you would like to parse in the request
<FromGitter>
<eliasjpr> since the schema is a `struct` it already comes with a form_json and from_yaml method
<FromGitter>
<eliasjpr> just need to do the wiring for yaml and json
<FromGitter>
<eliasjpr> and if it is form params it already can parse HTTP::Params as shown in the example
<FromGitter>
<eliasjpr> more testing needed for other cases
<FromGitter>
<Blacksmoke16> gotcha
<FromGitter>
<lambda2> @eliasjpr thanks 🙏
<FromGitter>
<vifreefly> Well, I think Granite needs some helpers for validations, like for example ActiveRecord's validations