-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Add a deserialized Data Validator #6770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This part of code is really needed in my opinion for anyone wanting to take a JSON deserialize it and validate it.
cc PHP technical committee @jebentier, @dkarlovi, @mandrean, @jfastnacht, @ackintosh, @renepardon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this, seems out of place.
* @param mided $data object to be validated | ||
* @throws \InvalidArgumentException | ||
*/ | ||
public static function verifyDeserializedData ($data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the design here: the data needs to be valid enough for the deserialization to take place. If that already happened, ObjectSerializer
has nothing to do with it.
@@ -339,4 +339,29 @@ class ObjectSerializer | |||
return $instance; | |||
} | |||
} | |||
|
|||
/** | |||
* Verify the Data structure to make sure all the objects are validated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code seems to be using tabs? Spaces are used elsewhere.
} | ||
|
||
} | ||
else if (is_array ($data)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline with previous closing brace.
This part of code is really needed in my opinion for anyone wanting to take a JSON deserialize it and validate it.