openapi_3_1 SwaggerUI does not display custom extensions
Describe the bug
When configuring springdoc.api-docs.version=openapi_3_1, SwaggerUI does not display custom extensions defined in the OpenAPI specification.
The extensions are visible in the OpenAPI JSON or YAML output but do not appear in the SwaggerUI interface.
To Reproduce Steps to reproduce the behavior:
- What version of spring-boot you are using ?
spring-boot-*:3.3.2
- What modules and versions of springdoc-openapi are you using?
springdoc-openapi-starter-common:2.6.0 springdoc-openapi-starter-webmvc-api:2.6.0 springdoc-openapi-starter-webmvc-ui:2.6.0
- What is the actual and the expected result using OpenAPI Description (yml or json)?
openapi: 3.1.0
info:
title: API
servers:
- description: Generated server url
url: http://localhost:8080/api
paths:
get:
description: Fetch Obj
operationId: fetchObj
parameters:
- description: id of the obj
in: path
name: objId
required: true
schema:
type:
- integer
format: int64
example: null
responses:
"200":
content:
'*/*':
schema:
$ref: "#/components/schemas/ObjV1"
example: null
description: obj
components:
schemas:
ObjV1:
description: obj
example: null
properties:
description:
type:
- string
description: description of the obj
example: null
maxLength: 255
minLength: 0
id:
type:
- integer
format: int64
description: id of the obj
example: null
readOnly: true
name:
type:
- string
format: uri
description: desc
example: null
x-custom-extension:
maxLength: 255
- Provide with a sample code (HelloController) or Test that reproduces the problem
/**
* Obj
*
* @param id id of the obj
* @param name
*/
public record ObjV1(
@Schema(accessMode = Schema.AccessMode.READ_ONLY) long id,
@Schema( extensions = {@Extension(name = "x-custom-extension", properties = {@ExtensionProperty(name = "maxLength", value = "255", parseValue = true)})}) @Nullable String name
) {
}
Expected behavior
Custom extensions defined in the OpenAPI specification should be visible in SwaggerUI.
For instance, x-custom-extension should appear under the relevant schema properties in the SwaggerUI interface.
Additional context
It works as expected for springdoc.api-docs.version=openapi_3_0