org.eclipse.microprofile.openapi.annotations.enums.ParameterIn Java Examples
The following examples show how to use
org.eclipse.microprofile.openapi.annotations.enums.ParameterIn.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ParameterScanTests.java From smallrye-open-api with Apache License 2.0 | 5 votes |
@GET @Produces(MediaType.APPLICATION_JSON) @SuppressWarnings("unused") @Parameter(name = "X-Custom-Header", in = ParameterIn.HEADER, required = true) @Parameter(name = "id", in = ParameterIn.PATH) public Widget get(@HeaderParam("X-Custom-Header") String custom, @PathParam("id") @DefaultValue("000") String id) { return null; }
Example #2
Source File: ParameterScanTests.java From smallrye-open-api with Apache License 2.0 | 5 votes |
public ParametersInConstructorTestResource( @Parameter(name = "h1", in = ParameterIn.HEADER, description = "Description of h1") @HeaderParam("h1") @Deprecated String h1, @Parameter(name = "h2", in = ParameterIn.HEADER, hidden = true) @HeaderParam("h2") String h2, @Parameter(name = "q1", deprecated = true) @QueryParam("q1") String q1, @NotNull @CookieParam("c1") String c1, @PathParam("p1") String p1, @BeanParam Bean b1) { }
Example #3
Source File: ParameterScanTests.java From smallrye-open-api with Apache License 2.0 | 5 votes |
@GET @Produces(MediaType.APPLICATION_JSON) @Parameter(name = "id", in = ParameterIn.PATH, style = ParameterStyle.MATRIX, description = "Additional information for id2") public Widget get(@MatrixParam("m1") @DefaultValue("default-m1") String m1, @MatrixParam("m2") @Size(min = 20) String m2) { return null; }
Example #4
Source File: ParameterScanTests.java From smallrye-open-api with Apache License 2.0 | 5 votes |
@GET @Path("/seg1/seg2/resourceA") @Produces(MediaType.APPLICATION_JSON) @Parameter(in = ParameterIn.PATH, name = "resourceA", style = ParameterStyle.MATRIX) public Widget get(@MatrixParam("m1") @DefaultValue("default-m1") int m1, @MatrixParam("m2") @DefaultValue("100") @Max(200) int m2) { return null; }
Example #5
Source File: ParameterScanTests.java From smallrye-open-api with Apache License 2.0 | 5 votes |
@GET @Path("seg1") @Produces(MediaType.TEXT_PLAIN) @Parameter(name = "segments", description = "Test", style = ParameterStyle.MATRIX, in = ParameterIn.PATH) public String echo(@PathParam("segments") PathSegment segmentsMatrix) { return segmentsMatrix.getPath(); }
Example #6
Source File: ParameterScanTests.java From smallrye-open-api with Apache License 2.0 | 5 votes |
@GET @Path("{p1}") @Produces(MediaType.TEXT_PLAIN) public String echo( @Parameter(name = "Path1", in = ParameterIn.PATH, style = ParameterStyle.SIMPLE, description = "The name 'Path1' will not be used instead of 'p1'") @PathParam("p1") String p1) { return p1; }
Example #7
Source File: NestedSchemaOnParameterResource.java From smallrye-open-api with Apache License 2.0 | 5 votes |
@SuppressWarnings("unused") @POST @Produces(MediaType.APPLICATION_JSON) @APIResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = NestedParameterTestParent.class))) public NestedParameterTestParent getHiddenResponse( @Parameter(name = "arg", in = ParameterIn.COOKIE) NestedParameterTestParent request) { return new NestedParameterTestParent(); }
Example #8
Source File: BookingResource.java From microprofile-open-api with Apache License 2.0 | 5 votes |
@GET @Path("{id}") @Parameters( { @Parameter( name = "id", description = "ID of the booking", required = true, in = ParameterIn.PATH, style = ParameterStyle.SIMPLE ) } ) @Produces("application/json") @Operation( summary="Get a booking with ID", operationId = "getBookingById") @APIResponses(value={ @APIResponse( responseCode="200", description="Booking retrieved", content=@Content( schema=@Schema( implementation=Booking.class))), @APIResponse( responseCode="404", description="Booking not found") }) public Response getBooking( @PathParam("id") int id){ Booking booking = bookings.get(id); if(booking!=null){ return Response.ok().entity(booking).build(); } else{ return Response.status(Status.NOT_FOUND).build(); } }
Example #9
Source File: ReviewResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@GET @Path("{user}/{airlines}") @APIResponse( responseCode="200", description="Review(s) retrieved", content=@Content( schema=@Schema( implementation=Review.class))) @APIResponse( responseCode="404", description="Review(s) not found") @Operation( operationId = "getReviewByAirlineAndUser", summary="Get all reviews for an airline by User") @Produces("application/json") @Parameters( value = { @Parameter( name = "airlines", description = "name of the airlines for the reviews", required = true, in = ParameterIn.PATH, content = @Content( example = "Acme Air")), @Parameter( name = "user", description = "sername of the user for the reviews", required = true, in = ParameterIn.PATH, content = @Content( examples = @ExampleObject( name = "example", value = "bsmith"))) }) public Response getReviewByAirlineAndUser( @PathParam("user") String user, @PathParam("airlines") String airlines){ List<Review> reviewsByAirlinesUser = new ArrayList<Review>(); for (Review review : reviews.values()) { Airline currentAirline = review.getAirlines(); User currentUser = review.getUser(); if (currentAirline.getName() == airlines && currentUser.getUserName() == user) { reviewsByAirlinesUser.add(review); } } if(!reviewsByAirlinesUser.isEmpty()){ return Response.ok().entity(reviewsByAirlinesUser).build(); } else{ return Response.status(Status.NOT_FOUND).build(); } }
Example #10
Source File: ReviewResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@GET @Path("airlines/{airline}") @Operation( operationId = "getReviewByAirline", summary="Get all reviews by airlines") @Parameter( name = "airline", description = "name of the airlines for the reviews", required = true, in = ParameterIn.PATH, content = @Content( examples = @ExampleObject( name = "example", value = "Acme Air")), example = "Acme Air") @APIResponse( responseCode="200", description="Review(s) retrieved", content=@Content( schema=@Schema( implementation=Review.class))) @APIResponse( responseCode="404", description="Review(s) not found") @Produces("application/json") public Response getReviewByAirline( @Parameter( name = "airline", description = "name of the airlines for the reviews", required = true, in = ParameterIn.PATH, content = @Content( examples = @ExampleObject( value = "Acme Air"))) @PathParam("airline") String airlines){ List<Review> reviewsByAirlines = new ArrayList<Review>(); for (Review review : reviews.values()) { Airline currentAirline = review.getAirlines(); if (currentAirline.getName() == airlines) { reviewsByAirlines.add(review); } } if(!reviewsByAirlines.isEmpty()){ return Response.ok().entity(reviewsByAirlines).build(); } else{ return Response.status(Status.NOT_FOUND).build(); } }
Example #11
Source File: ReviewResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@GET @Path("users/{user}") @Operation( operationId = "getReviewByUser", summary="Get all reviews by user") @APIResponses(value={ @APIResponse( responseCode="200", description="Review(s) retrieved", content=@Content( schema=@Schema( implementation=Review.class))), @APIResponse( responseCode="404", description="Review(s) not found") }) @Produces("application/json") public Response getReviewByUser( @Parameter( name = "user", description = "username of the user for the reviews", required = true, in = ParameterIn.PATH, content = @Content( examples = @ExampleObject( name = "example", value = "bsmith")), examples = { @ExampleObject(name="example1", value="bsmith"), @ExampleObject(name="example2", value="[email protected]")}) @PathParam("user") String user){ List<Review> reviewsByUser = new ArrayList<Review>(); for (Review review : reviews.values()) { User currentUser = review.getUser(); if (currentUser.getUserName() == user) { reviewsByUser.add(review); } } if(!reviewsByUser.isEmpty()){ return Response.ok().entity(reviewsByUser).build(); } else{ return Response.status(Status.NOT_FOUND).build(); } }
Example #12
Source File: ReviewResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@GET @Path("{id}") @APIResponse( responseCode="200", description="Review retrieved", content=@Content( schema=@Schema( implementation=Review.class)), headers = { @Header( name = "responseHeader1", description = "Max rate", schema = @Schema(type = SchemaType.INTEGER), required = true, allowEmptyValue = true, deprecated = true), @Header( name = "responseHeader2", description = "Input value", schema = @Schema(type = SchemaType.STRING), required = true, allowEmptyValue = true, deprecated = true ) }) @APIResponse( responseCode="404", description="Review not found") @Operation( operationId = "getReviewById", summary="Get a review with ID" ) @Produces("application/json") public Response getReviewById( @Parameter( name = "id", description = "ID of the booking", required = true, in = ParameterIn.PATH, content = @Content( examples = @ExampleObject( name = "example", value = "1"))) @PathParam("id") int id){ Review review = reviews.get(id); if(review!=null){ return Response.ok().entity(review).build(); } else{ return Response.status(Status.NOT_FOUND).build(); } }
Example #13
Source File: ResourceInheritanceTests.java From smallrye-open-api with Apache License 2.0 | 4 votes |
@Override @Parameter(name = "from", in = ParameterIn.PATH, style = ParameterStyle.SIMPLE) public void setFromName(String from) { this.from = from; }
Example #14
Source File: ResourceInheritanceTests.java From smallrye-open-api with Apache License 2.0 | 4 votes |
@HeaderParam("date") @Parameter(name = "date", in = ParameterIn.HEADER, description = "The local date when the greeting is sent", allowEmptyValue = true) void setGreetingDate(LocalDate date);
Example #15
Source File: ResourceInheritanceTests.java From smallrye-open-api with Apache License 2.0 | 4 votes |
@PathParam("from") @Parameter(name = "from", in = ParameterIn.PATH, description = "The name of the person sending the greeting") void setFromName(String from);
Example #16
Source File: ResourceParameterTests.java From smallrye-open-api with Apache License 2.0 | 4 votes |
@Operation(summary = "Return all policies for a given account") @GET @Path("/") @Parameters({ @Parameter(name = "offset", in = ParameterIn.QUERY, description = "Page number, starts 0, if not specified uses 0.", schema = @Schema(type = SchemaType.INTEGER)), @Parameter(name = "limit", in = ParameterIn.QUERY, description = "Number of items per page, if not specified uses 10. " + "NO_LIMIT can be used to specify an unlimited page, when specified it ignores the offset", schema = @Schema(type = SchemaType.INTEGER)), @Parameter(name = "sortColumn", in = ParameterIn.QUERY, description = "Column to sort the results by", schema = @Schema(type = SchemaType.STRING, enumeration = { "name", "description", "is_enabled", "mtime" })), @Parameter(name = "sortDirection", in = ParameterIn.QUERY, description = "Sort direction used", schema = @Schema(type = SchemaType.STRING, enumeration = { "asc", "desc" })), @Parameter(name = "filter[name]", in = ParameterIn.QUERY, description = "Filtering policies by the name depending on the Filter operator used.", schema = @Schema(type = SchemaType.STRING)), @Parameter(name = "filter:op[name]", in = ParameterIn.QUERY, description = "Operations used with the filter", schema = @Schema(type = SchemaType.STRING, enumeration = { "equal", "like", "ilike", "not_equal" }, defaultValue = "equal")), @Parameter(name = "filter[description]", in = ParameterIn.QUERY, description = "Filtering policies by the description depending on the Filter operator used.", schema = @Schema(type = SchemaType.STRING)), @Parameter(name = "filter:op[description]", in = ParameterIn.QUERY, description = "Operations used with the filter", schema = @Schema(type = SchemaType.STRING, enumeration = { "equal", "like", "ilike", "not_equal" }, defaultValue = "equal")), @Parameter(name = "filter[is_enabled]", in = ParameterIn.QUERY, description = "Filtering policies by the is_enabled field." + "Defaults to true if no operand is given.", schema = @Schema(type = SchemaType.STRING, defaultValue = "true", enumeration = { "true", "false" })), }) @APIResponse(responseCode = "400", description = "Bad parameter for sorting was passed") @APIResponse(responseCode = "404", description = "No policies found for customer") @APIResponse(responseCode = "403", description = "Individual permissions missing to complete action") @APIResponse(responseCode = "200", description = "Policies found", content = @Content(schema = @Schema(implementation = PagedResponse.class)), headers = @Header(name = "TotalCount", description = "Total number of items found", schema = @Schema(type = SchemaType.INTEGER))) public Response getPoliciesForCustomer() { return null; }
Example #17
Source File: SubresourceScanTests.java From smallrye-open-api with Apache License 2.0 | 4 votes |
@Path("/sub/unknown2") public Object getUnknownResource2( @Parameter(name = "u2q", in = ParameterIn.QUERY, style = ParameterStyle.SIMPLE, description = "Parameter to make a sub-resource locator look like a bean property param") Long code) { return null; }
Example #18
Source File: SubresourceScanTests.java From smallrye-open-api with Apache License 2.0 | 4 votes |
@Path("/sub/unknown1") @Parameter(name = "u1q", in = ParameterIn.QUERY, style = ParameterStyle.SIMPLE, description = "Parameter to make a sub-resource locator look like a bean property param") public Object getUnknownResource1(Long code) { return null; }