sunny / actor

Composable Ruby service objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New notation for array inputs

williampollet opened this issue · comments

Hey @sunny !!

Thanks for the amazing work :D

I have an idea, regarding inputs and outputs.

What do you think about accepting a new notation when expecting an array of similar objects, such as:

    inputs :orders, type: [Orders]

(Similar to the GraphQL notation)

This way it will be easier to type arrays.

That makes a lot of sense! I’d be happy to merge a PR for that 🙏🏻

Actually, since now the array syntax for types is used as an "or":

input :age, type: [Integer, Float]

I think it would make more sense to just keep the plural and not have an array:

input :order, type: Order
inputs :orders, type: Order

But perhaps better than the plural which can be a bit too discreet, having it as a new array: true option could make it much more explicit:

input :order, type: Order
input :orders, type: Order, array: true

@williampollet Would you be willing to try a patch for this feature using the array: true syntax? 🙏🏻

I'm taking it !