You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Java attribute of type object is incorrectly mapped to an OpenApi property of type object #4457
A Java attribute of type object can be any instance of an object, e.g. String, Boolean, Long and so on. However, the resulting OpenApi specification assigns this attribute to an object of type object, which must be a JSON object, that is a map.
Example
The following java class can be used as a minimal example:
publicclassPet{
privateLongid;
@Schema(description = "A string, a number or a boolean", anyOf = { String.class, Number.class, Boolean.class })
privateObjectname;
}
This generates the following openapi.yaml:
...
properties:
name:
type: objectdescription: "A string, a number or a boolean"anyOf:
- type: string
- type: integerformat: int64
- type: numberformat: double
- type: boolean
...
whereas the following would be correct:
...
properties:
name:
description: "A string, a number or a boolean"anyOf:
- type: string
- type: integerformat: int64
- type: numberformat: double
- type: boolean
...
Activity
Santobert commentedon Jan 30, 2024
Related:
frantuma commentedon Apr 1, 2025
This is has been addressed in #4868, closing ticket, please reopen/comment if still experiencing issues