-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Description
Hello,
I've tried to reference some hydra:operation in my responses, but whatever the Annotations I put on the controller, I can't show them in the operations list.
The Controller Interface :
@Api(value = "hydra", description = "the hydra API")
public interface HydraApi {
@ApiOperation(value = "", notes = "", response = Void.class, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successfully added device", response = Void.class) })
@RequestMapping(value = "/hydra/device",
produces = { "application/ld+json" },
method = RequestMethod.POST)
ResponseEntity<Object> add(@ApiParam(value = "" ,required=true ) @Valid @RequestBody Device body);
@ApiOperation(value = "", notes = "", response = Void.class, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successfully deleted device", response = Void.class) })
@RequestMapping(value = "/hydra/device",
produces = { "application/ld+json" },
method = RequestMethod.DELETE)
ResponseEntity<Object> delete(@ApiParam(value = "" ,required=true ) @Valid @RequestBody Device body);
@ApiOperation(value = "", notes = "", response = DeviceData.class, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successfully read device data", response = DeviceData.class) })
@RequestMapping(value = "/hydra/device/read/{maker}/{model}/{serial}",
produces = { "application/ld+json" },
method = RequestMethod.GET)
ResponseEntity<Object> read(@ApiParam(value = "Maker of the device",required=true ) @PathVariable("maker") String maker,
@ApiParam(value = "Model of the device",required=true ) @PathVariable("model") String model,
@ApiParam(value = "Serial of the device",required=true ) @PathVariable("serial") String serial);
@ApiOperation(value = "", notes = "", response = EntryPoint.class, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "The API endpoints", response = EntryPoint.class) })
@RequestMapping(value = "/hydra",
produces = { "application/ld+json" },
method = RequestMethod.GET)
ResponseEntity<Object> rootEntryPoint();
}The Resource builder :
public ResponseEntity<Object> process() {
ResponseEntity ret;
try {
Resource<EntryPoint> entryPointResource =
new Resource<>(new EntryPoint());
entryPointResource.add(
linkTo(methodOn(HydraApi.class).add(new Device()))
.and(linkTo(methodOn(HydraApi.class).delete(new Device())))
.and(linkTo(methodOn(HydraApi.class).read("a", "b", "c")))
.withSelfRel()
);
ret = new ResponseEntity<Resource>(
entryPointResource,
HttpStatus.OK
);
} catch (Exception e) {
ret = resolveException(e);
}
return new ResponseEntity<>(ret.getBody(), ret.getStatusCode());
}The response of the Resource builder :
{
"@context": {
"@vocab": "http://schema.org/"
},
"@type": "EntryPoint",
"@id": "http://localhost:8080/hydra/device",
"hydra:operation": [
{
"hydra:method": "POST",
"hydra:expects": {
"@type": "Device",
"hydra:supportedProperty": [
{
"hydra:property": "serial"
},
{
"hydra:property": "maker"
},
{
"hydra:property": "model"
}
]
}
},
{
"hydra:method": "DELETE",
"hydra:expects": {
"@type": "Device",
"hydra:supportedProperty": [
{
"hydra:property": "serial"
},
{
"hydra:property": "maker"
},
{
"hydra:property": "model"
}
]
}
}
]
}Thanks in advance for the answer !
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels