### Usage Example — Full Operation Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/builders.md Complete example showing how to use the builders to create a full operation with request body and response. ```APIDOC ## Usage Example — Full Operation ### Description Complete example showing how to use the builders to create a full operation with request body and response. ### Code ```java import org.springdoc.core.fn.builders.*; RouterFunction route() { return SpringdocRouteBuilder.route() .POST("/pets", request -> ServerResponse.ok().body("created"), op -> op.operationId("createPet") .summary("Create a pet") .requestBody(RequestBodyUtil.requestBodyBuilder() .required(true) .content(ContentUtil.contentBuilder() .mediaType("application/json") .schema(SchemaUtil.schemaBuilder() .implementation(Pet.class)))) .response(ApiResponseUtils.responseBuilder() .responseCode("201") .description("Created") .implementation(Pet.class))) .build(); } ``` ``` -------------------------------- ### PathVersionStrategy example transformation Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/api-versioning.md Example showing how updateOperationPath transforms a path: with index 1 and version 'v2', '/v1/api/pets' becomes '/v2/api/pets'. ```java // "/v1/api/pets" with index 1 and version "v2" → "/v2/api/pets" ``` -------------------------------- ### Swagger UI configuration bean example Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/swagger-ui-config.md Example configuration class that customizes Swagger UI properties such as path, disabling default URL, enabling deep linking, enabling CSRF, and setting syntax highlight theme to monokai. ```java @Configuration public class UiConfig { @Bean SwaggerUiConfigProperties ui(SwaggerUiConfigProperties props) { props.setPath("/apidoc.html"); props.setDisableSwaggerDefaultUrl(true); props.setDeepLinking(true); props.getCsrf().setEnabled(true); props.getSyntaxHighlight().setTheme("monokai"); return props; } } ``` -------------------------------- ### GET /mcp-ui/** Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Serves the MCP dashboard static bundle from classpath:/mcp-ui/. Available when springdoc.ai.mcp.dashboard-enabled=true. ```APIDOC ## GET /mcp-ui/** ### Description Serves the MCP dashboard static bundle from classpath:/mcp-ui/. Available when springdoc.ai.mcp.dashboard-enabled=true. ### Method GET ### Endpoint /mcp-ui/** ### Response #### Success Response (200) - **Content-Type**: varies (static files) #### Response Example (Static file content) ``` -------------------------------- ### GET (all overloads) Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/springdoc-route-builder.md Registers a GET route with OpenAPI operation metadata. Four overloads are available: pattern, handler, predicate, and combinations. ```APIDOC ## GET (all overloads) ### Description Registers a GET route with the given handler and OpenAPI operation consumer. Multiple overloads allow specifying a pattern, predicate, or both. ### Method GET ### Endpoint Varies by overload: pattern, predicate, or both. ### Parameters #### Overload 1: GET(String pattern, HandlerFunction handlerFunction, Consumer operationsConsumer) - **pattern** (String) - Required - URL pattern for the route. - **handlerFunction** (HandlerFunction) - Required - Handler function for the route. - **operationsConsumer** (Consumer) - Required - Consumer to configure the OpenAPI operation. #### Overload 2: GET(HandlerFunction handlerFunction, Consumer operationsConsumer) - **handlerFunction** (HandlerFunction) - Required - Handler function for the route. - **operationsConsumer** (Consumer) - Required - Consumer to configure the OpenAPI operation. #### Overload 3: GET(RequestPredicate predicate, HandlerFunction handlerFunction, Consumer operationsConsumer) - **predicate** (RequestPredicate) - Required - Request predicate for matching. - **handlerFunction** (HandlerFunction) - Required - Handler function for the route. - **operationsConsumer** (Consumer) - Required - Consumer to configure the OpenAPI operation. #### Overload 4: GET(String pattern, RequestPredicate predicate, HandlerFunction handlerFunction, Consumer operationsConsumer) - **pattern** (String) - Required - URL pattern for the route. - **predicate** (RequestPredicate) - Required - Request predicate for matching. - **handlerFunction** (HandlerFunction) - Required - Handler function for the route. - **operationsConsumer** (Consumer) - Required - Consumer to configure the OpenAPI operation. ### Return Value - **SpringdocRouteBuilder** - This builder instance for chaining. ### Example ```java builder.GET("/api/users", handler, ops -> ops.operationId("getUsers")); ``` ``` -------------------------------- ### GET /swagger-ui/** Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Serves static assets from the swagger-ui webjar, including index.html, swagger-initializer.js, oauth2-redirect.html, and CSS/JS/images. ```APIDOC ## GET /swagger-ui/** ### Description Serves static assets from the swagger-ui webjar, including index.html, swagger-initializer.js, oauth2-redirect.html, and CSS/JS/images. ### Method GET ### Endpoint /swagger-ui/** ### Parameters #### Path Parameters - **path** (string) - Required - The path to the static asset (e.g., index.html, swagger-initializer.js). ### Response #### Success Response (200) - **body** (file) - The requested static asset. #### Response Example HTTP/1.1 200 OK Content-Type: text/html ... ``` -------------------------------- ### GET / Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/swagger-ui-endpoints.md Redirects to the Swagger UI page. The application root forwards to the Swagger UI path. ```APIDOC ## GET / ### Description Redirects to the Swagger UI page. The application root forwards to the Swagger UI path. ### Method GET ### Endpoint / ### Response #### Success Response (302) Redirect to the Swagger UI page. ``` -------------------------------- ### GET / Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Redirects to the Swagger UI path. Serves as a home page redirect. ```APIDOC ## GET / ### Description Redirects to the Swagger UI path. Serves as a home page redirect. ### Method GET ### Endpoint / ### Response #### Success Response (302) - **Location** (string) - The URL of the Swagger UI path. #### Response Example HTTP/1.1 302 Found Location: /swagger-ui/index.html ``` -------------------------------- ### OPTIONS (all overloads) Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/springdoc-route-builder.md Registers an OPTIONS route with OpenAPI operation metadata. Same overload matrix as GET. ```APIDOC ## OPTIONS (all overloads) ### Description Registers an OPTIONS route with the given handler and OpenAPI operation consumer. Overloads mirror GET. ### Method OPTIONS ### Endpoint Varies by overload: pattern, predicate, or both. ### Parameters Same as GET overloads, but for OPTIONS method. ### Return Value - **SpringdocRouteBuilder** - This builder instance for chaining. ### Example ```java builder.OPTIONS("/api/options", handler, ops -> ops.operationId("getOptions")); ``` ``` -------------------------------- ### SpringDocUtils configuration example Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/utils.md Shows how to use SpringDocUtils.getConfig() in a @Configuration class to replace a model class and add a file type. ```java import org.springdoc.core.utils.SpringDocUtils; @Configuration public class UtilsConfig { static { SpringDocUtils.getConfig() .replaceWithClass(oldDto.class, newDto.class) .addFileType(MultipartFile.class); } } ``` -------------------------------- ### POST (all overloads) Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/springdoc-route-builder.md Registers a POST route with OpenAPI operation metadata. Same overload matrix as GET. ```APIDOC ## POST (all overloads) ### Description Registers a POST route with the given handler and OpenAPI operation consumer. Overloads mirror GET. ### Method POST ### Endpoint Varies by overload: pattern, predicate, or both. ### Parameters Same as GET overloads, but for POST method. ### Return Value - **SpringdocRouteBuilder** - This builder instance for chaining. ### Example ```java builder.POST("/api/users", handler, ops -> ops.operationId("createUser")); ``` ``` -------------------------------- ### GET /v3/api-docs/swagger-config Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/swagger-ui-endpoints.md Serves the Swagger UI configuration JSON consumed by the UI's configUrl. ```APIDOC ## GET /v3/api-docs/swagger-config ### Description Serves the Swagger UI configuration JSON consumed by the UI's configUrl. ### Method GET ### Endpoint /v3/api-docs/swagger-config ### Response #### Success Response (200) Returns a JSON object containing the Swagger UI configuration. #### Response Example { "configUrl": "/v3/api-docs/swagger-config" } ``` -------------------------------- ### HEAD (all overloads) Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/springdoc-route-builder.md Registers a HEAD route with OpenAPI operation metadata. Same overload matrix as GET. ```APIDOC ## HEAD (all overloads) ### Description Registers a HEAD route with the given handler and OpenAPI operation consumer. Overloads mirror GET. ### Method HEAD ### Endpoint Varies by overload: pattern, predicate, or both. ### Parameters Same as GET overloads, but for HEAD method. ### Return Value - **SpringdocRouteBuilder** - This builder instance for chaining. ### Example ```java builder.HEAD("/api/status", handler, ops -> ops.operationId("getStatus")); ``` ``` -------------------------------- ### operationBuilder() Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/builders.md Starts a new operation builder. All methods return Builder for chaining. ```APIDOC ## operationBuilder() ### Description Starts a new operation builder. All methods return Builder for chaining. ### Method N/A ### Endpoint N/A ### Parameters None ### Request Example N/A ### Response #### Success Response - **Builder** - A new operation builder instance. #### Response Example N/A ``` -------------------------------- ### Full operation with SpringdocRouteBuilder Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/builders.md Java example showing how to build a RouterFunction with a POST endpoint, including request body and response configuration using SpringDoc builders. ```java import org.springdoc.core.fn.builders.*; RouterFunction route() { return SpringdocRouteBuilder.route() .POST("/pets", request -> ServerResponse.ok().body("created"), op -> op.operationId("createPet") .summary("Create a pet") .requestBody(RequestBodyUtil.requestBodyBuilder() .required(true) .content(ContentUtil.contentBuilder() .mediaType("application/json") .schema(SchemaUtil.schemaBuilder() .implementation(Pet.class)))) .response(ApiResponseUtils.responseBuilder() .responseCode("201") .description("Created") .implementation(Pet.class))) .build(); } ``` -------------------------------- ### Swagger UI properties example Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/swagger-ui-endpoints.md Shows commented-out properties for customizing the Swagger UI path and behavior via springdoc.swagger-ui.* properties. ```java // Custom UI path and config through properties: // springdoc.swagger-ui.path=/apidocs.html // springdoc.swagger-ui.disable-swagger-default-url=true // springdoc.swagger-ui.document-title=My API ``` -------------------------------- ### GET /api/mcp-admin/tools Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Lists all MCP tools as JSON. Each tool includes name, description, inputSchema, httpMethod, path, group, safe, and requiresApproval. ```APIDOC ## GET /api/mcp-admin/tools ### Description Lists all MCP tools as JSON. Each tool includes name, description, inputSchema, httpMethod, path, group, safe, and requiresApproval. ### Method GET ### Endpoint /api/mcp-admin/tools ### Response #### Success Response (200) - **Content-Type**: application/json - **Body**: List - **name** (string) - Tool name - **description** (string) - Tool description - **inputSchema** (object) - JSON schema for tool arguments - **httpMethod** (string) - HTTP method of the underlying operation - **path** (string) - Path of the underlying operation - **group** (string) - API group - **safe** (boolean) - Whether the tool is safe - **requiresApproval** (boolean) - Whether the tool requires approval #### Response Example [ { "name": "string", "description": "string", "inputSchema": {}, "httpMethod": "string", "path": "string", "group": "string", "safe": true, "requiresApproval": false } ] ``` -------------------------------- ### GET /v3/api-docs/swagger-config Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Returns a JSON map of Swagger UI configuration parameters. The path is configurable via springdoc.api-docs.path. ```APIDOC ## GET /v3/api-docs/swagger-config ### Description Returns a JSON map of Swagger UI configuration parameters. The path is configurable via springdoc.api-docs.path. ### Method GET ### Endpoint /v3/api-docs/swagger-config ### Parameters #### Query Parameters - **path** (string) - Optional - The base path for API docs (default `/v3/api-docs`). ### Response #### Success Response (200) - **body** (object) - JSON map of Swagger UI config parameters (urls, oauth2RedirectUrl, layout, filter, displayOperationId, etc.). #### Response Example { "urls": [], "oauth2RedirectUrl": "/swagger-ui/oauth2-redirect.html", "layout": "StandaloneLayout" } ``` -------------------------------- ### GET {actuator}/swagger-ui/ Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Redirects to the Swagger UI on the management port. The {actuator} base path defaults to /actuator. ```APIDOC ## GET {actuator}/swagger-ui/ ### Description Redirects to the Swagger UI on the management port. The {actuator} base path defaults to /actuator. ### Method GET ### Endpoint {actuator}/swagger-ui/ ### Parameters #### Path Parameters - **actuator** (string) - Required - The actuator web endpoint base path (default `/actuator`). ### Response #### Success Response (302) - **Location** (string) - The URL of the Swagger UI index on the management port. #### Response Example HTTP/1.1 302 Found Location: /actuator/swagger-ui/index.html ``` -------------------------------- ### Content.Builder methods Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/builders.md Builder for Content. Use contentBuilder() to create a new builder, then chain setter methods for media type, example, schema, array, encoding, and extensions. Call build() to produce the Content. ```java public static Builder contentBuilder() public Builder mediaType(String mediaType) public Builder example(org.springdoc.core.fn.builders.exampleobject.Builder exampleObjectBuilder) public Builder schema(org.springdoc.core.fn.builders.schema.Builder schemaBuilder) public Builder array(org.springdoc.core.fn.builders.arrayschema.Builder arraySchemaBuilder) public Builder encoding(org.springdoc.core.fn.builders.encoding.Builder encodingBuilder) public Builder extension(org.springdoc.core.fn.builders.extension.Builder extensionBuilder) public Content build() ``` -------------------------------- ### GET /scalar/scalar.js Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Returns the JavaScript bundle for the Scalar UI. Also available at the relative path /scalar.js. ```APIDOC ## GET /scalar/scalar.js ### Description Returns the JavaScript bundle for the Scalar UI. Also available at the relative path /scalar.js. ### Method GET ### Endpoint /scalar/scalar.js ### Response #### Success Response (200) - **Content-Type**: application/javascript #### Response Example (JavaScript bundle content) ``` -------------------------------- ### GET /api/mcp-admin/tools Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/mcp.md Lists all available MCP tools with their metadata, including name, description, input schema, HTTP method, path, group, and safety flags. ```APIDOC ## GET /api/mcp-admin/tools ### Description Lists all available MCP tools with their metadata, including name, description, input schema, HTTP method, path, group, and safety flags. ### Method GET ### Endpoint /api/mcp-admin/tools ### Response #### Success Response (200) - **List** - Array of tool information objects. #### Response Example ```json [ { "name": "string", "description": "string", "inputSchema": "object", "httpMethod": "string", "path": "string", "group": "string", "safe": true, "requiresApproval": false } ] ``` ``` -------------------------------- ### PUT (all overloads) Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/springdoc-route-builder.md Registers a PUT route with OpenAPI operation metadata. Same overload matrix as GET. ```APIDOC ## PUT (all overloads) ### Description Registers a PUT route with the given handler and OpenAPI operation consumer. Overloads mirror GET. ### Method PUT ### Endpoint Varies by overload: pattern, predicate, or both. ### Parameters Same as GET overloads, but for PUT method. ### Return Value - **SpringdocRouteBuilder** - This builder instance for chaining. ### Example ```java builder.PUT("/api/users/{id}", handler, ops -> ops.operationId("updateUser")); ``` ``` -------------------------------- ### SwaggerUiHome class Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/swagger-ui-endpoints.md GET / returns a redirect view (redirect: + servlet path + swagger-ui path) so the application root forwards to Swagger UI. ```java @Controller public class SwaggerUiHome { @Value(SWAGGER_UI_PATH) private String swaggerUiPath; // /swagger-ui.html by default @Value(MVC_SERVLET_PATH) private String mvcServletPath; @GetMapping(DEFAULT_PATH_SEPARATOR) @Operation(hidden = true) public String index() } ``` -------------------------------- ### VersioningConfig bean for SpringDocApiVersionStrategy Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/api-versioning.md Example configuration class for setting up versioning. With spring.web.mvc.versioning configured, springdoc detects the strategy and renders versioned paths/headers/produces in the OpenAPI document. ```java @Configuration public class VersioningConfig { // with spring.web.mvc.versioning configured, springdoc detects the strategy // and renders versioned paths/headers/produces in the OpenAPI document. } ``` -------------------------------- ### GET {actuator}/swagger-ui/swagger-config Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Returns the Swagger UI configuration JSON on the management port. The {actuator} base path defaults to /actuator. ```APIDOC ## GET {actuator}/swagger-ui/swagger-config ### Description Returns the Swagger UI configuration JSON on the management port. The {actuator} base path defaults to /actuator. ### Method GET ### Endpoint {actuator}/swagger-ui/swagger-config ### Parameters #### Path Parameters - **actuator** (string) - Required - The actuator web endpoint base path (default `/actuator`). ### Response #### Success Response (200) - **body** (object) - JSON map of Swagger UI config parameters. #### Response Example { "urls": [], "oauth2RedirectUrl": "/actuator/swagger-ui/oauth2-redirect.html" } ``` -------------------------------- ### GET /v3/api-docs.yaml Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/open-api-resources.md Returns the OpenAPI document in YAML format. This endpoint is exposed by the OpenApiWebMvcResource controller and produces application/vnd.oai.openapi. ```APIDOC ## GET /v3/api-docs.yaml ### Description Returns the OpenAPI document in YAML format. ### Method GET ### Endpoint /v3/api-docs.yaml ### Parameters #### Path Parameters - **apiDocsUrl** (string) - Required - The resolved API docs URL (default `/v3/api-docs.yaml`). #### Query Parameters - **locale** (Locale) - Optional - The locale for the response. ### Response #### Success Response (200) - **body** (byte[]) - The OpenAPI document in YAML format. #### Response Example openapi: 3.0.1 info: title: API version: 1.0.0 ``` -------------------------------- ### AbstractSpringDocApiVersionStrategy class methods Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/api-versioning.md Constructor and isSpringDocPath method. isSpringDocPath returns true if path starts with a configured springdoc path followed by end-of-string, '/', or '.'. ```java public abstract class AbstractSpringDocApiVersionStrategy { protected AbstractSpringDocApiVersionStrategy(List springDocPaths) {} protected boolean isSpringDocPath(String path) {} } ``` -------------------------------- ### GET {actuator}/openapi/yaml Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Retrieves the OpenAPI document in YAML format from the actuator management port. The {actuator} base path defaults to /actuator. ```APIDOC ## GET {actuator}/openapi/yaml ### Description Retrieves the OpenAPI document in YAML format from the actuator management port. The {actuator} base path defaults to /actuator. ### Method GET ### Endpoint {actuator}/openapi/yaml ### Parameters #### Path Parameters - **actuator** (string) - Required - The actuator web endpoint base path (default `/actuator`). ### Response #### Success Response (200) - **body** (string) - The OpenAPI document in YAML format. #### Response Example openapi: 3.0.1 info: title: API paths: {} ``` -------------------------------- ### GET {actuator}/openapi Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Retrieves the OpenAPI document in JSON format from the actuator management port. The {actuator} base path defaults to /actuator. ```APIDOC ## GET {actuator}/openapi ### Description Retrieves the OpenAPI document in JSON format from the actuator management port. The {actuator} base path defaults to /actuator. ### Method GET ### Endpoint {actuator}/openapi ### Parameters #### Path Parameters - **actuator** (string) - Required - The actuator web endpoint base path (default `/actuator`). ### Response #### Success Response (200) - **body** (object) - The OpenAPI document in JSON format. #### Response Example { "openapi": "3.0.1", "info": {}, "paths": {} } ``` -------------------------------- ### Register multiple GroupedOpenApi beans with List Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/grouped-open-api.md Define a @Configuration class with a @Bean method returning List. The list is picked up by MultipleOpenApiSupportConfiguration / MultipleOpenApiWebMvcResource and exposed via /v3/api-docs/{group} and /v3/api-docs.yaml/{group}. The example shows two groups: 'users' with packagesToScan and a customizer, and 'orders' with pathsToMatch and an operation customizer. ```java import org.springdoc.core.models.GroupedOpenApi; @Configuration public class GroupConfig { @Bean List groupedOpenApis(OpenApiCustomizer myCustomizer) { return List.of( GroupedOpenApi.builder() .group("users") .packagesToScan("com.example.users") .displayName("User Service") .addOpenApiCustomizer(myCustomizer) .build(), GroupedOpenApi.builder() .group("orders") .pathsToMatch("/orders/**") .addOperationCustomizer((operation, handlerMethod) -> operation.addExtension("x-source", "orders")) .build() ); } } ``` -------------------------------- ### getDefaultAllowedHttpMethods method Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/abstract-open-api-resource.md Returns {GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD} — used when a mapping has no explicit methods. ```java protected Set getDefaultAllowedHttpMethods() ``` -------------------------------- ### GET /v3/api-docs.yaml Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Retrieves the OpenAPI document in YAML format. This endpoint is served by the springdoc-openapi starter and returns the API specification as a YAML byte array. ```APIDOC ## GET /v3/api-docs.yaml ### Description Retrieves the OpenAPI document in YAML format. This endpoint is served by the springdoc-openapi starter and returns the API specification as a YAML byte array. ### Method GET ### Endpoint /v3/api-docs.yaml ### Parameters #### Query Parameters - None explicitly documented. ### Request Example No request body or query parameters are required. ### Response #### Success Response (200) - **Content-Type**: application/vnd.oai.openapi - **Body**: OpenAPI YAML document as byte array #### Response Example No example response body is provided in the source. ### Error Handling - **500 Internal Server Error**: Returned on serialization failure. ``` -------------------------------- ### GET /v3/api-docs Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Retrieves the OpenAPI document in JSON format. This endpoint is served by the springdoc-openapi starter and returns the API specification as a JSON byte array. ```APIDOC ## GET /v3/api-docs ### Description Retrieves the OpenAPI document in JSON format. This endpoint is served by the springdoc-openapi starter and returns the API specification as a JSON byte array. ### Method GET ### Endpoint /v3/api-docs ### Parameters #### Query Parameters - None explicitly documented. ### Request Example No request body or query parameters are required. ### Response #### Success Response (200) - **Content-Type**: application/json - **Body**: OpenAPI JSON document as byte array #### Response Example No example response body is provided in the source. ### Error Handling - **500 Internal Server Error**: Returned on serialization failure (JsonProcessingException). ``` -------------------------------- ### AbstractSwaggerWelcome protected methods Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/swagger-ui-endpoints.md Protected methods of AbstractSwaggerWelcome. init registers each group config (group, displayName) into the parameters and calculates the UI root path. buildUrl avoids duplicating overlapping path prefixes (pathOverlap logic, issue #3294). buildConfigUrl resolves url/urls, and when queryConfigEnabled=true, getUriComponentsBuilder turns configuration parameters into query parameters (excluding configUrl, oauth2RedirectUrl, url, urls*). ```java protected void init(SwaggerUiConfigParameters swaggerUiConfigParameters) protected void buildUrl(String contextPath, String docsUrl) protected void buildConfigUrl(SwaggerUiConfigParameters swaggerUiConfigParameters, UriComponentsBuilder uriComponentsBuilder) protected abstract String buildUrlWithContextPath(SwaggerUiConfigParameters swaggerUiConfigParameters, String swaggerUiUrl) protected UriComponentsBuilder getUriComponentsBuilder(SwaggerUiConfigParameters swaggerUiConfigParameters, String sbUrl) protected abstract void calculateOauth2RedirectUrl(SwaggerUiConfigParameters swaggerUiConfigParameters, UriComponentsBuilder uriComponentsBuilder) protected void calculateUiRootPath(SwaggerUiConfigParameters swaggerUiConfigParameters, StringBuilder... sbUrls) protected void calculateUiRootCommon(SwaggerUiConfigParameters swaggerUiConfigParameters, StringBuilder sbUrl, StringBuilder[] sbUrls) protected void buildApiDocUrl(SwaggerUiConfigParameters swaggerUiConfigParameters) protected void buildSwaggerConfigUrl(SwaggerUiConfigParameters swaggerUiConfigParameters) protected String getOauth2RedirectUrl() protected String getSwaggerUiUrl() // "/swagger-ui/index.html" ``` -------------------------------- ### GET verb overloads for SpringdocRouteBuilder Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/springdoc-route-builder.md Four overloads for the GET verb, each combining a pattern, predicate, and/or handler with an operations consumer. The same overload matrix applies to HEAD, POST, PUT, PATCH, DELETE, and OPTIONS. ```java public SpringdocRouteBuilder GET(String pattern, HandlerFunction handlerFunction, Consumer operationsConsumer) public SpringdocRouteBuilder GET(HandlerFunction handlerFunction, Consumer operationsConsumer) public SpringdocRouteBuilder GET(RequestPredicate predicate, HandlerFunction handlerFunction, Consumer operationsConsumer) public SpringdocRouteBuilder GET(String pattern, RequestPredicate predicate, HandlerFunction handlerFunction, Consumer operationsConsumer) ``` -------------------------------- ### customizeOperation and customizeRouterOperation methods Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/abstract-open-api-resource.md Runs OperationCustomizer / RouterOperationCustomizer streams; GlobalOperationComponentsCustomizer instances receive the Components. ```java protected Operation customizeOperation(Operation operation, Components components, HandlerMethod handlerMethod) protected RouterOperation customizeRouterOperation(RouterOperation routerOperation, HandlerMethod handlerMethod) ``` -------------------------------- ### Example usage of @RouterOperations on a component Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/annotations.md Shows how to apply @RouterOperations to a Spring component to group multiple @RouterOperation entries, each defining a path, HTTP method, and operation metadata. ```java import org.springdoc.core.annotations.*; @Component @RouterOperations({ @RouterOperation(path = "/a", method = {RequestMethod.GET}, operation = @Operation(operationId = "opA")), @RouterOperation(path = "/b", method = {RequestMethod.POST}, operation = @Operation(operationId = "opB")) }) public class MyRoutes { } ``` -------------------------------- ### Example — annotate a controller method with @RouterOperation Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/annotations.md Shows how to apply @RouterOperation to a Spring MVC controller method, specifying path, HTTP method, produces, and an @Operation summary. The @GetMapping annotation is also present, and the method returns a Book object. ```java import org.springdoc.core.annotations.RouterOperation; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api") public class BookController { @RouterOperation( path = "/books/{id}", method = { RequestMethod.GET }, produces = { "application/json" }, operation = @Operation(summary = "Fetch a book by id", tags = {"books"}) ) @GetMapping("/books/{id}") public Book getBook(@PathVariable String id) { /* ... */ return null; } } ``` -------------------------------- ### exampleobject.Builder Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/builders.md Builder for constructing an ExampleObject in OpenAPI specifications. ```APIDOC ## exampleobject.Builder ### Description Builder for constructing an ExampleObject in OpenAPI specifications. ### Methods - `exampleOjectBuilder()` - Factory method to create a new builder instance (literal factory name in source, typo preserved). - `name` - Sets the name of the example. - `summary` - Sets the summary of the example. - `value(String)` - Sets the value of the example. - `externalValue(String)` - Sets the external value URL of the example. - `extension` - Adds an extension to the example. - `ref` - Sets a reference to a reusable example. - `description` - Sets the description of the example. - `build()` - Builds the ExampleObject. ``` -------------------------------- ### build() Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/builders.md Builds a RouterOperation from the configured values. ```APIDOC ## build() ### Description Builds a RouterOperation from the configured values. ### Method N/A ### Endpoint N/A ### Parameters None ### Request Example N/A ### Response #### Success Response - **RouterOperation** - The built RouterOperation. #### Response Example N/A ``` -------------------------------- ### Build project with Maven Source: https://github.com/springdoc/springdoc-openapi/blob/main/CONTRIBUTING.adoc Builds the springdoc-openapi project from the root directory using Maven on JDK 1.8 or above. ```bash $ ./mvn install ``` -------------------------------- ### DELETE (all overloads) Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/springdoc-route-builder.md Registers a DELETE route with OpenAPI operation metadata. Same overload matrix as GET. ```APIDOC ## DELETE (all overloads) ### Description Registers a DELETE route with the given handler and OpenAPI operation consumer. Overloads mirror GET. ### Method DELETE ### Endpoint Varies by overload: pattern, predicate, or both. ### Parameters Same as GET overloads, but for DELETE method. ### Return Value - **SpringdocRouteBuilder** - This builder instance for chaining. ### Example ```java builder.DELETE("/api/users/{id}", handler, ops -> ops.operationId("deleteUser")); ``` ``` -------------------------------- ### PATCH (all overloads) Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/springdoc-route-builder.md Registers a PATCH route with OpenAPI operation metadata. Same overload matrix as GET. ```APIDOC ## PATCH (all overloads) ### Description Registers a PATCH route with the given handler and OpenAPI operation consumer. Overloads mirror GET. ### Method PATCH ### Endpoint Varies by overload: pattern, predicate, or both. ### Parameters Same as GET overloads, but for PATCH method. ### Return Value - **SpringdocRouteBuilder** - This builder instance for chaining. ### Example ```java builder.PATCH("/api/users/{id}", handler, ops -> ops.operationId("patchUser")); ``` ``` -------------------------------- ### Nested SyntaxHighlight class Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/swagger-ui-config.md Nested SyntaxHighlight class with fields for activation and theme selection. ```java public static class SyntaxHighlight { private Boolean activated; private String theme; // getters/setters } ``` -------------------------------- ### GET {actuator}/scalar Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Returns the Scalar page on the management port. This endpoint is available when actuator is enabled. ```APIDOC ## GET {actuator}/scalar ### Description Returns the Scalar page on the management port. This endpoint is available when actuator is enabled. ### Method GET ### Endpoint {actuator}/scalar ### Response #### Success Response (200) - **Content-Type**: text/html #### Response Example (HTML content of the Scalar API reference page) ``` -------------------------------- ### MediaTypeVersionStrategy class methods Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/api-versioning.md Constructor and methods for MediaTypeVersionStrategy. buildProduces() returns a single produces media type like 'application/json;v=v2'. versionDefaultMap registers parameterName to defaultVersion. ```java public MediaTypeVersionStrategy(MediaType mediaType, String parameterName, String defaultVersion) public MediaType getMediaType() public String getParameterName() public String[] buildProduces() ``` -------------------------------- ### GET /swagger-ui.html Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Redirects to the Swagger UI index page. The redirect target is determined by the springdoc.swagger-ui.path property. ```APIDOC ## GET /swagger-ui.html ### Description Redirects to the Swagger UI index page. The redirect target is determined by the springdoc.swagger-ui.path property. ### Method GET ### Endpoint /swagger-ui.html ### Response #### Success Response (302) - **Location** (string) - The URL of the Swagger UI index page. #### Response Example HTTP/1.1 302 Found Location: /swagger-ui/index.html ``` -------------------------------- ### GET /api/mcp-admin/audit Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/mcp.md Retrieves a list of audit events, limited by the provided limit parameter (default 200). ```APIDOC ## GET /api/mcp-admin/audit ### Description Retrieves a list of audit events, limited by the provided limit parameter (default 200). ### Method GET ### Endpoint /api/mcp-admin/audit ### Parameters #### Query Parameters - **limit** (int) - Optional - Maximum number of audit events to return. Default is 200. ### Response #### Success Response (200) - **List** - Array of audit event strings. #### Response Example ```json [ "string" ] ``` ``` -------------------------------- ### Java controller excluded from tools with @McpIgnore Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/mcp.md Example of a REST controller annotated with @McpIgnore to exclude it from MCP tools. ```java // Exclude a controller from tools @RestController @McpIgnore public class AdminController { /* ... */ } ``` -------------------------------- ### SpringDocUtils.getParentTypeName(AnnotatedType type, Class cls) Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/utils.md Gets the parent type name for a given annotated type and class. ```APIDOC ## SpringDocUtils.getParentTypeName(AnnotatedType type, Class cls) ### Description Resolves the parent type name for the given annotated type and class. ### Method static ### Signature `public static String getParentTypeName(AnnotatedType type, Class cls)` ### Parameters - **type** (AnnotatedType) - Required - The annotated type. - **cls** (Class) - Required - The class to resolve. ### Returns - **String** - The parent type name. ``` -------------------------------- ### GET /v3/api-docs Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/open-api-resources.md Returns the OpenAPI document in JSON format. This endpoint is exposed by the OpenApiWebMvcResource controller and produces application/json. ```APIDOC ## GET /v3/api-docs ### Description Returns the OpenAPI document in JSON format. ### Method GET ### Endpoint /v3/api-docs ### Parameters #### Path Parameters - **apiDocsUrl** (string) - Required - The resolved API docs URL (default `/v3/api-docs`). #### Query Parameters - **locale** (Locale) - Optional - The locale for the response. ### Response #### Success Response (200) - **body** (byte[]) - The OpenAPI document in JSON format. #### Response Example { "openapi": "3.0.1", "info": { "title": "API", "version": "1.0.0" } } ``` -------------------------------- ### Enable MCP integration in application.properties Source: https://github.com/springdoc/springdoc-openapi/blob/main/springdoc-openapi-starter-common-mcp/README.md Property to enable the MCP surface. The integration is opt-in; adding the starter alone does not register anything. Set springdoc.ai.mcp.enabled=true in your application.properties. ```properties springdoc.ai.mcp.enabled=true ``` -------------------------------- ### Custom SwaggerIndexTransformer bean Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/swagger-ui-endpoints.md Defines a custom SwaggerIndexTransformer bean to post-process index.html. The transformer returns the resource unchanged in this example. ```java @Configuration public class UiCustomization { @Bean SwaggerIndexTransformer customTransformer() { // SwaggerIndexTransformer extends ResourceTransformer; return a transformer // that post-processes index.html return (request, resource, transformerChain) -> { // ... mutate resource content return resource; }; } } ``` -------------------------------- ### application.properties for MCP configuration Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/mcp.md Properties to enable MCP, set the endpoint, enable dashboard, require approval for mutating tools, and exclude paths. ```properties # application.properties springdoc.ai.mcp.enabled=true springdoc.ai.mcp.mcp-endpoint=/mcp springdoc.ai.mcp.dashboard-enabled=true springdoc.ai.mcp.guardrails.require-approval-for-mutating-tools=true springdoc.ai.mcp.paths-to-exclude=/internal/**,/admin/** ``` -------------------------------- ### ScalarConfiguration auto-configuration class Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/scalar.md Spring auto-configuration for the scalar starters. Uses @ConditionalOnProperty with SCALAR_ENABLED (scalar.enabled) and @ConditionalOnWebApplication(Type.SERVLET). Defines beans for ScalarWebMvcController and SpringDocAppInitializer, plus a nested static class for actuator welcome configuration. The WebFlux starter mirrors this with Type.REACTIVE. ```java @Lazy(false) @Configuration(proxyBeanMethods = false) @AutoConfigureAfter(SpringDocConfiguration.class) @ConditionalOnProperty(name = SCALAR_ENABLED, matchIfMissing = true) // "scalar.enabled" @ConditionalOnWebApplication(type = Type.SERVLET) @ConditionalOnBean(SpringDocConfiguration.class) @EnableConfigurationProperties(SpringBootScalarProperties.class) public class ScalarConfiguration { @Bean @ConditionalOnProperty(name = SPRINGDOC_USE_MANAGEMENT_PORT, havingValue = "false", matchIfMissing = true) @ConditionalOnMissingBean ScalarWebMvcController scalarWebMvcController(ScalarProperties scalarProperties, SpringDocConfigProperties springDocConfigProperties) @Bean @ConditionalOnMissingBean(name = "springDocScalarInitializer") @ConditionalOnProperty(name = SPRINGDOC_USE_MANAGEMENT_PORT, havingValue = "false", matchIfMissing = true) SpringDocAppInitializer springDocScalarInitializer(ScalarProperties scalarProperties) @ConditionalOnProperty(SPRINGDOC_USE_MANAGEMENT_PORT) @ConditionalOnClass(WebMvcEndpointHandlerMapping.class) @ConditionalOnManagementPort(ManagementPortType.DIFFERENT) static class ScalarActuatorWelcomeConfiguration { ... } } ``` -------------------------------- ### Enable MCP Dashboard Source: https://github.com/springdoc/springdoc-openapi/blob/main/springdoc-openapi-starter-common-mcp/README.md Enable the built-in MCP Developer Dashboard web UI, served at the configured dashboard-path (default: /mcp-ui). ```properties springdoc.ai.mcp.dashboard-enabled=true ``` -------------------------------- ### SecurityService constructor and methods Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/services.md Shows the constructor and public methods of SecurityService. The constructor takes PropertyResolverUtils. Methods retrieve security requirements for methods and classes, and build security requirements. ```java public SecurityService(PropertyResolverUtils propertyResolverUtils) public io.swagger.v3.oas.annotations.security.SecurityRequirement[] getSecurityRequirements(Method method, ...) public Set getSecurityRequirementsForMethod(Method method, Set<...> allSecurityTags) public Set getSecurityRequirementsForClass(Class beanType) public Optional> getSecurityRequirements(...) public void buildSecurityRequirement(...) ``` -------------------------------- ### GET {actuator}/swagger-ui/ Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/swagger-ui-endpoints.md Redirects to the Swagger UI page. This endpoint is part of the actuator variant and is anchored at the actuator base path. ```APIDOC ## GET {actuator}/swagger-ui/ ### Description Redirects to the Swagger UI page. This endpoint is part of the actuator variant and is anchored at the actuator base path. ### Method GET ### Endpoint {actuator}/swagger-ui/ ### Parameters #### Path Parameters - **actuator** (string) - Required - The base path for actuator endpoints, as configured by `webEndpointProperties.getBasePath()`. ### Response #### Success Response (302) Redirect to the Swagger UI page. ``` -------------------------------- ### GET /v3/api-docs.yaml/{group} Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Retrieves the OpenAPI document for a specific group in YAML format. The group name is specified as a path parameter. ```APIDOC ## GET /v3/api-docs.yaml/{group} ### Description Retrieves the OpenAPI document for a specific group in YAML format. The group name is specified as a path parameter. ### Method GET ### Endpoint /v3/api-docs.yaml/{group} ### Parameters #### Path Parameters - **group** (string) - Required - The group name from GroupedOpenApi.group or springdoc.group-configs[x].group. ### Request Example No request body is required. ### Response #### Success Response (200) - **Content-Type**: application/vnd.oai.openapi - **Body**: OpenAPI YAML document for the specified group #### Response Example No example response body is provided in the source. ### Error Handling - **404 Not Found**: Returned when the group is unknown, with JSON body: {"id":"","message":"No OpenAPI resource found for group: "}. ``` -------------------------------- ### GET /v3/api-docs/{group} Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Retrieves the OpenAPI document for a specific group in JSON format. The group name is specified as a path parameter. ```APIDOC ## GET /v3/api-docs/{group} ### Description Retrieves the OpenAPI document for a specific group in JSON format. The group name is specified as a path parameter. ### Method GET ### Endpoint /v3/api-docs/{group} ### Parameters #### Path Parameters - **group** (string) - Required - The group name from GroupedOpenApi.group or springdoc.group-configs[x].group. ### Request Example No request body is required. ### Response #### Success Response (200) - **Content-Type**: application/json - **Body**: OpenAPI JSON document for the specified group #### Response Example No example response body is provided in the source. ### Error Handling - **404 Not Found**: Returned when the group is unknown, with JSON body: {"id":"","message":"No OpenAPI resource found for group: "}. ``` -------------------------------- ### HeaderVersionStrategy constructor and getter Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/api-versioning.md Constructor registers the header name and default version in the version default map when a default version is provided, making the versioned header appear in generated parameters. ```java public HeaderVersionStrategy(String headerName, String defaultVersion) public String getHeaderName() ``` -------------------------------- ### OpenAPIService key methods Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/services.md Public methods of OpenAPIService for building and manipulating the OpenAPI document, including build, updateServers, buildTags, resolveProperties, calculateServerBaseUrl, getWebhooks, and more. ```java public OpenAPI build(Locale locale) public void updateServers(String serverBaseUrl, OpenAPI openAPI) public void setServersPresent(boolean serversPresent) public Operation buildTags(HandlerMethod handlerMethod, Operation operation, OpenAPI openAPI, Locale locale) public void buildTagsFromClass(Class beanType, Set tags, Set tagsStr, Locale locale) public Schema resolveProperties(Schema schema, Locale locale) public String calculateServerBaseUrl(String serverBaseUrl, HttpRequest httpRequest) public Webhooks[] getWebhooks(Class[] classes) public Class[] getWebhooksClasses() public boolean isAutoTagClasses(Operation operation) public void addTag(Set handlerMethods, io.swagger.v3.oas.models.tags.Tag tag) public Map getMappingsMap() public void addMappings(Map mappings) public Map getControllerAdviceMap() public OpenAPI getCachedOpenAPI(Locale locale) public void setCachedOpenAPI(OpenAPI cachedOpenAPI, Locale locale) public ApplicationContext getContext() public SecurityService getSecurityParser() public void setApplicationContext(ApplicationContext applicationContext) throws BeansException public static String splitCamelCase(String str) ``` -------------------------------- ### GET /api/mcp-admin/audit?limit=200 Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/endpoints.md Returns a list of recent audit events. The limit query parameter controls the maximum number of events returned. ```APIDOC ## GET /api/mcp-admin/audit?limit=200 ### Description Returns a list of recent audit events. The limit query parameter controls the maximum number of events returned. ### Method GET ### Endpoint /api/mcp-admin/audit ### Query Parameters - **limit** (integer) - Optional - Maximum number of audit events to return (default: 200) ### Response #### Success Response (200) - **Content-Type**: application/json - **Body**: List #### Response Example [ "string" ] ``` -------------------------------- ### getConfigParameters method signature Source: https://github.com/springdoc/springdoc-openapi/blob/main/_autodocs/api-reference/swagger-ui-config.md Returns a TreeMap of non-null OAuth parameters including clientId, clientSecret, realm, scopeSeparator, appName, scopes (joined with space), useBasicAuthenticationWithAccessCodeGrant, usePkceWithAuthorizationCodeGrant, and additionalQueryStringParams. Null values are omitted. ```java public Map getConfigParameters() ```