Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 26 2017 20:07
    @remmeier banned @hibaymj
Remo
@remmeier
a Name and NamingStrategy would be nice sometime. the former hilding a java, json and path name. this used in the ResourceField class.
Rehab Reda
@rehab-reda0
Thank you @remmeier so how can I add this customized url builder class ?
from the boot configuration ?
I can't find a seturlbuilder function or from the setupmodule I can't find context.seturlbuilder
Remo
@remmeier
lmaxbe it has to be added, customizing it has not come up so far
Rehab Reda
@rehab-reda0
@remmeier so I will use just implement a class from the url builder and make it as a bean ?
fkohl04
@fkohl04
@DeafLight Quite a while ago you said, that you are trying to use crnk with Ktor. Have you been successful with this?
Justin Gottschalk
@justindevs
I am using the client to communicate communicate with a spring boot crnk api using the in memory storage. One of the keys I am filtering on can contains string with commas and that is getting split into a set in the filter and will not match on the whole string. Is there a way around crnk treating the commas as a list/set?
2 replies
Remo
@remmeier
@rehab-reda0 somewhere in the setup/CrnkBoot it should be possible to set a custom UrlBuilder.
Matt12432
@Matt12432
Hi sorry I have another query related to previous one, I'm not sure how the url for filtering on nested resources should be structured. For instance if I want to filter books for an author where the name is bookName. I've tried /authors/{authorId}/books?filter[book.name]=bookName which errors saying that there is no property book.name on the book object (its just called name). I've also tried /authors/{authorId}/books?filter[name]=bookName and /authors/{authorId}/books?filter[book][name]=bookName however these then go through authors findAll method instead of the books relationship repo. Once again I appreciate any help with this thanks.
Remo
@remmeier
books.name, there are some more advanced options in the docs, like filtering relationships only, not the requested roots
Matt12432
@Matt12432
Sorry yes the first scenario above should have said [books.name]. I'm not exactly sure where in the documentation I should be looking. Ideally in the above scenario it would still be possible to run a query like this /authors?filter[name]=authorName but filtering both at the same time wouldn't be required
Remo
@remmeier
Rehab Reda
@rehab-reda0

@rehab-reda0 somewhere in the setup/CrnkBoot it should be possible to set a custom UrlBuilder.

Can u please give me an example? I can't figure it out
@remmeier

Remo
@remmeier
I dont think it is currently possible. One would have to check the occurrences of new UrlBuilder(...) and maybe make it customizable.
Roy
@depzor
Hi all,
I have 1 resource type "users" which could reside in two repositories. Based on some parameter it should be retrieved from the current database or from an external system.
Currently I have one database table named "subscriptions" which has a ManyToOne relation with the UserEntity. In order to support an external user repository I am thinking about
adding a new field in the database table "subscriptions" like "externalUserId". Are there any best practices to support two dynamic "user" repositories with relationships to my "subscriptions" resource?
Roy
@depzor
Is there a maven plugin available for crnk-gen? https://github.com/crnk-project/crnk-framework/tree/master/crnk-gen
Remo
@remmeier
just gradle as of yet. but the gradle plugin is just a thing wrapper around a plain Java app. So a Maven plugin or Java main is possible with a few lines.
Maybe I wound consider encoding the location in the resource id? which must not necessarily be equal to the database id
Carla McNearny
@cmcnearny
Hello. I am setting the Crnk-Compact header to true and the links object is correctly omitted for a single relationship.
However, for one-to-many relationships, an empty relationship and links is returned when it is empty, and an empty links: {} is returned when relationship is not empty.
This is not the behavior I expect, according to the documentation: Further relationships without data are completely omitted.
Remo
@remmeier
empty relationship like 0 entries or not loaded?
Carla McNearny
@cmcnearny
A resource that does not yet have any notes, eg:
"notes": { "data": [], "links": {} }
Remo
@remmeier
the data part is correct. a loaded but empty array should not be removed.
Steve Brush
@brushs
I am trying to add a computedAttribute in QueryDSL and have the returned via the API. I'm calling the factory.registerComputedAttribute() method as in one of the test cases I found (only example?) and nothing blows up -- however the field is not returned by the API and any attempt to reference it fail (fields, include) and I'm not sure on the trick to have that field actually returned. All I get currently are 400 - Unknown Parameter - Failed to resolve path to field errors. Any suggestions what may be missing, or the correct way to access the field?
Remo
@remmeier
maybe worth opening a bug. Personally I mostly moved to DB Views rather than direct table access for this kind of use cases.
Roy
@depzor
Hi all, I checked out the spring-boot-microservice-example and I am a bit stuck with the filtering. I am trying to filter all tasks by a project name like for instance:
/task?filter[project][name][eq]=Great%20Project
Shouldn't that be possible? Or perhaps I am missing something here
Remo
@remmeier
there are two types of filters, filter the root or filter on relationships. your example is the later. filter[project.name] is what you are looking for
Roy
@depzor
Did that as well, but InMemoryEvaluator does not seems to handle that
Roy
@depzor
I guess it isnt backed by a ResourceRegistry (at least in the demo project)
Remo
@remmeier
it can filter what is in memory. it does not resolve @JsonApiRelationId as of yet
Roy
@depzor
Would it be possible to support multiple repositories for the same resourceType? Based on a dynamic parameter it should use either a JpaRepository or something else for a specific request.
Roy
@depzor
nvm got something up and running already :)
Steve Brush
@brushs
is there any trick available to have entities to pass child entity collections as attributes rather than relationships on creation? this could possibly allow for transactional creation of children without the need for a Dto.
Remo
@remmeier
a resource dedicated to that use case or the operator module to bulk insert all changes
wulfcolin
@wulfcolin
Hi @remmeier ,
As jcenter is not allowing the publishing of new packages, are you going to publish newer versions on maven central ?
Remo
@remmeier
that is the plan. And rework the pipelipe with github actions, away from travis.
Roy
@depzor
When you use the JpaModule and try to filter on a relationship Id JPA performs an inner join query behind the scenes.
This makes it impossible to filter on a 'null' value relationship. Let say you want to retrieve all records that do not have jpa association (null) with entity X.
Something like this: "select id, name, project_id from tasks where project_id is null"
Remo
@remmeier
there is a possibibilty to swich to outer join. in some scenarios already done automatically. if the foreign key is checked for null, the join should not be nessary. an optimization for that should already be in place.
Roy
@depzor
Indeed I want to get rid of the join and use that simplified query instead
Ah I have found the optimization for this in latest version
Roy
@depzor
thanks!
duncanportelli
@duncanportelli
Hi all. I noticed that Crnk offers the @JsonApiEmbeddable annotation. Unfortunately, I haven't found any documentation defining its purpose. Does anyone have any hint on the functionality behind this please?
Remo
@remmeier
more or less the same as Jpa embeddable. It is a more recent addition. and my need one or the other update. But in general it will treat an a field as a structured object with fields on its own. that happens already implicitly in some scenarios. the annotation makes is more explicit.
Roy
@depzor
Is there an easy way within crnk to get a list with modified attributes? I am aware of the ResourceModificationFilter, but in my case I need some dynamic validations depending on the attributes that are being modified
Remo
@remmeier
just that one so far. but would be nice to have this reusable based on the filter. it is a common use case.
Xavier Lecoustillier
@DeafLight

Hi @remmeier
I have an object like this :

{
    hardwareInfo: {
        serialNumber: ""
        //...
    }
    //...
}

but using sparse fieldset on it (fields=hardwareInfo.serialNumber) fails. Am I missing something in the syntax ?
Thanks :)

Remo
@remmeier
what is the error? I'm not not quiet sure if it is already implemented for nested objects. It is one of the areas where that @JsonApiEmbeddable could be of use, mentioned just a few days ago in here.
Xavier Lecoustillier
@DeafLight
No error, the field is just not present.
Paulo Nascimento
@paulopaesnascimento
Hi @remmeier I cannot get the lastest version from bintray repository. (https://bintray.com/crnk-project/maven/crnk-core/3.3.20200920055408). Is it moved to other repo server? Tks
Victor Mosin
@vicmosin
@remmeier can crnk-project/crnk-framework#793 be merged?
Remo
@remmeier
bintray is gone😬 releases are still on jcenter and will move to maven central. the latest versions will go to github packages. for that we will also move to github actions.
if somebody has such a setup already, feel free to suggest it. otherwise should hopefully not to much trouble.