Search in sources :

Example 1 with Sample

use of io.swagger.models.Sample in project swagger-core by swagger-api.

the class ResourceWithEnums method getTest.

@GET
@Path("/{id}")
@ApiOperation(value = "Get object by ID", httpMethod = "GET", notes = "No details provided", response = Sample.class, position = 0)
@ApiResponses({ @ApiResponse(code = 400, message = "Invalid ID", response = NotFoundModel.class), @ApiResponse(code = 404, message = "object not found") })
public Response getTest(@ApiParam(value = "sample param data", required = true, allowableValues = "range[0,10]") @DefaultValue("5") @PathParam("id") String id, @QueryParam("limit") Integer limit, @ApiParam(value = "sample query data", required = true, allowableValues = "a,b,c,d,e") @QueryParam("allowable") String allowable) throws WebApplicationException {
    Sample out = new Sample();
    out.setName("foo");
    out.setValue("bar");
    return Response.ok().entity(out).build();
}
Also used : Sample(io.swagger.models.Sample) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 2 with Sample

use of io.swagger.models.Sample in project swagger-core by swagger-api.

the class ResourceWithRanges method getTest.

@GET
@Path("/{id}")
@ApiOperation(value = "Get object by ID", httpMethod = "GET", notes = "No details provided", response = Sample.class, position = 0)
@ApiResponses({ @ApiResponse(code = 400, message = "Invalid ID", response = NotFoundModel.class), @ApiResponse(code = 404, message = "object not found") })
public Response getTest(@ApiParam(value = "sample param data", defaultValue = "5", allowableValues = "range[0,10]") @PathParam("id") Integer id, @ApiParam(value = "sample positive infinity data", allowableValues = "range[0, infinity]") @PathParam("minValue") Double minValue, @ApiParam(value = "sample negative infinity data", allowableValues = "range[-infinity, 100]") @PathParam("maxValue") Integer maxValue, @ApiParam(value = "sample array data", allowMultiple = true, allowableValues = "range(0, 5)") @PathParam("values") Integer values) throws WebApplicationException {
    Sample out = new Sample();
    out.setName("foo");
    out.setValue("bar");
    return Response.ok().entity(out).build();
}
Also used : Sample(io.swagger.models.Sample) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 3 with Sample

use of io.swagger.models.Sample in project swagger-core by swagger-api.

the class ResourceWithValidation method getTestSwaggerAnd303.

@GET
@Path("/swagger-and-303")
@ApiOperation(value = "Get", httpMethod = "GET")
public Response getTestSwaggerAnd303(@ApiParam(value = "sample param data", required = false, allowableValues = "range[7, infinity]") @QueryParam("id") @NotNull @Min(5) Integer id) throws WebApplicationException {
    Sample out = new Sample();
    out.setName("foo");
    out.setValue("bar");
    return Response.ok().entity(out).build();
}
Also used : Sample(io.swagger.models.Sample) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Example 4 with Sample

use of io.swagger.models.Sample in project swagger-core by swagger-api.

the class ResourceWithResponseHeaders method getTest.

@GET
@Path("/{id}")
@ApiOperation(value = "Get object by ID", notes = "No details provided", response = Sample.class, position = 0, responseHeaders = { @ResponseHeader(name = "foo", description = "description", response = String.class) })
@ApiResponses({ @ApiResponse(code = 400, message = "Invalid ID", response = NotFoundModel.class, responseHeaders = { @ResponseHeader(name = "X-Rack-Cache", description = "Explains whether or not a cache was used", response = Boolean.class), @ResponseHeader(name = "X-After-Rack-Cache", description = "verify order", response = String.class) }), @ApiResponse(code = 404, message = "object not found") })
public Response getTest(@ApiParam(value = "sample param data", required = true, allowableValues = "range[0,10]") @DefaultValue("5") @PathParam("id") String id, @QueryParam("limit") Integer limit) throws WebApplicationException {
    Sample out = new Sample();
    out.setName("foo");
    out.setValue("bar");
    return Response.ok().entity(out).build();
}
Also used : Sample(io.swagger.models.Sample) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 5 with Sample

use of io.swagger.models.Sample in project swagger-core by swagger-api.

the class ResourceWithValidation method getTestSwagger.

@GET
@Path("/swagger")
@ApiOperation(value = "Get", httpMethod = "GET")
public Response getTestSwagger(@ApiParam(value = "sample param data", required = true, allowableValues = "range[7, infinity]") @QueryParam("id") Integer id) throws WebApplicationException {
    Sample out = new Sample();
    out.setName("foo");
    out.setValue("bar");
    return Response.ok().entity(out).build();
}
Also used : Sample(io.swagger.models.Sample) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

Sample (io.swagger.models.Sample)9 GET (javax.ws.rs.GET)9 Path (javax.ws.rs.Path)9 ApiOperation (io.swagger.annotations.ApiOperation)8 ApiResponses (io.swagger.annotations.ApiResponses)5