menu

Elide

Elide is a java library built to make it easy to expose JPA beans as either a JSON API or a GraphQL webservice

Channels
Chat
view-forward
# All channels
view-forward
# General
view-forward
# AggregationDataStore
view-forward
# Elide 5.0
view-forward
# Yeoman Generator
view-forward
Team
Posts
Chat
Members
Info
Show previous messages

September 10, 2020 at 10:18pm
* @param swagger Swagger-Core swagger POJO
* @return Pretty printed 'Swagger' document in JSON.
*/
public static String getDocument(Swagger swagger) {
return Json.pretty(swagger);
}
  • reply
  • like
Json.pretty is provided by swagger directly - and it just uses Jackson to directly serialize it.
  • reply
  • like
This following might also be helpful
Edited
  • reply
  • like
You will notice open API has a few different versions. They are working on 3.0.X. but
Edited
  • reply
  • like
swagger-core uses an older version of the Open API specification:
  • reply
  • like
The above link has the document for the swagger object:
  • reply
  • like
Swagger Object This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.
  • reply
  • like
Hope that link helps.
  • reply
  • like

September 22, 2020 at 8:32pm
Is there polymorphic support for relationships? There are a few ways to go about this with hibernate but when trying to implement them, I've been getting various errors. The specifications I received require an "action" relationship, allowing one of several Resource Types to be used in the relationship. How can I best support this specification?
  • reply
  • like
Simply, I want to support something like this
{
"data": [
{
"id": "1",
"type": "some_type",
"attributes": {
"attr1": "string"
},
"relationships": {
"action_detail": {
"data": {
"id": "5",
"type": "exercise"
}
}
}
},
{
"id": "2",
"type": "some_type",
"attributes": {
"attr1": "string"
},
"relationships": {
"action_detail": {
"data": {
"id": "66",
"type": "clone_protocol_order"
}
}
}
},
{
"id": "3",
"type": "some_type",
"attributes": {
"attr1": "string"
},
"relationships": {
"action_detail": {
"data": null
}
}
}
]
}
Edited
  • reply
  • like

June 3, 2021 at 10:10am
Hi, I'm just discovering Elide, and don't find any resource on how to bootstrap it into a simple servlet on a already existing server, without using spring boot. Can you point me to a resource that would explain that ? Or give me some insights on how to do it ? Thanks :)
Edited
  • reply
  • like

June 4, 2021 at 12:10am
You can check out elide standalone:
  • reply
  • like
It is a embedded jetty plus jaxrs servlet
  • reply
  • like
if you need something even more low level, you can look at the elide standalone code.
Edited
  • reply
  • like
elide comes with jaxrs servlets you can add to an existing service.
  • reply
  • like
Here is the servlet
  • reply
  • like
and graphql:
  • reply
  • like

June 11, 2021 at 7:37am
Hi, I'm trying to figure out how to add a filter on every GET request. I was hoping to extend the JsonApiEndpoint.get to create a new uriInfo, but the only thing that seems to be accessible at this point is the requestUri. I could add a filter here, but that's not really elegant. What would be the preferred way to do that ? I looked in lifecycle hooks direction of course, but those seem to be applied far too late, i.e. when the data is already fetched, and this is what I'd like to avoid.
Edited
  • reply
  • like

June 13, 2021 at 1:31pm
Hello, I am trying to figure out a way how to have references across multiple datastores (MultiplexManager). I found reference to BridgeableTransaction, but it looks kind of cumbersome to use or at least the example in test needs custom datastore and having hardcoded entities/relationships. Is there some more easier way? As far as I understand each entity is bound to datastore, so I would assume it could be default behaviour, elide should know where and how to load relationships? In my case I have two hibernate stores and when I tried to use entity from other datastore, hibernate/spring throws this error
Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.faforever.api.league.domain.LeagueSeasonScore.player references an unknown entity: com.faforever.api.data.domain.Player
at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:100)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processEndOfQueue(InFlightMetadataCollectorImpl.java:1823)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processFkSecondPassesInOrder(InFlightMetadataCollectorImpl.java:1767)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1655)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:295)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1224)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1255)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58)
so not sure if this even possible without some workaround? Thanks
  • reply
  • like

June 13, 2021 at 7:57pm