I am trying to configure SDR Projections so they are applied only for certain situations. For example, I have two entities: Cycle and Record and each one of them has its own repository.
Cycle contains list of records and when I access "/cycles/{id}", I get HAL/JSON with a reference to the list of records ("/cycles/{id}/records").
I would like to have my records inlined in the response instead of having links so I created and ExcerptProjection which does that so I am able to access an endpoint like this: "cycles/{id}?projection=myProjection".
So far, everything works nicely. However, this has a very unpleasant side-effect. When accessing /cycles endpoint, I get an embedded list of cycles with this projection applied by default (all records are unfolded) which makes the response extremely verbose.
I know that the default behavior of projections is to be always applied for _embedded resources and it needs to be specified otherwise.
Is there a way to avoid having it applied by default and turn it off when needed?
If this is not possible (have not found out in documentation), would you consider this to be a new feature or suggest some workaround?
Martin Myslík opened DATAREST-1189 and commented
I am trying to configure SDR Projections so they are applied only for certain situations. For example, I have two entities: Cycle and Record and each one of them has its own repository.
Cycle contains list of records and when I access "/cycles/{id}", I get HAL/JSON with a reference to the list of records ("/cycles/{id}/records").
I would like to have my records inlined in the response instead of having links so I created and ExcerptProjection which does that so I am able to access an endpoint like this: "cycles/{id}?projection=myProjection".
So far, everything works nicely. However, this has a very unpleasant side-effect. When accessing
/cycles
endpoint, I get an embedded list of cycles with this projection applied by default (all records are unfolded) which makes the response extremely verbose.I know that the default behavior of projections is to be always applied for _embedded resources and it needs to be specified otherwise.
Is there a way to avoid having it applied by default and turn it off when needed?
If this is not possible (have not found out in documentation), would you consider this to be a new feature or suggest some workaround?
No further details from DATAREST-1189
The text was updated successfully, but these errors were encountered: