Skip to content

Commit 9114db4

Browse files
robbiecorcoranfrantuma
authored andcommitted
Added FailedApiResponse.java
1 parent d80a272 commit 9114db4

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package io.swagger.v3.oas.annotations.responses;
2+
3+
import io.swagger.v3.oas.annotations.extensions.Extension;
4+
import io.swagger.v3.oas.annotations.media.Content;
5+
6+
import java.lang.annotation.ElementType;
7+
import java.lang.annotation.Retention;
8+
import java.lang.annotation.RetentionPolicy;
9+
import java.lang.annotation.Target;
10+
11+
/**
12+
* A meta-annotation that bundles common error response definitions for API operations.
13+
* <p>
14+
* Includes default definitions for:
15+
* <ul>
16+
* <li>400 Bad Request</li>
17+
* <li>401 Unauthorized</li>
18+
* <li>403 Forbidden</li>
19+
* <li>404 Not Found</li>
20+
* <li>429 Too Many Requests</li>
21+
* <li>500 Internal Server Error</li>
22+
* <li>503 Service Unavailable</li>
23+
* </ul>
24+
* Can be used at type level to apply to all operations in a controller,
25+
* or at method level for individual operations.
26+
*
27+
* @see ApiResponse
28+
* @see ApiResponses
29+
* @since 2.2.32
30+
*/
31+
32+
@Target({ElementType.METHOD, ElementType.TYPE, ElementType.ANNOTATION_TYPE})
33+
@Retention(RetentionPolicy.RUNTIME)
34+
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content)
35+
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content)
36+
@ApiResponse(responseCode = "403", description = "Forbidden", content = @Content)
37+
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content)
38+
@ApiResponse(responseCode = "429", description = "Too Many Requests", content = @Content)
39+
@ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content)
40+
@ApiResponse(responseCode = "503", description = "Service Unavailable", content = @Content)
41+
public @interface FailedApiResponse {
42+
/**
43+
* A reference to a response definition in components responses.
44+
*
45+
* @return the reference
46+
* @since 2.2.32
47+
*/
48+
String ref() default "";
49+
50+
/**
51+
* The list of optional extensions.
52+
*
53+
* @return an optional array of extensions
54+
* @since 2.2.32
55+
*/
56+
Extension[] extensions() default {};
57+
}

0 commit comments

Comments
 (0)