Hi everbody,
I am new in JsonApi and I see this great library crnk.
My question is where to put custom logic written in services.
In standard Spring Boot Rest Api we have controllers -> services -> repositories
but in JsonApi (crnk) we have resources and repositories.
Resources is controllers in standard Rest Api ?
Where I can put custom logic and how.
hello! wanting to ask about a PR and possible new releases coming out. the PR is this one: crnk-project/crnk-framework#793. how does it look, is it okay?
how about plans for a new release? anything projected at the moment?
Hello there, I'm trying to make use of the @JsonApiMetaInformation, I followed the documentation but I don't see it in my response when I try it with the postman, here is the code of my resource:
/**
* The persistent class for the EF_V_API_TW_RUECKLIEF_KOPF_DET database table.
*
*
*/
@Data
@Entity
@NoArgsConstructor
@Table(name = "EF_V_API_TW_RUECKLIEF_KOPF_DET")
@JsonApiResource(type = "return", resourcePath = "returns")
public class Return implements Serializable {
private static final long serialVersionUID = 1L;
...
@JsonApiMetaInformation
private ReturnMeta meta;
public static class ReturnMeta implements MetaInformation, Serializable {
private static final long serialVersionUID = 8129518187692599777L;
private Boolean patchable = true;
public Boolean getPatchable() {
return patchable;
}
public void setPatchable(Boolean patchable) {
this.patchable = patchable;
}
}
Am I missing something in the repository?
Thank you very much.
GetFromOwnerStrategy
for the entity, the source actually is the JPA entity and the fieldAccessor call triggers JPA lazy loading.
Hi all,
i am trying to do a filter to check if a date value exists within a certain 2 ranges and using the below filter:
{"OR":{"AND":{"GE":{"transmissionDate":"2020-10-01T00:00"},"LE":{"transmissionDate":"2020-10-15T00:00"}},"AND":{"GE":{"transmissionDate":"2020-11-01T00:00"},"LE":{"transmissionDate":"2020-11-15T00:00"}}}}
I believe it is correct but crnk is only taking into consideration the last AND. Is this an issue?
@remmeier what would be the best option if you just want to add a prefix to outgoing links but not for matching requests?
Apparently setWebPathPrefix
is also used for matching and I only want this prefix to be present in response links.
Reimplementing JsonApiUrlBuilder
just to add a path prefix seems overkill too.
As ResourceRegistryImpl
is hardwired in CrnkBoot
I cannot override the getBaseUrl
either.
In the Doc it says: "setUrlMapper to provide a new url mapping implementation to customize how Crnk generates links." - But isn't that one use only for mapping incoming links? And UrlBuilder is used to generate links for resources?
@JochenReinhardt thanks very much for your input. achieved my intended result just as you said. leaving the result here just in case anyone encounters the same difficulty:
{"OR":[{"GE":{"transmissionDate":"2020-10-01T00:00"},"LE":{"transmissionDate":"2020-10-15T00:00"}},{"GE":{"transmissionDate":"2020-11-01T00:00"},"LE":{"transmissionDate":"2020-11-15T00:00"}}]}
%
as a literal part of a LIKE filter expression? For example: GET /tasks?filter[name][LIKE]=% 50% done
, where I'd like the first %
to act as a wildcard as usual and the second %
to act as an actual literal part of the expression, maybe somehow escaped. (In this case, Task 50% done
should match, while Task 50# done
shouldn't match)
Hi @remmeier. In a relationship where the source and target are both of the same type, while filtering/sorting/pagination how do you refer to just the target only since in a filter you are to specify the type.
E.g. a resource of a type person having a relationship "children" which is of type person as well. How can I get the persons together with the eldest child younger than 18?
/persons?include=children?filter[children][age][LT]=18&sort=-children.age&page[limit]=1