-
-
Notifications
You must be signed in to change notification settings - Fork 580
Open
Description
Describe the bug
After upgrading to 2.8.15, the generated OpenAPI specification is missing properties defined with @Schema for custom classes used as path variables. Worked with 2.8.14.
To Reproduce
Steps to reproduce the behavior:
- What version of spring-boot you are using?
3.5.10 - What modules and versions of springdoc-openapi are you using?
springdoc-openapi-starter-webmvc-ui 2.8.15
springdoc-openapi-starter-common 2.8.15 - Actual json
...
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
...
- Expected json
...
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid",
"description": "Unique item identifier",
"example": "9d9d46e5-d41c-4774-885d-8e9dbc67735c"
}
}
],
...
- Sample code
@RestController
@RequestMapping("/api/demo")
public class DemoController {
@GetMapping("/items/{id}")
public String getItems(@PathVariable ItemId id) {
return id.value().toString();
}
}
@Schema(
type = "uuid",
description = "Unique item identifier",
example = "9d9d46e5-d41c-4774-885d-8e9dbc67735c")
public record ItemId(UUID value) {
public static ItemId fromString(String uuid) {
return new ItemId(UUID.fromString(uuid));
}
}
@Component
public class ItemIdConverter implements Converter<String, ItemId> {
@Override
public ItemId convert(String source) {
return ItemId.fromString(source);
}
}
Expected behavior
@Schema properties are present in the generated spec.
Additional context
Minimal reproducible example: https://github.com/timomantyvaara/springdoc-pathvariable
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels