Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • Jun 26 2017 20:07
    @remmeier banned @hibaymj
Grigorij Ibe
does anyone maybe know whether there is a way to skip deserialization for unknown included resources?
2 replies
Hi all, quick question: would it be possible to add additional attributes on a relationship? So next to "id" and "type"
yes, meta data and link. otherwise maybe the relationship should rather be a resource on its own?
Joe Gaudet
Just to clairfy, if I want to add a custom type to serialize/desiralize the approach is to use Jackson?
Doing the following:
val objectMapper = this.jsonApiClient.getObjectMapper();
com.fasterxml.jackson.databind.module.SimpleModule module = new SimpleModule();
module.addDeserializer(Money.class, new MoneyDeserializer());
But not seeing it pickup on my types.
looks ok, exception?
Joe Gaudet
@remmeier no exceptions, just doesn’t seem call the Deserializer class
    @JsonProperty(value = "client-price")
    private Money clientPrice;
Payload lookes like
have you tried used that objectmapper directly without crnk to validate the config? settings applied both client and server side? there should not be an issue with that
Joe Gaudet
Seems I managed to get it working, just had to do a clean build… I forgot how weird Java can be :P
I’m not using crnk on the back end, building a client library for an existing JSON:API
Hello, we are working on a POC and we were wondering about the best way to handle calls to RESTful (downstream) services, only a few of our apps directly touch a DB.
Specifically, if these downstream services require parameters to retrieve a specific record, what is the recommended way to pass them from the client?
Would filters be one solution?
How about parsing values out of the QuerySpec? Or maybe we shouldn’t be doing that?
parameters should match if the resource fields
exceptional cases in http headers. more for security
or meta data, but it should not end up in "rpc-style" services
Joshua Bourquin
So I’m little confused with the relationship decorators, is it possible to not include child resources in the parent response? I.E. I want a relationship from a child resource to a parent, but I don’t want the child resource IDs showing up in the parent’s relationships. So I want to be able to fetch the parent resource without the lookup for the child resources.
fetch behavior can be eager, lazy or id-only
hi guys, is it possible to support multiple PagingBehaviors in Crnk please? I am trying to support both OffsetLimitPagingBehavior (default) and NumberSizePagingBehavior. However only one gets registered and hence supported.
hello, in my use case is the user only allow to access his own data, let say upon fetching data, i need to add where clauses to the query . I can't find any exemple for dataroom access control (DAC). Also not really understand the explaination in repository decorations. Is there any code example for my use case?
Francisco Costa

I'm having some troubles.

I've configured my java 16 project with crnk, and at my GET request, I don't receive an object "attributes" and "relationships". Beside the examples that we can found, is there any annotation required in order to show the model fields inside the attributes object and the relationships inside an object?

there shouod be test cases that show dataroom usage. maybe the example app as well.
@xicon73 cannot say without more details. java 15 still ok that you mention java 16?
@duncanportelli check the docs section 5.8
Weihua Hu
@remmeier can we use properties as a JsonApiRelation? then what the the name of the JsonApiRelationId shall we use? propertyIds? Or there is no choice but define it as below:
    private Collection<Long> propertyIds;

    @JsonApiRelation(idField = "propertyIds", serialize = SerializeType.ONLY_ID)
    private Collection<UserNotifyPropertyDto> properties;
lookg ok. you like to avoid the idField attribute? plural automating it is difficult. singular it works most of the time.
Joe Gaudet
Hey all, I’m curious, is there a way to access the meta information that comes along with requests?
there is the meta annotation that can be added to an onject
Joe Gaudet
@remmeier is it in the docs somewhere?
Oh I see
Ok cool.
Abhishek Gayakwad
Hello, We use crnk for rest full apis. We need to support one rpc call as well. As part of it we need to persist one common entity. I am calling the repository.create directly, but in this flow the entity manager begin transaction and commit are not called implicitly.
Is there a recommended way to begin and commit transaction in a rpc call before calling repository.create()
There is TransactionRunner. or you may start the transaction with the framework you use, like spring.
Rehab Reda
Is there any example on this part 10.2. Resource-based Access Control with the SecurityModule
How I can say that user with this role can make a post request on repositoryA and can't make a post request on repositoryB ?
if there is an example also on this part it will be greatly appreciated 10.3. Role-based Access Control with ResourceFilter
Justin Gottschalk
How would I go about adding a custom header to the crnk RestTemplateAdapter ?
you ca make use of the underlying framework to add it, like apache http clients. butnthere should be a method throuth a filter/interceptor on request adapter.
Rehab Reda
Hi @remmeier the eq filter works with an array not exact match
for example if we wants to get the records where the array named myArray has this value [1,2,3]
if I filtered by eq filter it will bring up records where myArray is [1,2,3,4] also but I need only records where myArray is [1,2,3] ?
I need exact match is there any way for that ?
Grzegor Ksiazczyk
Hi all :) CRNK lib is amazing, maybe documentation and examples are not perfect but library itself is a good job. I'm going to use it in production and I may need some small support and I hope I will give it back to CRNK lib with some nice PRs
I have two questions at the moment: the first question is about release, do you have any idea/plan/date/estimation for next release?
second question: I'm trying to use relation between two microservices, my starting point was this example: https://github.com/crnk-project/crnk-framework/blob/master/crnk-integration-examples/spring-boot-microservice-example/ and some stuff is not working for me:
one may be a bug: I can create resource item with relation to non existing external resource id
Grzegor Ksiazczyk
one probably wrong config on my side: links to related external resource items are not correct
Grzegor Ksiazczyk
so my question is: Do you have any good / working example of two java services that have relation in model and it validate/include one to another "out of the box" that I can learn how to use it?
@rehab-reda0 i thin it needs a custom operator, or may equals shouldnreally be equals and there should be an additional contains
@gksiazcz_twitter not quite surr, maybe the ResourcePostController needs to be checked if there is a gap in relationship validation. in the examples there is at least a example with two services