networknt / json-schema-validator

A fast Java JSON schema validator that supports draft V4, V6, V7, V2019-09 and V2020-12
Apache License 2.0
822 stars 323 forks source link

Add test for type loose for array and update doc for behavior #946

Closed justin-tay closed 7 months ago

justin-tay commented 7 months ago

Closes #415

Add test for type validator type loose behavior for arrays and update documentation accordingly that type loose will interpret an item as an array of size 1 and that it will then only validate that that item matches the type defined for the array.

Not sure if there is supposed to be a spec which defines what type loose behavior is supposed to be.

codecov-commenter commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (c7e7ab4) 78.81% compared to head (ad9d785) 78.92%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #946 +/- ## ============================================ + Coverage 78.81% 78.92% +0.10% - Complexity 1694 1699 +5 ============================================ Files 157 157 Lines 5669 5669 Branches 1071 1071 ============================================ + Hits 4468 4474 +6 + Misses 799 796 -3 + Partials 402 399 -3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

stevehu commented 7 months ago

@justin-tay Type-loose is not a concept in the specification but an extra feature in the library. This was introduced to validate incoming requests against the OpenAPI specifications. In HTTP requests, headers, query and path parameters don't have type information.