You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A current pain point of mine is how "static" factories (schemas, responses, requests, etc.) are. The best way to explain is to describe my use case.
I have a recurring pattern of schemas and responses:
CatSchema
CatResponse
CatListResponse
This goes on for every type of entity in my API and having to create all these classes feels like boilerplate hell.
Ideally I would like to only have to define my CatSchema and have reusable generic factories for the responses and list responses.
I've thought about it for a while in the past but haven't found a workaround that doesn't involve changing the package so I'm starting this discussion so that we can brainstorm what the best solutions might be.
The first idea that comes to mind would be to add a factoryParams associative array to all attributes that take factories as input. This would solve that problem but it feels a bit dirty to be passing untyped arrays around. I'm also foreseeing issues with regards to the current Reusable implementation since it's based on a static directory scan, that area would most likely need to be completely changed in favor of on the fly generation of reusable components.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
A current pain point of mine is how "static" factories (schemas, responses, requests, etc.) are. The best way to explain is to describe my use case.
I have a recurring pattern of schemas and responses:
This goes on for every type of entity in my API and having to create all these classes feels like boilerplate hell.
Ideally I would like to only have to define my
CatSchema
and have reusable generic factories for the responses and list responses.I've thought about it for a while in the past but haven't found a workaround that doesn't involve changing the package so I'm starting this discussion so that we can brainstorm what the best solutions might be.
The first idea that comes to mind would be to add a
factoryParams
associative array to all attributes that take factories as input. This would solve that problem but it feels a bit dirty to be passing untyped arrays around. I'm also foreseeing issues with regards to the currentReusable
implementation since it's based on a static directory scan, that area would most likely need to be completely changed in favor of on the fly generation of reusable components.Beta Was this translation helpful? Give feedback.
All reactions