Skip to content

restlet not supporting swagger api model annotations? #1245

Open
@bjking2

Description

@bjking2

I have a rest api based on Restlet version 2.3.7 and I am using swagger to document the api.
In my application I attach the swagger specification restlet

final Router router = new Router(getContext());
final Swagger2SpecificationRestlet swagger2SpecificationRestlet = new Swagger2SpecificationRestlet(this);
swagger2SpecificationRestlet.setApiVersion("v1");
swagger2SpecificationRestlet.setBasePath("https://" + ServerSettingConst.getApplicationDomain() + "/api/v1");
swagger2SpecificationRestlet.attach(router);

and I add some resources
router.attach("/status/health", HealthCheckResource.class);

and I have added to Restlet and Swagger annotations:
@get("json")
@ApiOperation(value = "Get health status of Snooq service.", tags = "Status")
@ApiResponses({
@ApiResponse(code = 200, message = "Success", response=GetHealthStatusResponse.class),
@ApiResponse(code = 400, message = "Invalid format of request data", response=ServerResponse.class),
@ApiResponse(code = 401, message = "Unauthorized access"),
@ApiResponse(code = 403, message = "Access forbidden"),
@ApiResponse(code = 500, message = "Internal server error"),
@ApiResponse(code = 503, message = "Service not available")
})GetHealthStatusResponse getHealthStatus();

The response:
@apimodel()
public class GetHealthStatusResponse extends ServerResponse {
@ApiModelProperty(example="test", required = true)
private String pattern;
private String comment;
... }

The api is working and I can view the swagger definition in the Swagger ui.
But the APIModelProperty annotation does not seem to work:
2016-11-12 15_18_54-fotos

Pattern does not have any example and is optional.

Kind regards

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions