Enter Pipe class between any of the existing ones #547
KaloyanYosifov
started this conversation in
Ideas
Replies: 1 comment
-
In such a case I would create a new abstract data object which has the pipeline like you've described, then every data object could extend from that data object and would run the extra pipe. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey I have a feature request which I would like to discuss before I create a PR.
So this idea comes from an issue I stumbled today while I was working on a project. We have a DTO which has a variable
type
that gets filled by an optional route parameter.This is working very well so far. But the issue is that our team has agreed to a spec where we send
type
asnull
in the url (Don't ask me why 💀 ). Example: https://example.org/posts/category/nullNow in this case I would want the
type
to be null in the DTO, so I don't get any cast or validation errors. This is not the case so I created myself a pipe which I pass to the pipeline that checks iftype
is a stringnull
and if it is I just set it tonull
type.Here is how this works:
Notice how I add
FixTypeRouteParameterPropertyDataPipe::class
just afterFillRouteParameterPropertiesDataPipe::class
.Now with that story done 😅 . My whole problem with the above solution is that I have to copy the
pipeline
definition of the parent to add the pipe afterFillRoute
. I would like to propose a method onDataPipeline
where we can choose where we can add a new Pipe which allows to use the default pipes without copying. This also allows to use the new default pipes introduced into the libraryAs an example:
or maybe have
DataPipeline
support setting pipes array with a setter and have a getter for the user to manipulate.Let me know if this proposal makes sense
Beta Was this translation helpful? Give feedback.
All reactions