menu
announcement

Spectrum will become read-only on August 10, 2021. Learn more about the decision in our official announcement.

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
Team
Posts
Chat
Members
Info
Show previous messages

June 30, 2020 at 2:26pm
Known Issue
  • reply
  • like
It is something we want to add support but haven't had cycles to add this capability
  • reply
  • like
I would be happy to help coach a submission
  • reply
  • like
It is something we want to add support but haven't had cycles to add this capability
Thanks much for the confirmation!
  • reply
  • like

July 1, 2020 at 9:50pm
Support for composite IDs:
like-fill
1
  • reply
  • like

September 4, 2020 at 9:07pm
If I need to create an endpoint that returns GeoJSON (which I currently have in a custom controller). What's the best way to connect the elide swagger tool with this path? I already have a Layer object that has the layer CRUD api supported (Json API). However, we need to be able to make a call and it return just the GeoJSON data (which we have) and it needs to be documented in swagger.
Edited
  • reply
  • like
Are you trying to add a non-elide controller to the swagger document?
  • reply
  • like
Or are you trying to use GeoJSON types as elide attributes and want them to show up correctly in swagger?
  • reply
  • like
The latter is a known issue: https://github.com/yahoo/elide/issues/1387
  • reply
  • like
The former should be possible. Are you using elide standalone or spring boot?
  • reply
  • like

September 8, 2020 at 3:05pm
Yes, I want to add a non-elide controller to the swagger document.
  • reply
  • like
You can override this bean to get access to the Swagger document:
  • reply
  • like
@ConditionalOnMissingBean
public Swagger buildSwagger(EntityDictionary dictionary, ElideConfigProperties settings) {
Info info = new Info()
.title(settings.getSwagger().getName())
.version(settings.getSwagger().getVersion());
SwaggerBuilder builder = new SwaggerBuilder(dictionary, info).withLegacyFilterDialect(false);
Swagger swagger = builder.build().basePath(settings.getJsonApi().getPath());
return swagger;
}
  • reply
  • like
You can then add your data types and controller directly to the Swagger object.
  • reply
  • like

September 10, 2020 at 3:36pm
The examples I'm finding online is to do something like this
@Configuration
public class Swagger2Config {
@Bean
public Docket productApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.demo.resource"))
.paths(regex("/v1.*"))
.build();
}
}
However, only using the swagger object, I've tried a few different ways of adding the class and I'm not getting any traction:
@RestController
@RequestMapping("/api/v1")
@Api(tags = "Layers")
public class LayerController {
...
@GetMapping("/layers/hospitals/{x}/{y}/{radius}")
public String findNearbyHospitals(@PathVariable double x, @PathVariable double y, @PathVariable double radius) {
return this.toGeoJson(repository.findNearby(x, y, radius)).toString();
}
...
}
and working with swagger I've tried adding a definition
Model lcModel = new ModelImpl()
.name("LayerController")
.type("LayerController");
lcModel.setReference("...");
and working with the model directly - which I'm not finding a lot of examples on
Path value = new Path();
Operation op = new Operation();
swagger.getPaths().put("LayerController", value ); // ???
swagger.path("LayerControl", value); // ???
do you have an example or some direction you can provide to help me with this?
  • reply
  • like

September 10, 2020 at 9:55pm
Elide uses swagger core directly (specifically 1.6.2) which is the latest stable branch.
  • reply
  • like
Swagger core is a lower level API - so Spring won't help here.
  • reply
  • like
The last example above from your different trials is what I was recommending (using Swagger object directly from swagger models). It is possible there is a way to get access to the same object from Spring - but I'm not sure how to do it.
Edited
  • reply
  • like
The Swagger object is pretty much identical to what gets serialized over the wire as the Open API document.
  • reply
  • like
So if you see something in the swagger specification - you can and will find it in the Swagger object.
  • reply
  • like
For example, this is the code that converts the Swagger object to JSON text:
  • reply
  • like
Show more messages