You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the validator does the following on unknown type values:
thrownewInvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
This code violates draft-03, but correctly enforces draft-04 and later versions of the spec, which do not allow arbitrary type values.
Draft-03 says the following:
If the property is not defined or is not in this list, then any type of value is acceptable. Other type values MAY be used for custom purposes, but minimal validators of the specification implementation can allow any instance value on unknown type values.
In addition, the list of valid type values includes any, which is valid under draft-03, but violates draft-04 and newer versions of the spec, which say that the type value MUST be one of the seven core primitive types.
Obviously validating the schema first would catch this... but if the user doesn't do that, then IMO we should do the following:
If we can determine the schema spec in use, follow the correct behavior for that spec.
If we can't determine the spec, then assume draft-03 (which is the more permissive standard), but emit a warning of some kind - may need to build a mechanism for this (I might do a PR for such a mechanism regardless, as it's useful in other areas).
Thoughts?
The text was updated successfully, but these errors were encountered:
No response to this, so have started working on a PR to add a 'strict' mode that will detect and validate against the exact version of the spec being used, with a fallback to the current 'permissive' model if the version can't be accurately determined. That should render this issue moot.
Currently, the validator does the following on unknown type values:
This code violates draft-03, but correctly enforces draft-04 and later versions of the spec, which do not allow arbitrary type values.
Draft-03 says the following:
In addition, the list of valid type values includes
any
, which is valid under draft-03, but violates draft-04 and newer versions of the spec, which say that the type value MUST be one of the seven core primitive types.Obviously validating the schema first would catch this... but if the user doesn't do that, then IMO we should do the following:
Thoughts?
The text was updated successfully, but these errors were encountered: