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
@JSONVIEW(Views.Abridged.class) @Schema(description = "Velocity of the sensor in the vertical direction, in decimeters per second.", minimum = "-128", maximum = "127", example="2")
private byte d17;
@JSONVIEW(Views.Abridged.class) @Schema(description = "Standard deviation of the estimate of the sensor track, in degrees.", minimum = "0", maximum = "45", example="2")
private byte d18;
Currently this generates this OpenAPI:
d17:
type: string
format: byte
description: "Velocity of the sensor in the vertical direction, in decimeters
\ per second."
maximum: 127
minimum: -128
example: "2"
d18:
type: string
format: byte
description: "Standard deviation of the estimate of the sensor track, in
\ degrees."
maximum: 45
minimum: 0
example: "2"
Which leads me to think this should be defined in OpenAPI as:
"d17": {
"maximum": 127,
"minimum": -128,
"type": "number",
"description": "Velocity of the sensor in the vertical direction, in decimeters per second.",
"format": "int8",
"example": 2
},
"d18": {
"maximum": 45,
"minimum": 0,
"type": "number",
"description": "Standard deviation of the estimate of the sensor track, in degrees.",
"format": "int8",
"example": 2
},
or possibly this:
"d17": {
"maximum": 127,
"minimum": -128,
"type": "integer",
"description": "Velocity of the sensor in the vertical direction, in decimeters per second.",
"format": "int8",
"example": 2
},
"d18": {
"maximum": 45,
"minimum": 0,
"type": "integer",
"description": "Standard deviation of the estimate of the sensor track, in degrees.",
"format": "int8",
"example": 2
},
So the type would not be a string. Also having a maximum & minimum string makes no sense. Only when the type is a number or integer do those make sense.
But the key is the "format": "int8" as that makes it clear this is a signed 8 bit number.
Thanks,
-David
The text was updated successfully, but these errors were encountered:
I agree with using int8 for byte (and similarly int16 for short). Both imply the min/max values so I don't think they need to be explicitly generated by default.
If we have Java code like this:
@JSONVIEW(Views.Abridged.class)
@Schema(description = "Velocity of the sensor in the vertical direction, in decimeters per second.", minimum = "-128", maximum = "127", example="2")
private byte d17;
@JSONVIEW(Views.Abridged.class)
@Schema(description = "Standard deviation of the estimate of the sensor track, in degrees.", minimum = "0", maximum = "45", example="2")
private byte d18;
Currently this generates this OpenAPI:
d17:
type: string
format: byte
description: "Velocity of the sensor in the vertical direction, in decimeters
\ per second."
maximum: 127
minimum: -128
example: "2"
d18:
type: string
format: byte
description: "Standard deviation of the estimate of the sensor track, in
\ degrees."
maximum: 45
minimum: 0
example: "2"
The best I can find from the OpenAPI spec is here: https://spec.openapis.org/registry/format/
Which leads me to think this should be defined in OpenAPI as:
"d17": {
"maximum": 127,
"minimum": -128,
"type": "number",
"description": "Velocity of the sensor in the vertical direction, in decimeters per second.",
"format": "int8",
"example": 2
},
"d18": {
"maximum": 45,
"minimum": 0,
"type": "number",
"description": "Standard deviation of the estimate of the sensor track, in degrees.",
"format": "int8",
"example": 2
},
or possibly this:
"d17": {
"maximum": 127,
"minimum": -128,
"type": "integer",
"description": "Velocity of the sensor in the vertical direction, in decimeters per second.",
"format": "int8",
"example": 2
},
"d18": {
"maximum": 45,
"minimum": 0,
"type": "integer",
"description": "Standard deviation of the estimate of the sensor track, in degrees.",
"format": "int8",
"example": 2
},
So the type would not be a string. Also having a maximum & minimum string makes no sense. Only when the type is a number or integer do those make sense.
But the key is the "format": "int8" as that makes it clear this is a signed 8 bit number.
Thanks,
-David
The text was updated successfully, but these errors were encountered: