Skip to content

Commit

Permalink
Reformat the tck project with the new config
Browse files Browse the repository at this point in the history
  • Loading branch information
Azquelt committed Jun 16, 2022
1 parent 49ac4eb commit 938bfa7
Show file tree
Hide file tree
Showing 12 changed files with 580 additions and 209 deletions.

Large diffs are not rendered by default.

Expand Up @@ -24,7 +24,8 @@
public class NotFoundExceptionMapper implements ExceptionMapper<NotFoundException> {

@Override
@APIResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(implementation = User.class)))
@APIResponse(responseCode = "404", description = "Not Found",
content = @Content(schema = @Schema(implementation = User.class)))
public Response toResponse(NotFoundException t) {
return Response.status(404, t.getMessage()).build();
}
Expand Down
Expand Up @@ -22,7 +22,9 @@
import jakarta.ws.rs.core.Response.Status;
import jakarta.ws.rs.ext.ExceptionMapper;

@APIResponse(responseCode = "400", description = "The review was rejected", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = RejectionResponse.class)))
@APIResponse(responseCode = "400", description = "The review was rejected",
content = @Content(mediaType = MediaType.APPLICATION_JSON,
schema = @Schema(implementation = RejectionResponse.class)))
public class ReviewRejectedExceptionMapper implements ExceptionMapper<ReviewRejectedException> {

@Override
Expand Down
Expand Up @@ -39,10 +39,15 @@
@Path("")
@Schema(name = "Airline Booking API")
@Tags(value = @Tag(name = "Airlines", description = "All the airlines methods"))
@Callback(name = "availabilityCallback", callbackUrlExpression = "http://localhost:9080/oas3-airlines/availability", operations = @CallbackOperation(method = "get", summary = "Retrieve available flights.", responses = {
@APIResponse(responseCode = "200", description = "successful operation", content = @Content(mediaType = "applictaion/json", schema = @Schema(type = SchemaType.ARRAY, implementation = Flight.class))),
@APIResponse(responseCode = "404", description = "No available flights found", content = @Content(mediaType = "n/a"))
}))
@Callback(name = "availabilityCallback", callbackUrlExpression = "http://localhost:9080/oas3-airlines/availability",
operations = @CallbackOperation(method = "get", summary = "Retrieve available flights.", responses = {
@APIResponse(responseCode = "200", description = "successful operation",
content = @Content(mediaType = "applictaion/json",
schema = @Schema(type = SchemaType.ARRAY,
implementation = Flight.class))),
@APIResponse(responseCode = "404", description = "No available flights found",
content = @Content(mediaType = "n/a"))
}))
public class AirlinesResource {
private static Map<Integer, Airline> airlines = new ConcurrentHashMap<Integer, Airline>();

Expand All @@ -65,9 +70,12 @@ public static Airline getRandomAirline() {
@Extension(name = "x-string-property", value = "string-value"),
@Extension(name = "x-boolean-property", value = "true", parseValue = true),
@Extension(name = "x-number-property", value = "117", parseValue = true),
@Extension(name = "x-object-property", value = "{ \"property-1\" : \"value-1\", \"property-2\" : \"value-2\", \"property-3\" : { \"prop-3-1\" : 17, \"prop-3-2\" : true } }", parseValue = true),
@Extension(name = "x-object-property",
value = "{ \"property-1\" : \"value-1\", \"property-2\" : \"value-2\", \"property-3\" : { \"prop-3-1\" : 17, \"prop-3-2\" : true } }",
parseValue = true),
@Extension(name = "x-string-array-property", value = "[ \"one\", \"two\", \"three\" ]", parseValue = true),
@Extension(name = "x-object-array-property", value = "[ { \"name\": \"item-1\" }, { \"name\" : \"item-2\" } ]", parseValue = true)
@Extension(name = "x-object-array-property",
value = "[ { \"name\": \"item-1\" }, { \"name\" : \"item-2\" } ]", parseValue = true)
})
public Response getAirlines() {
return Response.ok().entity(airlines.values()).build();
Expand Down
Expand Up @@ -38,19 +38,34 @@
public class AvailabilityResource {

@GET
@Tag(name = "Get Flights", description = "method to retrieve all flights available", externalDocs = @ExternalDocumentation(description = "A list of all the flights offered by the app", url = "http://airlinesratingapp.com/ourflights"))
@Tag(name = "Get Flights", description = "method to retrieve all flights available",
externalDocs = @ExternalDocumentation(description = "A list of all the flights offered by the app",
url = "http://airlinesratingapp.com/ourflights"))
@Tag(ref = "Availability")
@APIResponse(responseCode = "200", description = "successful operation", content = @Content(mediaType = "application/json", schema = @Schema(type = SchemaType.ARRAY, implementation = Flight.class)))
@APIResponse(responseCode = "404", description = "No available flights found", content = @Content(mediaType = "n/a"))
@APIResponse(responseCode = "200", description = "successful operation",
content = @Content(mediaType = "application/json",
schema = @Schema(type = SchemaType.ARRAY, implementation = Flight.class)))
@APIResponse(responseCode = "404", description = "No available flights found",
content = @Content(mediaType = "n/a"))
@Operation(summary = "Retrieve all available flights", operationId = "getFlights")
@Produces("application/json")
public Response getFlights(
@Parameter(ref = "#/components/parameters/departureDate") @QueryParam("departureDate") String departureDate,
@Parameter(name = "airportFrom", required = true, allowEmptyValue = true, description = "Airport the customer departs from", schema = @Schema(implementation = String.class)) @QueryParam("airportFrom") String airportFrom,
@Parameter(name = "returningDate", required = true, allowReserved = true, description = "Customer return date", schema = @Schema(implementation = String.class)) @QueryParam("returningDate") String returningDate,
@Parameter(name = "airportTo", required = true, description = "Airport the customer returns to", schema = @Schema(implementation = String.class)) @QueryParam("airportTo") String airportTo,
@Parameter(name = "numberOfAdults", required = true, description = "Number of adults on the flight", schema = @Schema(minimum = "0", implementation = String.class)) @QueryParam("numberOfAdults") int numberOfAdults,
@Parameter(name = "numberOfChildren", required = true, deprecated = true, description = "Number of children on the flight", schema = @Schema(minimum = "0", implementation = String.class)) @QueryParam("numberOfChildren") int numberOfChildren) {
@Parameter(name = "airportFrom", required = true, allowEmptyValue = true,
description = "Airport the customer departs from",
schema = @Schema(implementation = String.class)) @QueryParam("airportFrom") String airportFrom,
@Parameter(name = "returningDate", required = true, allowReserved = true,
description = "Customer return date",
schema = @Schema(implementation = String.class)) @QueryParam("returningDate") String returningDate,
@Parameter(name = "airportTo", required = true, description = "Airport the customer returns to",
schema = @Schema(implementation = String.class)) @QueryParam("airportTo") String airportTo,
@Parameter(name = "numberOfAdults", required = true, description = "Number of adults on the flight",
schema = @Schema(minimum = "0",
implementation = String.class)) @QueryParam("numberOfAdults") int numberOfAdults,
@Parameter(name = "numberOfChildren", required = true, deprecated = true,
description = "Number of children on the flight",
schema = @Schema(minimum = "0",
implementation = String.class)) @QueryParam("numberOfChildren") int numberOfChildren) {
return Response.ok().entity(findFlights(airportFrom, airportTo, departureDate, returningDate)).build();
}

Expand Down

0 comments on commit 938bfa7

Please sign in to comment.