680 Commits

Author SHA1 Message Date
Danny van der Sluijs
c9f00dec76 docs: prepare release 6.3.1 6.3.1 2025-03-18 20:03:56 +01:00
Nicos Panayides
cba7697e87
Fix null comparison (#807)
Fixes null not equal to null.

Issue: https://github.com/jsonrainbow/json-schema/issues/806
2025-03-18 18:57:34 +01:00
Danny van der Sluijs
e9ac599ff9
fix: ensure numeric issues in const are correctly evaluated (#805)
Fixes https://github.com/jsonrainbow/json-schema/issues/778
2025-03-14 13:26:17 +01:00
Danny van der Sluijs
fbb4049557 docs: 6.3.0 release 6.3.0 2025-03-14 12:57:01 +01:00
Danny van der Sluijs
191bd4eb1a
ci: Reduce duplicate workflow runs (#804) 2025-03-14 12:55:55 +01:00
Danny van der Sluijs
cd30df36e0
refactor: replace icecave/parity with custom deep comparator (#803)
After considering the options and rethinking the problem we are trying
to solve I came top the conclusion we don't need a external library
which can handle PHP class equality. Since we are working with JSON we
only have scalar types (boolean, float, integer and string) and two
collections types array and `stdClass`.
This made it simple to write our own deep comparison.

Fixes https://github.com/jsonrainbow/json-schema/issues/753
2025-03-14 12:52:27 +01:00
Danny van der Sluijs
848c9ee9b3 fix: replace filter_var for uri and uri-reference to userland code to be RFC 3986 compliant (#800)
This pull request introduces new validators for URI and relative
references and integrates them into the `FormatConstraint` class. The
changes also include corresponding unit tests to ensure the validators
work as expected.

### New Validators:
*
[`src/JsonSchema/Tool/Validator/UriValidator.php`](diffhunk://#diff-2019f410f3ef4cdf8478ffa71444226beb8a118d60b3337c40eaaec8d3aef7a3R1-R65):
Added a new class `UriValidator` to validate URIs according to RFC 3986
and RFC 5322 for `mailto:` URIs.
*
[`src/JsonSchema/Tool/Validator/RelativeReferenceValidator.php`](diffhunk://#diff-0bfeeb9c38593a2d65cc2e8c49fe873c78765eac81c00cf0a398bd754ca9c7a8R1-R53):
Added a new class `RelativeReferenceValidator` to validate relative
references according to RFC 3986.

### Integration into `FormatConstraint`:
*
[`src/JsonSchema/Constraints/FormatConstraint.php`](diffhunk://#diff-44020f0c0690a2a4c1c446e97185986c31b19374b4a99f4b0970c5df36279067L104-R114):
Integrated the new `UriValidator` and `RelativeReferenceValidator` into
the `check` method to replace the previous inline validation logic for
`uri` and `uri-reference` formats.

### Unit Tests:
*
[`tests/Tool/Validator/UriValidatorTest.php`](diffhunk://#diff-6b107cb8679795fb59c070ba500d0646f6d357e4c03a585f4a0c67181e4101fcR1-R49):
Added unit tests for `UriValidator` to ensure it correctly validates
valid and invalid URIs.
*
[`tests/Tool/Validator/RelativeReferenceValidatorTest.php`](diffhunk://#diff-97a7acc2a16f7653d307a16e356c7545b0a0bc26156ce60f7ca13332a6656729R1-R40):
Added unit tests for `RelativeReferenceValidator` to ensure it correctly
validates valid and invalid relative references.

# Closing keywords
fixes https://github.com/jsonrainbow/json-schema/issues/685
2025-03-14 12:46:35 +01:00
Danny van der Sluijs
a8c008885d
fix: only check minProperties or maxProperties on objects (#802)
`minProperties` and `maxProperties` are only applicable on objects.

https://www.learnjsonschema.com/draft4/validation/minproperties/ 

https://json-schema.org/draft-04/draft-fge-json-schema-validation-00#rfc.section.5.4.2
2025-03-07 14:35:34 +01:00
Danny van der Sluijs
dff04e3c7c docs: release 6.2.1 6.2.1 2025-03-06 22:27:10 +01:00
Danny van der Sluijs
949a4d5c89
fix: allow items: true to pass validation (#801)
Fixes #799
2025-03-06 22:25:30 +01:00
Danny van der Sluijs
bb68276a3b
feat: include actual count in collection constraint errors (#797)
Includes the actual count in min/maxItems.

Fixes https://github.com/jsonrainbow/json-schema/issues/501
2025-02-27 12:06:44 +01:00
Danny van der Sluijs
460c0a0940 docs: release 6.2.0 6.2.0 2025-02-26 21:58:15 +01:00
Danny van der Sluijs
d9d665f276
refactor: cleanup redundant checks (#796)
Fixes #793 removing PHP 5.5 and HHVM checks
2025-02-26 21:36:44 +01:00
Aistis
b62fea73bd
fix: property is passed as integer and cannot be accessed (#784) 2025-02-26 20:15:26 +01:00
Danny van der Sluijs
a94f60c332
fix: create deep copy before checking each sub schema in oneOf when only check_mode_apply_defaults is set (#795)
Fixes https://github.com/jsonrainbow/json-schema/issues/510
2025-02-26 19:41:16 +01:00
Danny van der Sluijs
649793d2b9
Correctly set the schema ID when passing it as assoc array (#794)
Replaces #769 due to lack of permissions to update PR
Closes https://github.com/jsonrainbow/json-schema/issues/767.

---------

Co-authored-by: Dalibor Karlović <dalibor.karlovic@sigwin.hr>
2025-02-26 16:47:32 +01:00
Danny van der Sluijs
44066980b7
fix: Create deep copy before checking each sub schema in anyOf (#792)
Fixes https://github.com/jsonrainbow/json-schema/issues/711
2025-02-26 15:40:07 +01:00
Danny van der Sluijs
7eea9e4f11
fix: Create deep copy before checking each sub schema in oneOf (#791)
This PR creates a deep copy of the value before passing it by reference
for validating sub schemas of a `oneOf` with type coercion enabled.

Fixes #790
2025-02-26 12:11:20 +01:00
Danny van der Sluijs
ec0eab03f2
fix: Upgrade php cs fixer to latest (#783)
Fixes #598
2025-02-21 10:50:06 +01:00
Danny van der Sluijs
f84193ea05
fix: add required permissions for welcome action (#789)
This PR adds the required permissions for making comments on the issues
and pull requests

References:
-
https://github.com/jsonrainbow/json-schema/actions/runs/13372875791/job/37345272696#step:2:1
-
https://github.com/wow-actions/welcome/issues/9#issuecomment-2663235613
2025-02-21 10:31:03 +01:00
Danny van der Sluijs
7660882388
feat: welcome first time contributors (#782)
* feat: welcome first time contributers

* docs: add changelog entry
2025-02-10 21:58:50 +01:00
Jack Worman
afee666c00
More-phpstan-typing (#781) 2025-02-10 20:58:59 +01:00
Jack Worman
56f34b8ced
Use phpstan's int-mask-of<T> (#779)
* Better phpstan typing

* Better phpstan typing
2025-02-06 08:10:30 +01:00
Danny van der Sluijs
f7d78c345d docs: Release 6.1.0 6.1.0 2025-02-04 12:13:26 +01:00
Danny van der Sluijs
97e7e4d772
docs: add contribution and contributor information (#771)
* docs: add contribution and contributor information

* docs: add changelog entry
2025-01-28 11:39:45 +01:00
Dieter Beck
caa0c6c9c8
fix: Succeed format validation if the type is not in the set of given instance types (#773) (#773)
See https://json-schema.org/draft-04/draft-fge-json-schema-validation-00#rfc.section.7.1: If the type of the instance to validate is not in this set, validation for this format attribute and instance SHOULD succeed.
2025-01-28 11:35:36 +01:00
Dieter Beck
d212ecacc2
Remove obsolete check if FILTER_FLAG_EMAIL_UNICODE is defined (#772)
* Remove obsolete check because PHP 7.1 or lower is not supported anymore

* Refresh phpstan baseline

* Add changelog
2025-01-20 21:33:40 +01:00
Danny van der Sluijs
14e41d82de
refactor: Cleanup test from @param annotations (#768)
* refactor: Cleanup test from @param annotations

* docs: add changelog entry
2025-01-10 11:16:00 +01:00
Danny van der Sluijs
377231495a
Raise minimum level php enum (#766)
* build: raise minimum level of marc-mabe/php-enum

* docs: add changelog entry
2024-11-21 22:19:10 +01:00
Danny van der Sluijs
b5c8c9ee12
refactor: add declare strict_types to all classes in ./src (#758)
* refactor: add declare strict_types to all classes in ./src

* fix: correct regression from adding declare strict_types

* refactor: enforce string at datetime casting

* docs: add changelog entry
2024-11-21 22:10:43 +01:00
Danny van der Sluijs
63d6369385
build: include php 8.4 in workflow (#765) 2024-11-21 22:01:07 +01:00
Tac Tacelosky
3fe73adcee
tweak spacing (#763)
* tweak spacing

tweak spacing so array keys are indented the same.

* docs: add changelog entry

---------

Co-authored-by: Danny van der Sluijs <danny.vandersluijs@icloud.com>
2024-11-21 21:57:07 +01:00
Danny van der Sluijs
ba2d3c7700
fix: correct phpstan baseline (#764) 2024-11-21 21:46:33 +01:00
Danny van der Sluijs
24e7cbf8c5
refactor: add visibility modifiers to class constants (#757)
* refactor: add visibility modifiers to class constants

https://wiki.php.net/rfc/class_const_visibility

* docs: add changelog entry
2024-10-21 11:37:15 +02:00
Ali Yousefi
73e38269ed
Update: add ext-json to composer.json to ensure JSON extension availa… (#759)
* Update: add ext-json to composer.json to ensure JSON extension availability

* docs: add changelog entry

---------

Co-authored-by: Danny van der Sluijs <danny.van.der.sluijs@infi.nl>
2024-10-21 11:13:21 +02:00
Witold Wasiczko
f0b02264a3
Invalid string validation (#704)
* Add test case for invalid string type validation

* docs: add changelog entry

---------

Co-authored-by: Danny van der Sluijs <danny.van.der.sluijs@infi.nl>
2024-09-20 13:40:40 +02:00
Niklas Correnz
eac0893905
Fix wrong combined paths when traversing upwards. Fixes #557 (#652)
* Fix wrong combined paths when traversing upwards. Fixes #557

* docs: add changelog entry

---------

Co-authored-by: Danny van der Sluijs <danny.van.der.sluijs@infi.nl>
2024-09-20 13:29:14 +02:00
Danny van der Sluijs
60488b2317
Resolve deprecations: Optional parameter $... declared before required parameter $... (#752)
* fix: remove default value to resolve deprecations notice

* docs: add changelog entry
2024-09-13 15:28:30 +02:00
Jordi Boggiano
5b3bd2b1b6
Increase phpstan level to 8 with baseline to swallow existing errors (#673)
* Increase phpstan level to 8 with baseline to swallow existing errors

* Add phpstan to composer.json

* docs: a changelog entry

---------

Co-authored-by: Danny van der Sluijs <danny.van.der.sluijs@infi.nl>
2024-09-13 15:20:41 +02:00
Danny van der Sluijs
23c8551197
Add return types to test suite (#748)
* refactor: Add return types in the test suite

* docs: Add changelog entry
2024-08-30 15:09:12 +02:00
Danny van der Sluijs
cddbef1378
refactor: Replace traditional syntax array with short syntax array (#747)
* refactor: Replace traditional syntax array with short syntax array

* docs: Update changelog
2024-08-27 09:30:55 +02:00
Danny van der Sluijs
2eb0deffe8
Extend pipeline for newer versions php (#746)
* ci: Add PHP 8.0 and greater to build matrix

* ci: Remove PHP 5.3 - 7.1 from workflows

* build: Require minimum PHP 7.2

* build: Upgrade to PHPUnit 8.5

* refactor: Add now required void return types for setup() methods

* build: Include phpspec/prophecy dependency

* refactor: Replace setExpectedException with expectException/expectExceptionMessage

* refactor: Replace @expectedException annotation for expectException method

* refactor: Replace assertInternalType for assertIsArray

* refactor: Replace getMock for createMock

* test: Improve test assertions

* fix: Solve return type issues with Objectiterator (port of #682)

See https://github.com/jsonrainbow/json-schema/pull/682

* build: Update icecave/parity to ^3.0 as 1.0 uses deprecated each() method

* style: Correct code style issues

* fix: Fix deprecation notices found from GHA workflow run

See https://github.com/jsonrainbow/json-schema/actions/runs/10216569969/job/28268331091

* fix: Add fallback to empty string when null value is passed in UriResolver::parse

* fix: Port #717: Fixes for implicit nullability deprecation

See https://github.com/jsonrainbow/json-schema/pull/717

* ci: Avoid GHA run on each push and pull request; Include PHP 8.4 in matrix

* ci(Drop-PHP-8.4-from-matrix): This PR adds phpspec/prophecy as an explicit dependency which is restrictive and doesnt support upcoming PHP versions

* refactor: Replace ternary variable with explicit cast to string
2024-08-27 09:00:10 +02:00
Danny van der Sluijs
985840f9ec
test: Correct casing of paths used in tests (#745)
* test: Correct casing of paths used in tests

* docs: Add changelog entry
2024-08-05 08:44:35 +02:00
Danny van der Sluijs
3c49c66918
Add missing property in uri resolver test (#743)
* fix: Add missing property definition

* docs: Add changelog entry
2024-08-02 15:11:50 +02:00
Viktor Szépe
1973ab58e6
Fix pugx badges in README (#742)
* Fix pugx badges in README

* docs: Add changelog entry

* fix: Correct accidently added file

---------

Co-authored-by: Danny van der Sluijs <danny.vandersluijs@icloud.com>
2024-07-31 21:11:54 +02:00
Danny van der Sluijs
4aa6fd383e
Correct misconfigured mocks in JsonSchema\Tests\Uri\UriRetrieverTest (#741)
* test: Correct misconfigured mocks

* test: Refactor to use willReturn() method

* test: Make use of already imported classname

* test: Ignore return value when exception is expected to be thrown

* test: Mock complete interface

* docs: Add changelog entry
2024-07-30 21:27:50 +02:00
Danny van der Sluijs
a38c6198d5 docs: Add release version & data to changelog 6.0.0 2024-07-30 19:49:21 +02:00
Danny van der Sluijs
957ac43c49
Merge pull request #732 from jsonrainbow/Prepare-release-6
docs: Add changelog and upgrade documentation for version 6.0
6.0.0-beta
2024-07-09 09:19:24 +02:00
Danny van der Sluijs
daee7cca09 docs: Add changelog and upgrade documentation 2024-07-09 09:15:26 +02:00
Danny van der Sluijs
47708f50b5
Merge pull request #709 from DannyvdSluijs/Issue-694
Addresses Content-Type mismatch on HTTP 301 Moved Permanently with FileGetContents
2024-05-27 13:57:01 +02:00