org.eclipse.microprofile.openapi.annotations.parameters.Parameter Java Examples
The following examples show how to use
org.eclipse.microprofile.openapi.annotations.parameters.Parameter.
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: ComponentResource.java From component-runtime with Apache License 2.0 | 7 votes |
@POST @Path("migrate/{id}/{configurationVersion}") @Operation(operationId = "migrateComponent", description = "Allows to migrate a component configuration without calling any component execution.") @APIResponse(responseCode = "200", description = "the new configuration for that component (or the same if no migration was needed).", content = @Content(mediaType = APPLICATION_JSON)) @APIResponse(responseCode = "404", description = "The component is not found", content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(type = OBJECT, implementation = ErrorPayload.class))) Map<String, String> migrate( @PathParam("id") @Parameter(name = "id", description = "the component identifier", in = PATH) String id, @PathParam("configurationVersion") @Parameter(name = "configurationVersion", description = "the configuration version you send", in = PATH) int version, @RequestBody(description = "the actual configuration in key/value form.", required = true, content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(type = OBJECT))) Map<String, String> config);
Example #2
Source File: Sample.java From cxf with Apache License 2.0 | 6 votes |
@Produces({ MediaType.APPLICATION_JSON }) @Path("/{name}") @PUT @Operation( summary = "Update an existing new item", description = "Put operation with form parameter" ) @APIResponse( content = @Content(schema = @Schema(implementation = Item.class)), responseCode = "200" ) public Item updateItem( @Parameter(required = true) @PathParam("name") String name, @Parameter(required = true) @FormParam("value") String value) { Item item = new Item(name, value); items.put(name, item); return item; }
Example #3
Source File: UserResource.java From microprofile-open-api with Apache License 2.0 | 6 votes |
@POST @Path("/createWithList") @APIResponse( description = "successful operation" ) @Operation( summary = "Creates list of users with given input array" ) public Response createUsersWithListInput( @Parameter( description = "List of user object", required = true) java.util.List<User> users) { for (User user : users) { userData.addUser(user); } return Response.ok().entity("").build(); }
Example #4
Source File: UserResource.java From microprofile-open-api with Apache License 2.0 | 6 votes |
@POST @Path("/createWithArray") @APIResponse( description = "successful operation" ) @Operation( summary = "Creates list of users with given input array" ) public Response createUsersWithArrayInput( @Parameter( description = "List of user object", required = true ) User[] users) { for (User user : users) { userData.addUser(user); } return Response.ok().entity("").build(); }
Example #5
Source File: ComponentResource.java From component-runtime with Apache License 2.0 | 6 votes |
@GET @Path("index") @Operation(operationId = "getComponentIndex", description = "Returns the list of available components.") @APIResponse(responseCode = "200", description = "The index of available components.", content = @Content(mediaType = APPLICATION_OCTET_STREAM)) ComponentIndices getIndex( @QueryParam("language") @DefaultValue("en") @Parameter(name = "language", description = "the language for display names.", in = QUERY, schema = @Schema(type = STRING, defaultValue = "en")) String language, @QueryParam("includeIconContent") @DefaultValue("false") @Parameter(name = "includeIconContent", description = "should the icon binary format be included in the payload.", in = QUERY, schema = @Schema(type = STRING, defaultValue = "en")) boolean includeIconContent, @QueryParam("q") @Parameter(name = "q", description = "Query in simple query language to filter components. " + "It provides access to the component `plugin`, `name`, `id` and `metadata` of the first configuration property. " + "Ex: `(id = AYETAE658349453) AND (metadata[configurationtype::type] = dataset) AND (plugin = jdbc-component) AND " + "(name = input)`", in = QUERY, schema = @Schema(type = STRING)) String query);
Example #6
Source File: PetStoreResource.java From microprofile-open-api with Apache License 2.0 | 6 votes |
@POST @Path("/order") @Operation( summary = "Place an order for a pet" ) @APIResponse( responseCode = "200", description = "successful operation" ) @APIResponse( responseCode = "400", description = "Invalid Order" ) public Order placeOrder( @Parameter( description = "order placed for purchasing the pet", required = true ) Order order) { storeData.placeOrder(order); return storeData.placeOrder(order); }
Example #7
Source File: ConfigurationTypeResource.java From component-runtime with Apache License 2.0 | 6 votes |
@GET @Path("index") @Operation(description = "Returns all available configuration type - storable models. " + "Note that the lightPayload flag allows to load all of them at once when you eagerly need " + " to create a client model for all configurations.") @APIResponse(responseCode = "200", description = "the list of available and storable configurations (datastore, dataset, ...).", content = @Content(mediaType = APPLICATION_JSON)) ConfigTypeNodes getRepositoryModel( @QueryParam("language") @DefaultValue("en") @Parameter(name = "language", description = "the language for display names.", in = QUERY, schema = @Schema(type = STRING, defaultValue = "en")) String language, @QueryParam("lightPayload") @DefaultValue("true") @Parameter(name = "lightPayload", description = "should the payload skip the forms and actions associated to the configuration.", in = QUERY, schema = @Schema(type = BOOLEAN, defaultValue = "true")) boolean lightPayload, @QueryParam("q") @Parameter(name = "q", description = "Query in simple query language to filter configurations. " + "It provides access to the configuration `type`, `name`, `type` and " + "first configuration property `metadata`. " + "See component index endpoint for a syntax example.", in = QUERY, schema = @Schema(type = STRING)) String query);
Example #8
Source File: ConfigurationTypeResource.java From component-runtime with Apache License 2.0 | 6 votes |
@GET @Path("details") @Operation(operationId = "getConfigurationDetail", description = "Returns all available configuration type - storable models. " + "Note that the lightPayload flag allows to load all of them at once when you eagerly need " + " to create a client model for all configurations.") @APIResponse(responseCode = "200", description = "the list of available and storable configurations (datastore, dataset, ...).", content = @Content(mediaType = APPLICATION_JSON)) ConfigTypeNodes getDetail( @QueryParam("language") @DefaultValue("en") @Parameter(name = "language", description = "the language for display names.", in = QUERY, schema = @Schema(type = STRING, defaultValue = "en")) String language, @QueryParam("identifiers") @Parameter(name = "identifiers", description = "the comma separated list of identifiers to request.", in = QUERY) String[] ids);
Example #9
Source File: ConfigurationTypeResource.java From component-runtime with Apache License 2.0 | 6 votes |
@POST @Path("migrate/{id}/{configurationVersion}") @Operation(operationId = "migrateConfiguration", description = "Allows to migrate a configuration without calling any component execution.") @APIResponse(responseCode = "200", description = "the new values for that configuration (or the same if no migration was needed).", content = @Content(mediaType = APPLICATION_JSON)) @APIResponse(responseCode = "400", description = "If the configuration is missing, payload will be an ErrorPayload with the code CONFIGURATION_MISSING.", content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(type = OBJECT, implementation = ErrorPayload.class))) @APIResponse(responseCode = "404", description = "The configuration is not found", content = @Content(mediaType = APPLICATION_JSON)) Map<String, String> migrate( @PathParam("id") @Parameter(name = "id", description = "the configuration identifier", in = PATH) String id, @PathParam("configurationVersion") @Parameter(name = "configurationVersion", description = "the configuration version you send", in = PATH) int version, @RequestBody(description = "the actual configuration in key/value form.", required = true, content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(type = OBJECT))) Map<String, String> config);
Example #10
Source File: DocumentationResource.java From component-runtime with Apache License 2.0 | 6 votes |
@GET @Path("component/{id}") @Produces(MediaType.APPLICATION_JSON) @Operation( description = "Returns an asciidoctor version of the documentation for the component represented by its identifier `id`.") @APIResponse(responseCode = "200", description = "the list of available and storable configurations (datastore, dataset, ...).", content = @Content(mediaType = APPLICATION_JSON)) @APIResponse(responseCode = "404", description = "If the component is missing, payload will be an ErrorPayload with the code PLUGIN_MISSING.", content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(type = OBJECT, implementation = ErrorPayload.class))) DocumentationContent getDocumentation( @PathParam("id") @Parameter(name = "id", description = "the component identifier", in = PATH) String id, @QueryParam("language") @DefaultValue("en") @Parameter(name = "language", description = "the language for display names.", in = QUERY, schema = @Schema(type = STRING, defaultValue = "en")) String language, @QueryParam("segment") @DefaultValue("ALL") @Parameter(name = "segment", description = "the part of the documentation to extract.", in = QUERY, schema = @Schema(type = STRING, defaultValue = "ALL")) DocumentationSegment segment);
Example #11
Source File: Sample.java From cxf with Apache License 2.0 | 6 votes |
@Produces({ MediaType.APPLICATION_JSON }) @Path("/{name}") @GET @Operation( summary = "Get item by name", description = "Get operation with type and headers" ) @APIResponses({ @APIResponse(content = @Content(schema = @Schema(implementation = Item.class)), responseCode = "200"), @APIResponse(responseCode = "404") }) public Response getItem( @Parameter(required = true) @HeaderParam("Accept-Language") final String language, @Parameter(required = true) @PathParam("name") String name) { return items.containsKey(name) ? Response.ok().entity(items.get(name)).build() : Response.status(Status.NOT_FOUND).build(); }
Example #12
Source File: Sample.java From cxf with Apache License 2.0 | 6 votes |
@Consumes({ MediaType.APPLICATION_JSON }) @POST @Operation( summary = "Create new item", description = "Post operation with entity in a body" ) @APIResponses( @APIResponse( content = @Content( schema = @Schema(implementation = Item.class), mediaType = MediaType.APPLICATION_JSON ), headers = @Header(name = "Location"), responseCode = "201" ) ) public Response createItem( @Context final UriInfo uriInfo, @Parameter(required = true) final Item item) { items.put(item.getName(), item); return Response .created(uriInfo.getBaseUriBuilder().path(item.getName()).build()) .entity(item).build(); }
Example #13
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 #14
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 #15
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 #16
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 #17
Source File: PetResource.java From microprofile-open-api with Apache License 2.0 | 5 votes |
@PUT @Consumes({"application/json", "application/xml"}) @SecurityRequirement( name = "petsHttp" ) @APIResponses(value={ @APIResponse( responseCode = "400", description = "Invalid ID supplied", content = @Content(mediaType = "application/json") ), @APIResponse( responseCode = "404", description = "Pet not found", content = @Content(mediaType = "application/json") ), @APIResponse( responseCode = "405", description = "Validation exception", content = @Content(mediaType = "application/json") ) }) @Operation( summary = "Update an existing pet", description = "Update an existing pet with the given new attributes" ) public Response updatePet( @Parameter( name ="petAttribute", description = "Attribute to update existing pet record", required = true, schema = @Schema(implementation = Pet.class)) Pet pet) { Pet updatedPet = petData.addPet(pet); return Response.ok().entity(updatedPet).build(); }
Example #18
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 #19
Source File: UserResource.java From microprofile-open-api with Apache License 2.0 | 5 votes |
@POST @APIResponse( description = "successful operation" ) @Operation( summary = "Create user", description = "This can only be done by the logged in user." ) @SecurityRequirements( value = { @SecurityRequirement( name = "userApiKey" ), @SecurityRequirement( name = "userBasicHttp" ), @SecurityRequirement( name = "userBearerHttp" ) } ) public Response createUser( @Parameter( description = "Created user object", schema = @Schema(ref = "#/components/schemas/User"), required = true ) User user) { userData.addUser(user); return Response.ok().entity("").build(); }
Example #20
Source File: ContactResource.java From javaee8-cookbook with Apache License 2.0 | 5 votes |
@GET @Path("/contact/{id}") @APIResponse(responseCode = "200", description = "Single contact response", name = "SingleContactResponse" ) @Parameter(name = "id", description = "Contact Id", required = true, allowEmptyValue = false ) public Response getContactById(@PathParam("id") Long id) { return Response.ok("This is a single contact").build(); }
Example #21
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 #22
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 #23
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 #24
Source File: ComponentResource.java From component-runtime with Apache License 2.0 | 5 votes |
@GET @Path("dependencies") @Operation(description = "Returns a list of dependencies for the given components. " + "IMPORTANT: don't forget to add the component itself since it will not be part of the dependencies." + "Then you can use /dependency/{id} to download the binary.") @APIResponse(responseCode = "200", description = "The list of dependencies per component", content = @Content(mediaType = APPLICATION_JSON)) Dependencies getDependencies(@QueryParam("identifier") @Parameter(name = "identifier", description = "the list of component identifiers to find the dependencies for.", in = QUERY) String[] ids);
Example #25
Source File: ComponentResource.java From component-runtime with Apache License 2.0 | 5 votes |
@GET @Path("dependency/{id}") @Produces(MediaType.APPLICATION_OCTET_STREAM) @Operation(description = "Return a binary of the dependency represented by `id`. " + "It can be maven coordinates for dependencies or a component id.") @APIResponse(responseCode = "200", description = "The dependency binary (jar).", content = @Content(mediaType = APPLICATION_OCTET_STREAM)) @APIResponse(responseCode = "404", description = "If the plugin is missing, payload will be an ErrorPayload with the code PLUGIN_MISSING.", content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(type = OBJECT, implementation = ErrorPayload.class))) StreamingOutput getDependency(@PathParam("id") @Parameter(name = "id", description = "the dependency binary (jar).", in = PATH) String id);
Example #26
Source File: ComponentResource.java From component-runtime with Apache License 2.0 | 5 votes |
@GET @Path("icon/family/{id}") @Produces({ APPLICATION_JSON, APPLICATION_OCTET_STREAM }) @Operation(description = "Returns the icon for a family.") @APIResponse(responseCode = "200", description = "Returns a particular family icon in raw bytes.", content = @Content(mediaType = APPLICATION_OCTET_STREAM)) @APIResponse(responseCode = "404", description = "The family or icon is not found", content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(type = OBJECT, implementation = ErrorPayload.class))) Response familyIcon( @PathParam("id") @Parameter(name = "id", description = "the family identifier", in = PATH) String id);
Example #27
Source File: ComponentResource.java From component-runtime with Apache License 2.0 | 5 votes |
@GET @Path("icon/{id}") @Produces({ APPLICATION_JSON, APPLICATION_OCTET_STREAM }) @Operation(description = "Returns a particular component icon in raw bytes.") @APIResponse(responseCode = "200", description = "The component icon in binary form.", content = @Content(mediaType = APPLICATION_OCTET_STREAM)) @APIResponse(responseCode = "404", description = "The family or icon is not found", content = @Content(mediaType = APPLICATION_JSON)) Response icon(@PathParam("id") @Parameter(name = "id", description = "the component icon identifier", in = PATH) String id);
Example #28
Source File: ComponentResource.java From component-runtime with Apache License 2.0 | 5 votes |
@GET @Path("details") // bulk mode to avoid to fetch components one by one when reloading a pipeline/job @Operation(operationId = "getComponentDetail", description = "Returns the set of metadata about a few components identified by their 'id'.") @APIResponse(responseCode = "200", description = "the list of details for the requested components.", content = @Content(mediaType = APPLICATION_JSON)) @APIResponse(responseCode = "400", description = "Some identifiers were not valid.", content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(type = OBJECT, implementation = SampleErrorForBulk.class))) ComponentDetailList getDetail( @QueryParam("language") @DefaultValue("en") @Parameter(name = "language", description = "the language for display names.", in = QUERY, schema = @Schema(type = STRING, defaultValue = "en")) String language, @QueryParam("identifiers") @Parameter(name = "identifiers", description = "the component identifiers to request.", in = QUERY) String[] ids);
Example #29
Source File: ActionResource.java From component-runtime with Apache License 2.0 | 5 votes |
@GET @Path("index") @Operation(operationId = "getActionIndex", description = "This endpoint returns the list of available actions for a certain family and potentially filters the " + "output limiting it to some families and types of actions.") @APIResponse(responseCode = "200", description = "The action index.", content = @Content(mediaType = APPLICATION_JSON)) ActionList getIndex( @QueryParam("type") @Parameter(name = "type", in = QUERY, description = "the types of actions") String[] types, @QueryParam("family") @Parameter(name = "family", in = QUERY, description = "the families") String[] families, @QueryParam("language") @Parameter(name = "language", description = "the language to use", in = QUERY, schema = @Schema(defaultValue = "en", type = STRING)) @DefaultValue("en") String language);
Example #30
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(); }