mitch2na
mitch2na

Reputation: 79

Katharsis Query Parameters Capabilities

My team is trying to use the query parameters for Katharsis and found that they really don't seem to do anything except on the presentation layer.

Basically i want to side load data with an included parameter, but if i dont populate the returned resource class (For example projects has a many relationship with tasks) with all relationship data nothing is returned in the response.

I was wondering if there is currently any code out there that uses the include parameter and does a smart search on the resource class and call the appropriate relationship repo? This would save the developer time from having to manually inject relationship repos when it needs to populate fields of @JsonApiToOne and @JsonApiToMany

An example would be when this is called projects/123/?include[projects]=tasks

The ProjectToTasksRepo method findManyTargets would be called magically by Katharsis and populate the resource projects->tasks object

Upvotes: 0

Views: 509

Answers (1)

Dustin Stanley
Dustin Stanley

Reputation: 11

Look at the JsonApiLookupIncludeAutomatically annotation, it should provide what you need. If your properties are annotated with this, Katharsis should look up those related resources using their respective repositories if the included query parameter is sent along with the request.

Upvotes: 0

Related Questions