swaggest / php-json-schema

High definition PHP structures with JSON-schema based validation
MIT License
451 stars 51 forks source link

Return properly cast data when using tolerateStrings #95

Closed Krunch closed 5 years ago

Krunch commented 5 years ago

At the moment, when using tolerateStrings the returned data from $schema->in(...); will still return all data as strings even if data is properly validated/cast internally. Unfortunately that internal data is never returned.

This simple fix simply moves the $return variable assignment to after the skipValidation part instead of before. This makes it so the data that is internally fixed is now properly assigned to the $return variable and thus, returned. Nothing else is impacted by this change.

The TolerateStringsTest was also adjusted to validate that proper casting is returned.

codecov[bot] commented 5 years ago

Codecov Report

Merging #95 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #95   +/-   ##
=======================================
  Coverage   91.68%   91.68%           
=======================================
  Files          27       27           
  Lines        1612     1612           
=======================================
  Hits         1478     1478           
  Misses        134      134
Impacted Files Coverage Δ
src/Schema.php 94.86% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f6557c2...e3de35d. Read the comment docs.

vearutop commented 5 years ago

Thank you, v0.12.24 tagged.