Skip to content

Instantly share code, notes, and snippets.

@Path("customer")
public interface CustomerResource {
@GET
@Path("/{id:[1-9][0-9]*}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
Response getCustomer(@PathParam("id") final Long id);
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
<templatePath>${basedir}/src/main/resources/template.html.hbs</templatePath>
<outputPath>${project.build.directory}/generated/document.html</outputPath>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>${version.swagger}</version>
</dependency>
{
"swagger" : "2.0",
"info" : {
"version" : "1.0-SNAPSHOT",
"title" : "Swagger Maven Plugin Showcase"
},
"tags" : [ {
"name" : "customer"
} ],
"paths" : {
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<apiSources>
<apiSource>
<locations>de.openknowledge.maven.plugin.swagger.application</locations>
<info>
<title>${project.name}</title>
@Path("customer")
@Api(value = "/customer", description = "Customer Operations")
public interface CustomerResource {
@GET
@Path("/{id:[1-9][0-9]*}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@ApiOperation(value = "Find customer by id")
Response getCustomer(@PathParam("id") final Long id);
@Test
public void findCustomer() {
Customer customer = mock(Customer.class);
CustomerRepository repository = mock(CustomerRepository.class);
CustomerService service = new CustomerService(repository);
when(repository.find(anyLong())).thenReturn(customer);
service.find(1L);
{
"name": "simplejsbuild",
"version": "0.1.0",
"description": "A simple javascript build",
"scripts": {
"build": "npm run clean && npm install && npm run lint && npm run copy && npm run replace",
"clean": "rm -rf dist node_modules",
"copy": "mkdir dist && cp html/index.html dist/index.html",
"lint": " jslint js/*.js",
"replace": "useref dist/index.html dist/index.html --js uglify"