In io.crnk.client.http.apache.HttpClientRequest, the request is executed without HTTP-Context.
@Override
public HttpAdapterResponse execute() throws IOException {
listeners.stream().forEach(it -> it.onRequest(this));
HttpClientResponse response = new HttpClientResponse(impl.execute(requestBase));
listeners.stream().forEach(it -> it.onResponse(this, response));
return response;
}
Is it a viable option to subclass HttpClientRequest and HttpClientAdapter in order to get an invocation with the same HttpContext every time?
HttpStatusBehavior
which extends DefaultHttpStatusBehavior
. I am trying to access the ResourceRegistry
from within however even though I am implementing the ResourceRegistryAware
, the ResourceRegistry
is still not being set. Any ideas on how this can be achieved please?
First I'm looking for a way to use transient fields as sort parameters, meaning that Crnk would accept them in the first place. It seems that only actual fields can be used for sorting, unless I'm missing something.
Then there is the problem of translating a transient field to its corresponding JPA query. I wasn't actually expecting that that would work without some kind of customization, but I was wondering if there is some way to tell Crnk how a field is supposed to be mapped to a JPA query. For example, having the following in an Entity:
@Transient
public int getTotal() {
return a + b;
}
I would want to translate that into order by (o.a + o.b)
. Maybe Hibernate's @Formula
could be used in this case.
Is there any way I could configure Crnk to allow any of the above? Any pointers on where I should look into, without having to modify the Crnk source code?
Hi there!
I'm trying to use crnk-gen
to generate Java models and interfaces for my JSON:API schema.
I've followed the setup described in https://www.crnk.io/releases/stable/documentation/#_openapi, but run into a dependency problem with XML-doclet (https://github.com/MarkusBernhardt/xml-doclet). It complains about not being able to install that dependency, apparently because no repo has been defined.
I then downloaded the example app and added the plugin part in my gradle:
apply plugin: 'crnk-gen'
crnkGen {
runtime {
// Gradle classpath configuration to use
configuration = 'runtime'
}
// fork generation into new process to have clean environment
forked = true
// specify the package to look for resources
resourcePackages = ['io.crnk.test']
openapi {
// enable OpenAPI generation within Gradle plugin
enabled = true
// specify name of openapi template in the build dir to merge onto
templateName = "openapi-template.yml"
// specify name of API to display in the generated OpenAPI file
projectName = "Generated Title"
// specify version of the API to display in the generated OpenAPI file
projectVersion = "0.1.0"
// specify name of openapi template in the build dir to merge onto
projectDescription = "A generated description of the API."
// specify location of generated sources
genDir = file('src/resources')
}
}
crnkGen.init()
However, I'm getting a Failed to apply plugin [class 'io.crnk.gen.gradle.DocletPlugin']
.
Questions:
crnk-gen
support my use case, i.e. passing a openapi.json scheme and let it generate interfaces and models?openapigenerator
can be used to generate JSON:API documentation based off defined Crnk APIs and/or models, but can not create models and interfaces from a documentation.
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.