@@ -210,7 +210,7 @@ public function validateResponseBody(ResponseInterface &$response, string $path,
210
210
}
211
211
}
212
212
$ errors = $ notAdditionalOrNullErrors ;
213
- $ response = $ response ->withBody ((new StreamFactory ())->createStream (json_encode ($ responseBodyData )));
213
+ $ response = $ response ->withBody ((new StreamFactory ())->createStream (json_encode ($ responseBodyData, JSON_PRESERVE_ZERO_FRACTION )));
214
214
}
215
215
return $ errors ;
216
216
}
@@ -352,8 +352,8 @@ private function validateObject(array $schema, array $value) : array
352
352
$ validator ->setFormats ($ this ->formatContainer );
353
353
$ schema = SchemaHelper::openApiToJsonSchema ($ schema );
354
354
try {
355
- $ value = json_decode (json_encode ($ value ));
356
- $ schema = json_decode (json_encode ($ schema ));
355
+ $ value = json_decode (json_encode ($ value, JSON_PRESERVE_ZERO_FRACTION ));
356
+ $ schema = json_decode (json_encode ($ schema, JSON_PRESERVE_ZERO_FRACTION ));
357
357
$ result = $ validator ->dataValidation ($ value , $ schema , 99 );
358
358
} catch (Exception $ e ) {
359
359
return [[
@@ -453,7 +453,7 @@ private function setExampleResponse(ServerRequestInterface $request, ResponseInt
453
453
$ exampleResponseBodyData = array_merge ($ exampleResponseBodyData , $ requestBodyData );
454
454
}
455
455
$ response = $ response
456
- ->withBody ((new StreamFactory ())->createStream (json_encode ($ exampleResponseBodyData )))
456
+ ->withBody ((new StreamFactory ())->createStream (json_encode ($ exampleResponseBodyData, JSON_PRESERVE_ZERO_FRACTION )))
457
457
->withHeader ('Content-Type ' , $ mediaType .';charset=utf-8 ' );
458
458
if (is_numeric ($ responseObject ->statusCode )) {
459
459
$ response = $ response ->withStatus ($ responseObject ->statusCode );
@@ -476,7 +476,7 @@ private function error(int $code, string $message, array $errors = []) : Respons
476
476
$ json ['errors ' ] = $ errors ;
477
477
}
478
478
$ response = $ response ->withHeader ('Content-Type ' , 'application/json;charset=utf-8 ' );
479
- return $ response ->withBody ((new StreamFactory ())->createStream (json_encode ($ json )));
479
+ return $ response ->withBody ((new StreamFactory ())->createStream (json_encode ($ json, JSON_PRESERVE_ZERO_FRACTION )));
480
480
}
481
481
482
482
private function parseErrors (ValidationError $ error , $ name = null , $ in = null ) : array
0 commit comments