[REQ] Validation for primitive request bodies
Created by: pulledtim
Is your feature request related to a problem? Please describe.
While working with the codegenerator i stumbled across the problem that validation parameters (eg minimum) were not added to the generated code in primitiv request bodies. The reason is that the parameters are just not handed over
Describe the solution you'd like
I would like the codegenerator to add the validation to the request body, in the same way as it does for schemas.
Describe alternatives you've considered
I could also use a schema for every primitive request body, but that would clutter the api and make a messy code.
Additional context
The API
openapi: '3.0.2'
info:
description: "Test"
version: "1.0.0"
title: "Test"
servers:
- url: http://localhost:8080
description: 'Local development server.'
paths:
/test:
put:
operationId: "doTest"
requestBody:
required: true
content:
text/plain:
schema:
type: integer
minimum: 0
responses:
200:
description: "All good."
is currently parsed into
...
"bodyParam" : {
"isFormParam" : false,
"isQueryParam" : false,
"isPathParam" : false,
"isHeaderParam" : false,
"isCookieParam" : false,
"isBodyParam" : true,
"hasMore" : false,
"isContainer" : false,
"secondaryParam" : false,
"isCollectionFormatMulti" : false,
"isPrimitiveType" : true,
"isModel" : false,
"baseName" : "body",
"paramName" : "body",
"dataType" : "Integer",
"baseType" : "Integer",
"example" : "56",
"isString" : false,
"isNumeric" : false,
"isInteger" : true,
"isLong" : false,
"isNumber" : false,
"isFloat" : false,
"isDouble" : false,
"isByteArray" : false,
"isBinary" : false,
"isBoolean" : false,
"isDate" : false,
"isDateTime" : false,
"isUuid" : false,
"isUri" : false,
"isEmail" : false,
"isFreeFormObject" : false,
"isListContainer" : false,
"isMapContainer" : false,
"isFile" : false,
"isEnum" : false,
"vendorExtensions" : { },
"hasValidation" : false,
"isNullable" : false,
"required" : true,
"exclusiveMaximum" : false,
"exclusiveMinimum" : false,
"uniqueItems" : false
}
...
but should be:
...
"bodyParam" : {
"isFormParam" : false,
"isQueryParam" : false,
"isPathParam" : false,
"isHeaderParam" : false,
"isCookieParam" : false,
"isBodyParam" : true,
"hasMore" : false,
"isContainer" : false,
"secondaryParam" : false,
"isCollectionFormatMulti" : false,
"isPrimitiveType" : true,
"isModel" : false,
"baseName" : "body",
"paramName" : "body",
"dataType" : "Integer",
"baseType" : "Integer",
"example" : "56",
"isString" : false,
"isNumeric" : false,
"isInteger" : true,
"isLong" : false,
"isNumber" : false,
"isFloat" : false,
"isDouble" : false,
"isByteArray" : false,
"isBinary" : false,
"isBoolean" : false,
"isDate" : false,
"isDateTime" : false,
"isUuid" : false,
"isUri" : false,
"isEmail" : false,
"isFreeFormObject" : false,
"isListContainer" : false,
"isMapContainer" : false,
"isFile" : false,
"isEnum" : false,
"vendorExtensions" : { },
"hasValidation" : false,
"isNullable" : false,
"required" : true,
"exclusiveMaximum" : false,
"minimum" : "0",
"exclusiveMinimum" : false,
"uniqueItems" : false
}
...