🔌 Swagger Core v3 annotations supports
Supported annotations and fields
Supported annotations and fields currently are:
- io.swagger.v3.oas.annotations.Operation
- operationId (
String) - summary (
String) - description (
String) - parameters (
io.swagger.v3.oas.annotations.Parameter[]) - responses (
io.swagger.v3.oas.annotations.responses.ApiResponse[])
- operationId (
- io.swagger.v3.oas.annotations.responses.ApiResponse
- responseCode (
String) - description (
String) - content (
io.swagger.v3.oas.annotations.media.Content[])
- responseCode (
- io.swagger.v3.oas.annotations.media.Content
- schema (
io.swagger.v3.oas.annotations.media.Schema)
- schema (
- io.swagger.v3.oas.annotations.media.Schema
- implementation (
Class<?>) - description (
String) - example (
String)
- implementation (
- io.swagger.v3.oas.annotations.Parameters
- value (
io.swagger.v3.oas.annotations.Parameter[])
- value (
- io.swagger.v3.oas.annotations.Parameter
- name (
String) - in (
io.swagger.v3.oas.annotations.enums.ParameterIn) - description (
String) - required (
boolean) - schema (
io.swagger.v3.oas.annotations.media.Schema) - example (
String)
- name (
Examples
@Operation(summary = "Swagger summary",
operationId = "my-operation-id",
responses = {
@ApiResponse(description = "This is a successful operation"),
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(implementation = ErrorEntity.class))),
@ApiResponse(responseCode = "500", description = "Internal server error", content = @Content(schema = @Schema(implementation = ErrorEntity.class)))
})
@GetMapping("/some-api")
public ResponseEntity<String> myFunction() {
return ResponseEntity.ok("returnValue");
}
public class ErrorDto {
@Schema(description = "Timestamp of the error", example = "2023-10-01T12:00:00")
private LocalDateTime timestamp;
@Schema(description = "Session ID associated with the error", example = "session-12345")
private String sessionId;
}