Skip to content

Commit

Permalink
Scaffolding for search service
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Oct 4, 2023
1 parent d6a2547 commit e9adbfa
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-openshift</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-swagger-ui</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/quarkus/search/app/SearchHit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package io.quarkus.search.app;

public record SearchHit(String foo) {
}
6 changes: 6 additions & 0 deletions src/main/java/io/quarkus/search/app/SearchResult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.quarkus.search.app;

import java.util.List;

public record SearchResult<T> (long total, List<T> hits) {
}
24 changes: 24 additions & 0 deletions src/main/java/io/quarkus/search/app/SearchService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.quarkus.search.app;

import java.util.List;

import org.jboss.resteasy.reactive.RestQuery;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import org.eclipse.microprofile.openapi.annotations.Operation;

@ApplicationScoped
@Path("/")
public class SearchService {

@GET
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "Search for any resource")
public SearchResult<SearchHit> search(@RestQuery String q) {
return new SearchResult<>(1, List.of(new SearchHit("not-implemented-yet")));
}
}
14 changes: 14 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ quarkus.http.access-log.exclude-pattern=/q/.*
quarkus.management.enabled=true
quarkus.info.enabled=true

# OpenAPI
mp.openapi.extensions.smallrye.info.title=Quarkus Search API
%dev.mp.openapi.extensions.smallrye.info.title=Quarkus Search API (dev)
%test.mp.openapi.extensions.smallrye.info.title=Quarkus Search API (test)
mp.openapi.extensions.smallrye.info.version=1.0.0
mp.openapi.extensions.smallrye.info.description=Search Quarkus resources
mp.openapi.extensions.smallrye.info.contact.email=[email protected]
mp.openapi.extensions.smallrye.info.contact.name=Quarkus team
mp.openapi.extensions.smallrye.info.contact.url=https://github.com/yrodiere/search.quarkus.io

# Swagger UI
quarkus.swagger-ui.always-include=true
quarkus.swagger-ui.title=Quarkus Search API

# Deployment to OpenShift
%prod.quarkus.openshift.labels."app"=search.quarkus.io
# Renew the SSL certificate automatically
Expand Down

0 comments on commit e9adbfa

Please sign in to comment.