-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Related: OpenAPITools/openapi-generator#16110
Description
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:
public class Pet{
private Long id;
@Schema(description = "A string, a number or a boolean", anyOf = { String.class, Number.class, Boolean.class })
private Object name;
}
This generates the following openapi.yaml:
...
properties:
name:
type: object
description: "A string, a number or a boolean"
anyOf:
- type: string
- type: integer
format: int64
- type: number
format: double
- type: boolean
...
whereas the following would be correct:
...
properties:
name:
description: "A string, a number or a boolean"
anyOf:
- type: string
- type: integer
format: int64
- type: number
format: double
- type: boolean
...
CarstenWickner and rafalmaciejewski
Metadata
Metadata
Assignees
Labels
No labels