Please clarify: Are values like 1.0 valid for the integer data type?
JSON schema allows values like 1.0 for integers. But the OpenAPI specification contains this sentence:
Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part.
"without a fraction or exponent part" - does that mean that the number is not allowed to have a fraction part at all, e.g. 1 is valid but 1.0 is invalid? Or does it mean that a fraction of 0 is allowed, so 1 is valid and 1.0 is also valid?
Are the rules the same for JSON parameters and for query parameters?
For example, consider this OpenAPI specification:
{
"openapi": "3.0.0",
"info": {
"title": "Integers",
"version": "1.0"
},
"paths": {
"/path1": {
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "integer"
}
}
}
}
}
},
"responses": {
"default": {
"description": "test"
}
}
}
},
"/path2": {
"get": {
"parameters": [
{
"in": "query",
"name": "a",
"schema": {
"type": "integer"
}
}
],
"responses": {
"default": {
"description": "test"
}
}
}
}
}
}
Are these requests valid?
curl -H "Content-Type: application/json" --data '{ "value": 1.0 }' 'http://localhost/path1'
curl 'http://localhost/path2?a=1.0'
Please clarify: Are values like
1.0valid for theintegerdata type?JSON schema allows values like
1.0for integers. But the OpenAPI specification contains this sentence:"without a fraction or exponent part" - does that mean that the number is not allowed to have a fraction part at all, e.g.
1is valid but1.0is invalid? Or does it mean that a fraction of 0 is allowed, so1is valid and1.0is also valid?Are the rules the same for JSON parameters and for query parameters?
For example, consider this OpenAPI specification:
Are these requests valid?