All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pro.nikolaev.restutils.annotations.swagger.success.OkWithResource Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2023 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package pro.nikolaev.restutils.annotations.swagger.success;

import io.swagger.v3.oas.annotations.headers.Header;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.lang.annotation.*;

/**
 * A convenience annotation that is itself annotated with
 * {@link ApiResponse @ApiResponse}.
 *
 * 

Methods that carry this annotation will be included in generated * openApi documentation with predefined HTTP status code 200. * And are assumed to have a {@link ResponseEntity} return type. * That will have at least {@code Content-Disposition} header specified. * {@link ResponseBody @ResponseBody} description and example will * not be generated. * *

NOTE: {@code @OkWithResource} is processed if annotated method * is part of properly configured {@link RestController} and * {@code springdoc-openapi} library. * * @author Ilya Nikolaev * @see ApiResponse * @see ResponseEntity * @see RestController * @since 1.0 */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) @ApiResponse(responseCode = "200", description = "Успешно", content = @Content(mediaType = MediaType.APPLICATION_OCTET_STREAM_VALUE, schema = @Schema), headers = @Header(name = HttpHeaders.CONTENT_DISPOSITION)) @Documented public @interface OkWithResource { }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy