As stated in the title, my team always sends a response of which properties which represent float/int/bigInteger as strings, should the swagger type of those properties be number or a string?
The data type in your OpenAPI definition must indicate the actual data type used in the payload.
If the response is
{
"id": "12345"
}
then id
is a type: string
property.
You can use format
and pattern
(regex pattern) to clarify the value format. For example, if id
strings contains non-negative integer numbers, you can define id
as:
type: string
pattern: "^\\d+$"