io.swagger.v3.oas.annotations.media.Content Java Examples
The following examples show how to use
io.swagger.v3.oas.annotations.media.Content.
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: MostRecentEntryProxyResource.java From browserup-proxy with Apache License 2.0 | 6 votes |
@GET @Produces(MediaType.APPLICATION_JSON) @Operation(description = "Search the entire log for the most recent entry whose request URL matches the given url.", responses = {@ApiResponse( description = "Har Entry", content = @Content( mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = HarEntry.class)))}) public HarEntry mostRecentEntry( @PathParam(PORT) @NotNullConstraint(paramName = PORT) @PortWithExistingProxyConstraint @Parameter(required = true, in = ParameterIn.PATH, description = PORT_DESCRIPTION) int port, @QueryParam(URL_PATTERN) @NotBlankConstraint(paramName = URL_PATTERN) @PatternConstraint(paramName = URL_PATTERN) @Parameter(required = true, description = URL_PATTERN_DESCRIPTION) String urlPattern) { return proxyManager.get(port) .findMostRecentEntry(Pattern.compile(urlPattern)) .orElse(new HarEntry()); }
Example #2
Source File: SetsResource.java From cantor with BSD 3-Clause "New" or "Revised" License | 6 votes |
@GET @Path("/intersect/{namespace}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Perform an intersection of all provided sets") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Provides an intersection of all entries filtered by query parameters as properties in a json", content = @Content(schema = @Schema(implementation = Map.class))), @ApiResponse(responseCode = "400", description = "One of the query parameters has a bad value"), @ApiResponse(responseCode = "500", description = serverErrorMessage) }) public Response intersect(@Parameter(description = "Namespace identifier") @PathParam("namespace") final String namespace, @Parameter(description = "List of sets") @QueryParam("set") final List<String> sets, @BeanParam final SetsDataSourceBean bean) throws IOException { logger.info("received request for intersection of sets {} in namespace {}", sets, namespace); logger.debug("request parameters: {}", bean); final Map<String, Long> intersection = this.cantor.sets().intersect( namespace, sets, bean.getMin(), bean.getMax(), bean.getStart(), bean.getCount(), bean.isAscending()); return Response.ok(parser.toJson(intersection)).build(); }
Example #3
Source File: ExperimentRestApi.java From submarine with Apache License 2.0 | 6 votes |
@GET @Path("/logs") @Operation(summary = "List experiment's log", tags = {"experiment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = JsonResponse.class)))}) public Response listLog(@QueryParam("status") String status) { try { List<ExperimentLog> experimentLogList = experimentManager.listExperimentLogsByStatus(status); return new JsonResponse.Builder<List<ExperimentLog>>(Response.Status.OK).success(true) .result(experimentLogList).build(); } catch (SubmarineRuntimeException e) { return parseExperimentServiceException(e); } }
Example #4
Source File: PostRouter.java From springdoc-openapi with Apache License 2.0 | 6 votes |
@RouterOperations({ @RouterOperation(path = "/posts", method = RequestMethod.GET, headers = {"x-header1=test1","x-header2=test2"}, operation = @Operation(operationId = "all", parameters = { @Parameter(name = "key", description = "sample description"),@Parameter(name = "test", description = "sample desc")}, responses = @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Post.class)))))), @RouterOperation(path = "/posts", method = RequestMethod.POST, operation = @Operation(operationId = "create", requestBody = @RequestBody(content = @Content(schema = @Schema(implementation = Post.class))), responses = @ApiResponse(responseCode = "201"))), @RouterOperation(path = "/posts/{id}", method = RequestMethod.GET, operation = @Operation(operationId = "get", parameters = @Parameter(name = "id", in = ParameterIn.PATH), responses = @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = Post.class))))), @RouterOperation(path = "/posts/{id}", method = RequestMethod.PUT, operation = @Operation(operationId = "update", parameters = @Parameter(name = "id", in = ParameterIn.PATH), responses = @ApiResponse(responseCode = "202", content = @Content(schema = @Schema(implementation = Post.class))))) }) @Bean public RouterFunction<ServerResponse> routes(PostHandler postController) { return route(GET("/posts").and(queryParam("key", "value")), postController::all) .andRoute(POST("/posts"), postController::create) .andRoute(GET("/posts/{id}"), postController::get) .andRoute(PUT("/posts/{id}"), postController::update); }
Example #5
Source File: ObjectsResource.java From cantor with BSD 3-Clause "New" or "Revised" License | 6 votes |
@GET @Path("/size/{namespace}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "View size of a namespace") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Provides single property json with the number of objects in a namespace", content = @Content(schema = @Schema(implementation = HttpModels.SizeResponse.class))), @ApiResponse(responseCode = "500", description = serverErrorMessage) }) public Response size(@Parameter(description = "Namespace identifier") @PathParam("namespace") final String namespace) throws IOException { logger.info("received request to get size of namespace {}", namespace); final Map<String, Integer> completed = new HashMap<>(); completed.put(jsonFieldSize, this.cantor.objects().size(namespace)); return Response.ok(parser.toJson(completed)).build(); }
Example #6
Source File: EntriesProxyResource.java From browserup-proxy with Apache License 2.0 | 6 votes |
@GET @Produces(MediaType.APPLICATION_JSON) @Operation( description = "Search the entire log for entries whose request URL matches the given url", responses = {@ApiResponse(description = "Array of Har Entries", content = @Content( mediaType = MediaType.APPLICATION_JSON, array = @ArraySchema(schema = @Schema(implementation = HarEntry.class))))}) public Collection<HarEntry> entries( @PathParam(PORT) @NotNullConstraint(paramName = PORT) @PortWithExistingProxyConstraint @Parameter(required = true, in = ParameterIn.PATH, description = DocConstants.PORT_DESCRIPTION) int port, @QueryParam(URL_PATTERN) @NotBlankConstraint(paramName = URL_PATTERN) @PatternConstraint(paramName = URL_PATTERN) @Parameter(required = true, description = DocConstants.URL_PATTERN_DESCRIPTION) String urlPattern) { return proxyManager.get(port).findEntries(Pattern.compile(urlPattern)); }
Example #7
Source File: ExperimentRestApi.java From submarine with Apache License 2.0 | 6 votes |
/** * List all experiment for the user * @return experiment list */ @GET @Operation(summary = "List experiments", tags = {"experiment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = JsonResponse.class)))}) public Response listExperiments(@QueryParam("status") String status) { try { List<Experiment> experimentList = experimentManager.listExperimentsByStatus(status); return new JsonResponse.Builder<List<Experiment>>(Response.Status.OK).success(true) .result(experimentList).build(); } catch (SubmarineRuntimeException e) { return parseExperimentServiceException(e); } }
Example #8
Source File: EventsResource.java From cantor with BSD 3-Clause "New" or "Revised" License | 6 votes |
@DELETE @Path("/delete/{namespace}") @Operation(summary = "Delete events") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "All specified events were deleted", content = @Content(schema = @Schema(implementation = HttpModels.CountResponse.class))), @ApiResponse(responseCode = "500", description = serverErrorMessage) }) public Response dropEvents(@Parameter(description = "Namespace identifier") @PathParam("namespace") final String namespace, @BeanParam final EventsDataSourceBean bean) throws IOException { logger.info("received request to drop namespace {}", namespace); final int eventsDeleted = this.cantor.events().delete( namespace, bean.getStart(), bean.getEnd(), bean.getMetadataQuery(), bean.getDimensionQuery()); final Map<String, Integer> countResponse = new HashMap<>(); countResponse.put(jsonFieldCount, eventsDeleted); return Response.ok(parser.toJson(countResponse)).build(); }
Example #9
Source File: AnnotationProcessorTest.java From servicecomb-toolkit with Apache License 2.0 | 6 votes |
@Test public void processApiResponseAnnotation() { OasContext oasContext = new OasContext(null); OperationContext context = new OperationContext(null, oasContext); ApiResponseMethodAnnotationProcessor apiResProcessor = new ApiResponseMethodAnnotationProcessor(); ApiResponse apiResponse = Mockito.mock(ApiResponse.class); Content[] contents = new Content[1]; contents[0] = Mockito.mock(Content.class); Mockito.when(contents[0].mediaType()).thenReturn(MediaTypes.APPLICATION_JSON); Mockito.when(apiResponse.content()).thenReturn(contents); Mockito.when(apiResponse.responseCode()).thenReturn("200"); apiResProcessor.process(apiResponse, context); Assert.assertNotNull(context.getApiResponses().get("200")); Assert.assertNull(context.getApiResponses().get("500")); }
Example #10
Source File: AnnotationProcessorTest.java From servicecomb-toolkit with Apache License 2.0 | 6 votes |
@Test public void processRequestBodyAnnotation() throws NoSuchMethodException { OasContext oasContext = new OasContext(null); RequestBodyParamAnnotationProcessor operationMethodAnnotationProcessor = new RequestBodyParamAnnotationProcessor(); RequestBody requestBody = Mockito.mock(RequestBody.class); Mockito.when(requestBody.content()).thenReturn(new Content[] {Mockito.mock(Content.class)}); Mockito.when(requestBody.ref()).thenReturn("#components/string"); Method helloMethod = OpenapiDef.class.getDeclaredMethod("hello", String.class, Object.class); OperationContext operationContext = new OperationContext(helloMethod, oasContext); ParameterContext parameterContext = new ParameterContext(operationContext, null); operationMethodAnnotationProcessor.process(requestBody, parameterContext); Assert.assertTrue(parameterContext.isRequestBody()); }
Example #11
Source File: QuoteRouter.java From springdoc-openapi with Apache License 2.0 | 6 votes |
@RouterOperations({ @RouterOperation(path = "/hello", operation = @Operation(operationId = "hello", responses = @ApiResponse(responseCode = "200"))), @RouterOperation(path = "/echo", produces = TEXT_PLAIN_VALUE, operation = @Operation(operationId = "echo", requestBody = @RequestBody(content = @Content(schema = @Schema(type = "string"))), responses = @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(type = "string"))))), @RouterOperation(path = "/echo",produces = APPLICATION_JSON_VALUE, operation = @Operation(operationId = "echo", requestBody = @RequestBody(content = @Content(schema = @Schema(type = "string"))), responses = @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(type = "string"))))), @RouterOperation(path = "/quotes", produces = APPLICATION_JSON_VALUE, operation = @Operation(operationId = "fetchQuotes", parameters = @Parameter(name = "size", in = ParameterIn.QUERY, schema = @Schema(type = "string")), responses = @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Quote.class)))))), @RouterOperation(path = "/quotes", produces = APPLICATION_STREAM_JSON_VALUE, operation = @Operation(operationId = "fetchQuotes", responses = @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = Quote.class))))) }) @Bean public RouterFunction<ServerResponse> route(QuoteHandler quoteHandler) { return RouterFunctions .route(GET("/hello").and(accept(TEXT_PLAIN)), quoteHandler::hello) .andRoute(POST("/echo").and(accept(TEXT_PLAIN).and(contentType(TEXT_PLAIN))), quoteHandler::echo) .andRoute(POST("/echo").and(accept(APPLICATION_JSON).and(contentType(APPLICATION_JSON))), quoteHandler::echo) .andRoute(GET("/quotes").and(accept(APPLICATION_JSON)), quoteHandler::fetchQuotes) .andRoute(GET("/quotes").and(accept(APPLICATION_STREAM_JSON)), quoteHandler::streamQuotes); }
Example #12
Source File: FunctionsResource.java From cantor with BSD 3-Clause "New" or "Revised" License | 6 votes |
@GET @Path("/run/{namespace}/{function}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Execute 'get' method on a function") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Process and execute the function", content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))), @ApiResponse(responseCode = "500", description = serverErrorMessage) }) public Response getExecuteFunction(@PathParam("namespace") final String namespace, @PathParam("function") final String function, @Context final HttpServletRequest request, @Context final HttpServletResponse response) { logger.info("executing '{}/{}' with get method", namespace, function); return doExecute(namespace, function, request, response); }
Example #13
Source File: FunctionsResource.java From cantor with BSD 3-Clause "New" or "Revised" License | 6 votes |
@DELETE @Path("/run/{namespace}/{function}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Execute delete method on function query") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Process and execute the function", content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))), @ApiResponse(responseCode = "500", description = serverErrorMessage) }) public Response deleteExecuteFunction(@PathParam("namespace") final String namespace, @PathParam("function") final String function, @Context final HttpServletRequest request, @Context final HttpServletResponse response) { logger.info("executing '{}/{}' with delete method", namespace, function); return doExecute(namespace, function, request, response); }
Example #14
Source File: HelloController.java From springdoc-openapi with Apache License 2.0 | 6 votes |
@Operation(summary = "Multiple files and JSON payloads as multi part request") @PostMapping( value = "multi", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.TEXT_PLAIN_VALUE) public String multiFilesInMultiPart( @RequestPart("params") @Parameter( description = "This is the configuration", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE)) final JsonRequest jsonRequest, @RequestPart(value = "file1", required = false) @Parameter(description = "This is file1") final MultipartFile file1, @RequestPart(value = "file2", required = false) @Parameter(description = "This is file2") final MultipartFile file2) { return "Hello World " + jsonRequest.getName(); }
Example #15
Source File: SetsResource.java From cantor with BSD 3-Clause "New" or "Revised" License | 6 votes |
@GET @Path("/{namespace}/{set}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Get entries from a set") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Provides entry names and weights matching query parameters as properties in a json", content = @Content(schema = @Schema(implementation = Map.class))), @ApiResponse(responseCode = "400", description = "One of the query parameters has a bad value"), @ApiResponse(responseCode = "500", description = serverErrorMessage) }) public Response get(@Parameter(description = "Namespace identifier") @PathParam("namespace") final String namespace, @Parameter(description = "Name of the set") @PathParam("set") final String set, @BeanParam final SetsDataSourceBean bean) throws IOException { logger.info("received request for values in set/namespace {}/{}", set, namespace); logger.debug("request parameters: {}", bean); final Map<String, Long> entries = this.cantor.sets().get( namespace, set, bean.getMin(), bean.getMax(), bean.getStart(), bean.getCount(), bean.isAscending()); return Response.ok(parser.toJson(entries)).build(); }
Example #16
Source File: HelloController.java From springdoc-openapi with Apache License 2.0 | 6 votes |
@PostMapping("/test1") @Operation(summary = "Example api that realize an ECHO operation", description = "The result of the echo is the input value of the api", parameters = { @Parameter(in = ParameterIn.PATH, name = "uuid", required = true, description = "Is the identification of the document", schema = @Schema(type = "string", example = "uuid")) } ) @ApiResponses(value = { @ApiResponse(description = "Successful Operation", responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = PersonDTO.class))), @ApiResponse(responseCode = "201", description = "other possible response") }) public String postMyRequestBody1() { return null; }
Example #17
Source File: HelloController.java From springdoc-openapi with Apache License 2.0 | 6 votes |
@PostMapping("/test2") @Operation(summary = "Example api that realize an ECHO operation", description = "The result of the echo is the input value of the api", responses = { @ApiResponse(description = "Successful Operation", responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = PersonDTO.class))), @ApiResponse(responseCode = "201", description = "other possible response") }, parameters = { @Parameter(in = ParameterIn.PATH, name = "uuid", required = true, description = "Is the identification of the document", schema = @Schema(type = "string", example = "uuid")) } ) public String postMyRequestBody2() { return null; }
Example #18
Source File: EventsResource.java From cantor with BSD 3-Clause "New" or "Revised" License | 5 votes |
@GET @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Get all events namespaces") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Provides the list of all namespaces", content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))), @ApiResponse(responseCode = "500", description = serverErrorMessage) }) public Response getNamespaces() throws IOException { logger.info("received request for all events namespaces"); return Response.ok(parser.toJson(this.cantor.events().namespaces())).build(); }
Example #19
Source File: UserApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Logs user into the system", tags = { "user" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "400", description = "Invalid username/password supplied") }) @GetMapping(value = "/user/login", produces = { "application/xml", "application/json" }) default ResponseEntity<String> loginUser( @NotNull @Parameter(description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username, @NotNull @Parameter(description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password) { return getDelegate().loginUser(username, password); }
Example #20
Source File: UserApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Get user by user name", tags = { "user" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = User.class))), @ApiResponse(responseCode = "400", description = "Invalid username supplied"), @ApiResponse(responseCode = "404", description = "User not found") }) @GetMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }) default ResponseEntity<User> getUserByName( @Parameter(description = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathVariable("username") String username) { return getDelegate().getUserByName(username); }
Example #21
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "uploads an image", description = "", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = ModelApiResponse.class))) }) @PostMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }) default ResponseEntity<ModelApiResponse> uploadFile( @Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") Long petId, @Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, @Parameter(description = "file detail") @Valid @RequestPart("file") MultipartFile file) { return getDelegate().uploadFile(petId, additionalMetadata, file); }
Example #22
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Find pet by ID", description = "Returns a single pet", security = { @SecurityRequirement(name = "api_key") }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = Pet.class))), @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @ApiResponse(responseCode = "404", description = "Pet not found") }) @GetMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }) default ResponseEntity<Pet> getPetById( @Parameter(description = "ID of pet to return", required = true) @PathVariable("petId") Long petId) { return getDelegate().getPetById(petId); }
Example #23
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Finds Pets by status", description = "Multiple status values can be provided with comma separated strings", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))), @ApiResponse(responseCode = "400", description = "Invalid status value") }) @GetMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }) default ResponseEntity<List<Pet>> findPetsByStatus( @NotNull @Parameter(description = "Status values that need to be considered for filter", required = true) @Valid @RequestParam(value = "status", required = true) List<String> status) { return getDelegate().findPetsByStatus(status); }
Example #24
Source File: HelloController.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Get thing", responses = { @ApiResponse(description = "Successful Operation", responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "404", description = "Not found", content = @Content(schema = @Schema(hidden = true))), @ApiResponse(responseCode = "401", description = "Authentication Failure", content = @Content(schema = @Schema(hidden = true))) }) @RequestMapping(path = "/test", method = RequestMethod.GET) ResponseEntity<String> test() { return ResponseEntity.ok("Hello"); }
Example #25
Source File: HelloController.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Get thing", responses = { @ApiResponse(description = "Successful Operation", responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "404", description = "Not found", content = @Content), @ApiResponse(responseCode = "401", description = "Authentication Failure", content = @Content(schema = @Schema(hidden = true))) }) @RequestMapping(path = "/testme", method = RequestMethod.GET) ResponseEntity<String> testme() { return ResponseEntity.ok("Hello"); }
Example #26
Source File: MostRecentEntryProxyResource.java From browserup-proxy with Apache License 2.0 | 5 votes |
@GET @Path("/assertStatusClientError") @Produces(MediaType.APPLICATION_JSON) @Operation(description = "In case url pattern is provided assert that the most recent response " + "found by url pattern has status belonging to CLIENT ERROR class (4xx), otherwise " + "assert that the most recent response has status belonging to CLIENT ERROR class (4xx).", responses = {@ApiResponse( description = "Assertion result", content = @Content( mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = AssertionResult.class)))}) public AssertionResult statusClientError( @PathParam(PORT) @NotNullConstraint(paramName = PORT) @PortWithExistingProxyConstraint @Parameter(required = true, in = ParameterIn.PATH, description = PORT_DESCRIPTION) int port, @QueryParam(URL_PATTERN) @NotBlankConstraint(paramName = URL_PATTERN) @PatternConstraint(paramName = URL_PATTERN) @Parameter(description = URL_PATTERN_DESCRIPTION) String urlPattern) { MitmProxyServer proxyServer = proxyManager.get(port); return urlPattern.isEmpty() ? proxyServer.assertMostRecentResponseStatusCode(HttpStatusClass.CLIENT_ERROR) : proxyServer.assertMostRecentResponseStatusCode(Pattern.compile(urlPattern), HttpStatusClass.CLIENT_ERROR); }
Example #27
Source File: PeopleRestService.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(description = "Find person by e-mail", responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = PersonDTO.class)), responseCode = "200"), @ApiResponse(responseCode = "404", description = "Person with such e-mail doesn't exists") }) @GetMapping(value = "/{email}", produces = MediaType.APPLICATION_JSON_VALUE) public PersonDTO findPerson( @Parameter(description = "E-Mail address to lookup for", required = true) @PathVariable("email") final String email) { final PersonDTO person = people.get(email); if (person == null) { throw new RuntimeException("Person with such e-mail doesn't exists"); } return person; }
Example #28
Source File: HelloController.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@GetMapping @ApiResponse(content = @Content(schema = @Schema( description = "${test.app101.operation.hello.response.schema.description}", implementation = HelloDTO.class))) public HelloDTO hello() { return new HelloDTO(); }
Example #29
Source File: FunctionsResource.java From cantor with BSD 3-Clause "New" or "Revised" License | 5 votes |
@GET @Path("/{namespace}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Get list of all functions in the given namespace") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Provides the list of all functions in the namespace", content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))), @ApiResponse(responseCode = "500", description = serverErrorMessage) }) public Response getFunctions(@PathParam("namespace") final String namespace) throws IOException { logger.info("received request for all objects namespaces"); return Response.ok(parser.toJson(this.functions.list(namespace))).build(); }
Example #30
Source File: EventsResource.java From cantor with BSD 3-Clause "New" or "Revised" License | 5 votes |
@GET @Path("/{namespace}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Get events in a namespace") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Provides the list of events matching query parameters", content = @Content(array = @ArraySchema(schema = @Schema(implementation = HttpModels.EventModel.class)))), @ApiResponse(responseCode = "400", description = "One of the query parameters has a bad value"), @ApiResponse(responseCode = "500", description = serverErrorMessage) }) public Response getEvents(@Parameter(description = "Namespace identifier") @PathParam("namespace") final String namespace, @BeanParam final GetEventsDataSourceBean bean) throws IOException { logger.info("received request for events in namespace {}", namespace); logger.debug("request parameters: {}", bean); final List<Event> results = this.cantor.events().get( namespace, bean.getStart(), bean.getEnd(), bean.getMetadataQuery(), bean.getDimensionQuery(), bean.isIncludePayloads(), bean.isAscending(), bean.getLimit() ); return Response.ok(parser.toJson(results)).build(); }