From ae4632f475200bdfcf2d6727df43858625692085 Mon Sep 17 00:00:00 2001 From: Christian Boitel Date: Mon, 1 Aug 2022 17:17:06 +0200 Subject: [PATCH] fix #482: add support for integer values additionally to floats --- openapi3/schema.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openapi3/schema.go b/openapi3/schema.go index 2a672ceb1..85b0e0388 100644 --- a/openapi3/schema.go +++ b/openapi3/schema.go @@ -814,6 +814,12 @@ func (schema *Schema) visitJSON(settings *schemaValidationSettings, value interf switch value := value.(type) { case bool: return schema.visitJSONBoolean(settings, value) + case int: + return schema.visitJSONNumber(settings, float64(value)) + case int32: + return schema.visitJSONNumber(settings, float64(value)) + case int64: + return schema.visitJSONNumber(settings, float64(value)) case float64: return schema.visitJSONNumber(settings, value) case string: