org.eclipse.microprofile.openapi.annotations.enums.SchemaType Java Examples
The following examples show how to use
org.eclipse.microprofile.openapi.annotations.enums.SchemaType.
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: ExtensionParsingTests.java From smallrye-open-api with Apache License 2.0 | 6 votes |
@POST @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) @Callbacks({ @Callback(name = "extendedCallback", callbackUrlExpression = "http://localhost:8080/resources/ext-callback", operations = @CallbackOperation(summary = "Get results", extensions = { @Extension(name = "x-object", value = "{ \"key\":\"value\" }", parseValue = true), @Extension(name = "x-object-unparsed", value = "{ \"key\":\"value\" }"), @Extension(name = "x-array", value = "[ \"val1\",\"val2\" ]", parseValue = true), @Extension(name = "x-booltrue", value = "true", parseValue = true), @Extension(name = "x-boolfalse", value = "false", parseValue = true), @Extension(name = "x-number", value = "42", parseValue = true), @Extension(name = "x-number-sci", value = "42e55", parseValue = true), @Extension(name = "x-positive-number-remains-string", value = "+42", parseValue = true), @Extension(name = "x-negative-number", value = "-42", parseValue = true), @Extension(name = "x-unparsable-number", value = "-Not.A.Number", parseValue = true) }, method = "get", responses = @APIResponse(responseCode = "200", description = "successful operation", content = @Content(mediaType = "application/json", schema = @Schema(type = SchemaType.ARRAY, implementation = String.class))))) }) public String get(String data) { return data; }
Example #2
Source File: TestResource.java From quarkus with Apache License 2.0 | 6 votes |
@GET @Path("/openapi/responses/{version}") @Produces("application/json") @APIResponses({ @APIResponse(content = @Content(mediaType = "application/json", schema = @Schema(type = SchemaType.OBJECT, implementation = MyOpenApiEntityV1.class))), @APIResponse(content = @Content(mediaType = "application/json", schema = @Schema(type = SchemaType.OBJECT, implementation = MyOpenApiEntityV2.class))) }) public Response openApiResponses(@PathParam("version") String version) { if ("v1".equals(version)) { MyOpenApiEntityV1 entityV1 = new MyOpenApiEntityV1(); entityV1.setName("my openapi entity version one name"); return Response.ok(entityV1).build(); } MyOpenApiEntityV2 entityV2 = new MyOpenApiEntityV2(); entityV2.setName("my openapi entity version two name"); entityV2.setValue(version); return Response.ok(entityV2).build(); }
Example #3
Source File: BookingResource.java From microprofile-open-api with Apache License 2.0 | 6 votes |
@GET @Tag(ref="bookings") @APIResponses(value={ @APIResponse( responseCode="200", description="Bookings retrieved", content=@Content( schema=@Schema( type = SchemaType.ARRAY, implementation=Booking.class)) ), @APIResponse( responseCode="404", description="No bookings found for the user.") }) @Operation( summary="Retrieve all bookings for current user", operationId = "getAllBookings") @Produces("application/json") public Response getBookings(){ return Response.ok().entity(bookings.values()).build(); }
Example #4
Source File: ReviewResource.java From microprofile-open-api with Apache License 2.0 | 6 votes |
@GET @APIResponse( responseCode = "200", description = "successful operation", content = @Content( mediaType = "application/json", schema = @Schema( type = SchemaType.ARRAY, implementation = Review.class ) ), headers = @Header(ref="#/components/headers/Request-Limit") ) @Operation( operationId = "getAllReviews", summary = "get all the reviews" ) @Produces("application/json") public Response getAllReviews(){ return Response.ok().entity(reviews.values()).build(); }
Example #5
Source File: ParameterResource.java From smallrye-open-api with Apache License 2.0 | 5 votes |
@DELETE @Path("/unnamed") @APIResponse(responseCode = "204", description = "No content") public Response deleteTaskWithoutParamName( @Parameter(description = "The id of the task", example = "e1cb23d0-6cbe-4a29", schema = @Schema(type = SchemaType.STRING)) @PathParam("taskId") String taskId, @QueryParam("nextTask") String nextTaskId) { return Response.noContent().build(); }
Example #6
Source File: Sample.java From cxf with Apache License 2.0 | 5 votes |
@Produces({ MediaType.APPLICATION_JSON }) @GET @Operation( summary = "Get all items", description = "Get operation with Response and @Default value" ) @APIResponses( @APIResponse( content = @Content(schema = @Schema(implementation = Item.class, type = SchemaType.ARRAY)), responseCode = "200" ) ) public Response getItems(@Parameter(required = true) @QueryParam("page") @DefaultValue("1") int page) { return Response.ok(items.values()).build(); }
Example #7
Source File: UserResource.java From microprofile-open-api with Apache License 2.0 | 5 votes |
@GET @Path("/login") @APIResponse( responseCode = "200", description = "successful operation", content = @Content( schema = @Schema(implementation = String.class) ) ) @APIResponse( responseCode = "400", description = "Invalid username/password supplied", content = @Content( schema = @Schema(implementation = String.class) ) ) @Operation( summary = "Logs user into the system" ) public Response loginUser( @Parameter( name = "username", description = "The user name for login", schema = @Schema(type = SchemaType.STRING), required = true ) @QueryParam("username") String username, @Parameter( name = "password", description = "The password for login in clear text", schema = @Schema(type = SchemaType.STRING), required = true) @QueryParam("password") String password) { return Response.ok() .entity("logged in user session:" + System.currentTimeMillis()) .build(); }
Example #8
Source File: UserResource.java From microprofile-open-api with Apache License 2.0 | 5 votes |
@DELETE @Path("/{username}") @APIResponses(value={ @APIResponse( responseCode = "400", description = "Invalid username supplied" ), @APIResponse( responseCode = "404", description = "User not found" ) }) @Operation( summary = "Delete user", description = "This can only be done by the logged in user." ) public Response deleteUser( @Parameter( name = "username", description = "The name that needs to be deleted", schema = @Schema(type = SchemaType.STRING), required = true ) @PathParam("username") String username) { if (userData.removeUser(username)) { return Response.ok().entity("").build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } }
Example #9
Source File: UserResource.java From microprofile-open-api with Apache License 2.0 | 5 votes |
@PUT @Path("/{username}") @APIResponse( responseCode = "400", description = "Invalid user supplied" ) @APIResponse( responseCode = "404", description = "User not found" ) @Operation( summary = "Updated user", description = "This can only be done by the logged in user." ) @SecurityRequirementsSet( value = { @SecurityRequirement( name = "userApiKey" ), @SecurityRequirement( name = "userBearerHttp" ) } ) public Response updateUser( @Parameter( name = "username", description = "name that need to be deleted", schema = @Schema(type = SchemaType.STRING), required = true ) @PathParam("username") String username, @Parameter( description = "Updated user object", required = true) User user) { userData.addUser(user); return Response.ok().entity("").build(); }
Example #10
Source File: PetResource.java From microprofile-open-api with Apache License 2.0 | 5 votes |
@GET @Path("/findByTags") @Produces("application/json") @Callback( name = "tagsCallback", callbackUrlExpression = "http://petstoreapp.com/pet", operations = @CallbackOperation( method = "GET", summary = "Finds Pets by tags", description = "Find Pets by tags; Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", responses = { @APIResponse( responseCode = "400", description = "Invalid tag value", content = @Content(mediaType = "none") ), @APIResponse( responseCode = "200", content = @Content( mediaType = "application/json", schema = @Schema(type = SchemaType.ARRAY, implementation = Pet.class)) ) } ) ) @APIResponseSchema(Pet[].class) @Deprecated public Response findPetsByTags( @HeaderParam("apiKey") String apiKey, @Parameter( name = "tags", description = "Tags to filter by", required = true, deprecated = true, schema = @Schema(implementation = String.class, deprecated = true, externalDocs = @ExternalDocumentation(description = "Pet Types", url = "http://example.com/pettypes"), enumeration = { "Cat", "Dog", "Lizard" }, defaultValue = "Dog" )) @QueryParam("tags") String tags) { return Response.ok(petData.findPetByTags(tags)).build(); }
Example #11
Source File: PetStoreResource.java From microprofile-open-api with Apache License 2.0 | 5 votes |
@DELETE @Path("/order/{orderId}") @APIResponse( responseCode = "400", description = "Invalid ID supplied" ) @APIResponse( responseCode = "404", description = "Order not found" ) @Operation( summary = "Delete purchase order by ID", description = "For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors" ) public Response deleteOrder( @Parameter( name = "orderId", description = "ID of the order that needs to be deleted", schema = @Schema( type = SchemaType.INTEGER, minimum = "1" ), required = true ) @PathParam("orderId") Long orderId) { if (storeData.deleteOrder(orderId)) { return Response.ok().entity("").build(); } else { return Response.status(Response.Status.NOT_FOUND).entity("Order not found").build(); } }
Example #12
Source File: UserResource.java From microprofile-open-api with Apache License 2.0 | 5 votes |
@GET @Path("/{username}") @Tag(ref="user") @APIResponses(value={ @APIResponse( responseCode = "200", description = "Successfully retrieved user by user name.", content = @Content( schema = @Schema(implementation = User.class) )), @APIResponse( responseCode = "400", description = "Invalid username supplied", content = @Content( schema = @Schema(implementation = User.class) )) }) @Operation( summary = "Get user by user name", operationId = "getUserByName") public Response getUserByName( @Parameter( name = "username", schema = @Schema(type = SchemaType.STRING), required = true ) @PathParam("username") String userName) throws NotFoundException { User user = userData.findUserByName(userName); if (null != user) { return Response.ok().entity(user).build(); } else { throw new NotFoundException("User not found"); } }
Example #13
Source File: UserResource.java From microprofile-open-api with Apache License 2.0 | 5 votes |
@DELETE @Path("/{username}") @Tag(ref="user") @APIResponse( responseCode = "200", description = "User deleted successfully" ) @APIResponse( responseCode = "400", description = "Invalid username supplied" ) @APIResponse( responseCode = "404", description = "User not found" ) @Operation( summary = "Delete user", description = "This can only be done by the logged in user.", operationId = "deleteUser") public Response deleteUser( @Parameter( name = "username", description = "The name that needs to be deleted", schema = @Schema(type = SchemaType.STRING), required = true ) @PathParam("username") String userName) { if (userData.removeUser(userName)) { return Response.ok().entity("").build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } }
Example #14
Source File: TestResource.java From quarkus with Apache License 2.0 | 5 votes |
@GET @Path("/openapi/responses") @Produces("application/json") @APIResponse(content = @Content(mediaType = "application/json", schema = @Schema(type = SchemaType.OBJECT, implementation = MyOpenApiEntityV1.class))) public Response openApiResponse() { MyOpenApiEntityV1 entity = new MyOpenApiEntityV1(); entity.setName("my openapi entity name"); return Response.ok(entity).build(); }
Example #15
Source File: GetAuthor.java From openshift-on-ibm-cloud-workshops with Apache License 2.0 | 5 votes |
@GET @APIResponses(value = { @APIResponse( responseCode = "404", description = "Author Not Found" ), @APIResponse( responseCode = "200", description = "Author with requested name", content = @Content( mediaType = "application/json", schema = @Schema(implementation = Author.class) ) ), @APIResponse( responseCode = "500", description = "Internal service error" ) }) @Operation( summary = "Get specific author", description = "Get specific author" ) public Response getAuthor(@Parameter( description = "The unique name of the author", required = true, example = "Niklas Heidloff", schema = @Schema(type = SchemaType.STRING)) @QueryParam("name") String name) { System.out.println("com.ibm.authors.GetAuthor.getAuthor /getauthor invoked"); Author author = new Author(); author.name = "Niklas Heidloff"; author.twitter = "https://twitter.com/nheidloff"; author.blog = "http://heidloff.net"; return Response.ok(this.createJson(author)).build(); }
Example #16
Source File: ParameterResource.java From smallrye-open-api with Apache License 2.0 | 5 votes |
@DELETE @Path("/named") @APIResponse(responseCode = "204", description = "No content") public Response deleteTaskWithParamName( @Parameter(description = "The id of the task, invalid name discarded when @Parameter and JAX-RS annotation have same target", name = "notTaskId", example = "e1cb23d0-6cbe-4a29", schema = @Schema(type = SchemaType.STRING)) @PathParam("taskId") String taskId) { return Response.noContent().build(); }
Example #17
Source File: VisibleOperationResource.java From smallrye-open-api with Apache License 2.0 | 5 votes |
@GET @Produces(MediaType.TEXT_PLAIN) @Operation @APIResponse(responseCode = "200", description = "A successful response", content = @Content(schema = @Schema(type = SchemaType.STRING))) public String getPublicResponse() { return "response value"; }
Example #18
Source File: CustomExtensionParsingTests.java From smallrye-open-api with Apache License 2.0 | 5 votes |
@POST @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) @Callbacks({ @Callback(name = "extendedCallback", callbackUrlExpression = "http://localhost:8080/resources/ext-callback", operations = @CallbackOperation(summary = "Get results", extensions = { @Extension(name = "x-object", value = "{ \"key\":\"value\" }", parseValue = true), @Extension(name = "x-object-unparsed", value = "{ \"key\":\"value\" }"), @Extension(name = "x-array", value = "[ \"val1\",\"val2\" ]", parseValue = true), @Extension(name = "x-booltrue", value = "true", parseValue = false) }, method = "get", responses = @APIResponse(responseCode = "200", description = "successful operation", content = @Content(mediaType = "application/json", schema = @Schema(type = SchemaType.ARRAY, implementation = String.class))))) }) public String get(String data) { return data; }
Example #19
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 #20
Source File: BookingResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@POST @SecurityRequirement( name = "bookingSecurityScheme", scopes = {"write:bookings", "read:bookings"} ) @Callback( name = "bookingCallback", callbackUrlExpression = "http://localhost:9080/airlines/bookings", operations = @CallbackOperation( method ="get", summary="Retrieve all bookings for current user", responses={ @APIResponse( responseCode="200", description="Bookings retrieved", content=@Content( mediaType="application/json", schema=@Schema( type = SchemaType.ARRAY, implementation=Booking.class)) ), @APIResponse( responseCode="404", description="No bookings found for the user.") })) @APIResponse( responseCode="201", description="Booking created", content = @Content( schema=@Schema( name= "id", description = "id of the new booking", type=SchemaType.STRING ) ) ) @Operation( summary="Create a booking", description = "Create a new booking record with the booking information provided.", operationId = "createBooking" ) @Consumes("application/json") @Produces("application/json") public Response createBooking(@RequestBody( description = "Create a new booking with the provided information.", content = @Content( mediaType = "application/json", schema = @Schema(ref="Booking"), examples = @ExampleObject( name = "booking", summary = "External booking example", externalValue = "http://foo.bar/examples/booking-example.json" ) )) Booking task) { bookings.put(currentId, task); return Response.status(Status.CREATED).entity("{\"id\":" + currentId++ + "}").build(); }
Example #21
Source File: UserResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@GET @Path("/{id}") @Tag(ref="user") @APIResponse( responseCode = "200", description = "Successfully retrieved user by id.", content = @Content( schema = @Schema(implementation = User.class)), links = { @Link( name = "User name", description = "The username corresponding to provided user id", operationId = "getUserByName", parameters = @LinkParameter( name = "userId", expression = "$request.path.id")), @Link( name = "Review", description = "The reviews provided by user", operationRef = "/db/reviews/{userName}", parameters = @LinkParameter( name = "path.userName", expression = "$response.body#userName"), requestBody = "$request.path.id", server = @Server(url = "http://example.com")) } ) @APIResponse( responseCode = "400", description = "Invalid id supplied", content = @Content( schema = @Schema(implementation = User.class) )) @Operation( summary = "Get user by id", operationId = "getUserById") public Response getUserById( @Parameter( name = "id", description = "The name that needs to be fetched. Use 1 for testing.", schema = @Schema(type = SchemaType.INTEGER), required = true ) @PathParam("id") int id) throws NotFoundException { User user = userData.findUserById(id); if (null != user) { return Response.ok().entity(user).build(); } else { throw new NotFoundException("User not found"); } }
Example #22
Source File: UserResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@GET @Path("/login") @Tag() @ExternalDocumentation( description = "Policy on user security.", url = "http://exampleurl.com/policy" ) @APIResponse( responseCode = "200", description = "Successful user login.", content = @Content( schema = @Schema(implementation = User.class) ) ) @APIResponse( responseCode = "400", description = "Invalid username/password supplied" ) @Operation( summary = "Logs user into the system", operationId = "logInUser" ) @SecurityScheme( ref = "#/components/securitySchemes/httpTestScheme" ) @SecurityRequirement( name = "httpTestScheme" ) public Response loginUser( @Parameter( name = "username", description = "The user name for login", schema = @Schema(type = SchemaType.STRING), required = true ) @QueryParam("username") String username, @Parameter( name = "password", description = "The password for login in clear text", schema = @Schema(type = SchemaType.STRING), required = true) @QueryParam("password") String password) { return Response.ok() .entity("logged in user session:" + System.currentTimeMillis()) .build(); }
Example #23
Source File: PetStoreResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@GET @Path("/order/{orderId}") @Operation( summary = "Find purchase order by ID", description = "For valid response try integer IDs with value between the integers of 1 and 10. Other values will generated exceptions" ) @APIResponse( responseCode = "200", description = "successful operation", content = @Content( schema = @Schema(implementation = Order.class, allOf = { Order.class, Pet.class }, not = BadOrder.class ) ) ) @APIResponse( responseCode = "400", description = "Invalid ID supplied", content = @Content( schema = @Schema(implementation = Order.class) ) ) @APIResponse( responseCode = "404", description = "Order not found", content = @Content( schema = @Schema(implementation = Order.class, anyOf = { Order.class, BadOrder.class }, discriminatorProperty = "id", discriminatorMapping = @DiscriminatorMapping(value = "0", schema = BadOrder.class) ) ) ) @APIResponse( responseCode = "900", description = "Invalid", content = @Content( schema = @Schema(implementation = Order.class, hidden = true) ) ) public Response getOrderById( @Parameter( name = "orderId", description = "ID of pet that needs to be fetched", schema = @Schema( type = SchemaType.INTEGER, minimum = "1", maximum = "10"), required = true ) @PathParam("orderId") Long orderId) throws NotFoundException { Order order = storeData.findOrderById(orderId); if (null != order) { return Response.ok().entity(order).build(); } else { throw new NotFoundException(404, "Order not found"); } }
Example #24
Source File: ReviewResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@POST @Callbacks( {@Callback( name = "testCallback", callbackUrlExpression="http://localhost:9080/oas3-airlines/reviews", operations = @CallbackOperation( summary = "Get all reviews", method = "get", responses = @APIResponse( responseCode = "200", description = "successful operation", content = @Content( mediaType = "application/json", schema = @Schema( type = SchemaType.ARRAY, implementation = Review.class ) ) ) ) ) } ) @Tag(ref="Reviews") @Servers(value={ @Server(url = "localhost:9080/{proxyPath}/reviews/id", description = "view of all the reviews", variables = { @ServerVariable(name = "proxyPath", description = "Base path of the proxy", defaultValue = "proxy") }), @Server(url = "http://random.url/reviews", description = "random text") }) @SecurityRequirement( name = "reviewoauth2", scopes = "write:reviews") @APIResponse( responseCode="201", description="review created", content = @Content( schema = @Schema( name= "id", description = "id of the new review", type = SchemaType.STRING)), links = { @Link( name="Review", description="get the review that was added", operationId="getReviewById", server = @Server( description = "endpoint for all the review related methods", url = "http://localhost:9080/airlines/reviews/"), parameters = @LinkParameter( name = "reviewId", expression = "$request.path.id") ) } ) @RequestBody( ref = "#/components/requestBodies/review" ) @Operation( summary="Create a Review", operationId = "createReview" ) @Consumes("application/json") @Produces("application/json") public Response createReview(Review review) { reviews.put(currentId, review); return Response.status(Status.CREATED).entity("{\"id\":" + currentId++ + "}").build(); }
Example #25
Source File: PetResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@GET @Path("/{petId}") @APIResponses(value={ @APIResponse( responseCode = "400", description = "Invalid ID supplied", content = @Content( mediaType = "none") ), @APIResponse( responseCode = "404", description = "Pet not found", content = @Content( mediaType = "none") ), @APIResponse( responseCode = "200", content = @Content( mediaType = "application/json", schema = @Schema(type = SchemaType.OBJECT, implementation = Pet.class, oneOf = { Cat.class, Dog.class, Lizard.class }, readOnly = true)) ) }) @Operation( summary = "Find pet by ID", description = "Returns a pet when ID is less than or equal to 10" ) public Response getPetById( @Parameter( name = "petId", description = "ID of pet that needs to be fetched", required = true, example = "1", schema = @Schema( implementation = Long.class, maximum = "101", exclusiveMaximum = true, minimum = "9", exclusiveMinimum = true, multipleOf = 10)) @PathParam("petId") Long petId) throws NotFoundException { Pet pet = petData.getPetById(petId); if (pet != null) { return Response.ok().entity(pet).build(); } else { throw new NotFoundException(404, "Pet not found"); } }
Example #26
Source File: PetResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@DELETE @Path("/{petId}") @SecurityRequirement( name = "petsOAuth2", scopes = "write:pets" ) @APIResponses(value = { @APIResponse( responseCode = "400", description = "Invalid ID supplied" ), @APIResponse( responseCode = "404", description = "Pet not found" ) }) @Operation( summary = "Deletes a pet by ID", description = "Returns a pet when ID is less than or equal to 10" ) public Response deletePet( @Parameter( name = "apiKey", description = "authentication key to access this method", schema = @Schema(type = SchemaType.STRING, implementation = String.class, maxLength = 256, minLength = 32)) @HeaderParam("api_key") String apiKey, @Parameter( name = "petId", description = "ID of pet that needs to be fetched", required = true, schema = @Schema( implementation = Long.class, maximum = "10", minimum = "1")) @PathParam("petId") Long petId) { if (petData.deletePet(petId)) { return Response.ok().build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } }
Example #27
Source File: PetResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@GET @Path("/findByStatus") @APIResponse( responseCode = "400", description = "Invalid status value", content = @Content(mediaType = "none") ) @APIResponse( responseCode = "200", content = @Content( mediaType = "application/json", schema = @Schema(type = SchemaType.ARRAY, implementation = Pet.class)) ) @Operation( summary = "Finds Pets by status", description = "Find all the Pets with the given status; Multiple status values can be provided with comma seperated strings" ) @Extension(name = "x-mp-method1", value = "true") @Extensions( { @Extension(name = "x-mp-method2", value = "true"), @Extension(value = "false", name = "x-mp-method3") } ) public Response findPetsByStatus( @Parameter( name = "status", description = "Status values that need to be considered for filter", required = true, schema = @Schema(implementation = String.class), content = { @Content( examples = { @ExampleObject( name = "Available", value = "available", summary = "Retrieves all the pets that are available"), @ExampleObject( name = "Pending", value = "pending", summary = "Retrieves all the pets that are pending to be sold"), @ExampleObject( name = "Sold", value = "sold", summary = "Retrieves all the pets that are sold") } ) }, allowEmptyValue = true) @Extension(name = "x-mp-parm1", value = "true") String status) { return Response.ok(petData.findPetByStatus(status)).build(); }
Example #28
Source File: UserResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@PATCH @Path("/{username}") @APIResponse( responseCode = "200", description = "Password was changed successfully" ) @Operation( summary = "Change user password", description = "This changes the password for the logged in user.", operationId = "changePassword" ) @SecurityRequirementsSet( value = { @SecurityRequirement( name = "userApiKey" ), @SecurityRequirement( name = "userBearerHttp" ) } ) public void changePassword( @Parameter( name = "username", description = "name that need to be deleted", schema = @Schema(type = SchemaType.STRING), required = true) @PathParam("username") String username, @Parameter( name = "currentPassword", description = "the user's current password", schema = @Schema(type = SchemaType.STRING), required = true) @QueryParam("currentPassword") String currentPassword, @Parameter( name = "newPassword", description = "the user's desired new password", schema = @Schema(type = SchemaType.STRING), required = true) @QueryParam("newPassword") String newPassword) { // don't do anything - this is just a TCK test }
Example #29
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 #30
Source File: UserResource.java From microprofile-open-api with Apache License 2.0 | 4 votes |
@Path("/{username}") @PUT @RequestBody( name = "user", description = "Record of a new user to be created in the system.", content = @Content( mediaType = "application/json", schema = @Schema(implementation = User.class), examples = @ExampleObject( name = "user", summary = "Example user properties to update", value = "Properties to update in JSON format here" ) ) ) @Operation( summary = "Update user", description = "This can only be done by the logged in user.", operationId = "updateUser") @APIResponses(value={ @APIResponse( responseCode = "200", description = "User updated successfully", content = @Content( schema = @Schema(ref="User"), encoding = @Encoding( name = "password", contentType = "text/plain", style = "form", allowReserved = true, explode = true, headers = @Header(ref="Max-Rate") ) ) ), @APIResponse( responseCode = "400", description = "Invalid user supplied" ), @APIResponse( responseCode = "404", description = "User not found" ) }) @Tag(ref="user") public Response updateUser( @Parameter( name = "username", description = "User that needs to be updated", schema = @Schema(type = SchemaType.STRING), required = true ) @PathParam("username") String username, User user) { userData.addUser(user); return Response.ok().entity("").build(); }